sql-server-2008

SQL Server 2008 scalability options

What are the options for scalability with SQL Server 2008? Or does it even have options to design for scalability? ...

How can I query how much time a SQL server database restore takes?

Hi Im trying to write a query that will tell me how much time a restore (full or log) has taken on SQL server 2008. I can run this query to find out how much time the backup took: select database_name, [uncompressed_size] = backup_size/1024/1024, [compressed_size] = compressed_backup_size/1024/1024, backup_s...

SQL Server 2000 connection string converted to SQL Server 2008

I have a SQL Server 2000 connection string that I need to work with SQL Server 2008. I am using a DSN and it works just fine, but when I try to connect from the web page, the page never loads and I have to restart my IIS to get the web page to load again. this is my SQL Server 2000 string: MM_RFI_Datasource_STRING = "DSN=RFI_Datasour...

SQL Server 2008 VarChar To DateTime

I have a table where unfortunately a number of dates are stored as strings. I have a number of reports that cast them to datetimes and filter by them. This was working fine until today when all of a sudden i'm getting this error "The conversion of a varchar data type to a datetime data type resulted in an out-of-range value." The dat...

SQLServer2008 - Custom templates not showing in Solution Explorer

SQL Server 2008 Hello. New templates I create in Template explorer are not showing in the solution explorer Template explorer > Stored Procedure > New folder - Custom > usp_NewStoredProcedure > Save. I can then see new SP in template explorer. However when I try and use the new template in Solution Explorer Solution Explorer > ...

8078 bytes in 8060 B datapage (SQL Server)?

It is written everywhere that data in SQL Server is written in pages of 8K (8192 B) each with 8060 bytes for data and the rest is overhead (system info). Though, the recent article [1] gives code example illustrating, as I understood, that 8078 bytes of data fit into a page. What do I miss in understanding 8,060 B per per page? I ve...

how storage is reserved by SQL Server? and howto overrule it ?

I am trying to understnad how SQL Server allocates and reserves space. Having run the examples from the article "How table design can impact your SQL Server performance?" [1], I received the results [My 1.1] diverting from those in article [1.1]. Why? Why in one case the excessive space is reserved/allocated (all cases in [1]) but ...

query notification

could someone pls tell me the version requirements for query notification? we are running sql server 2008 and use ODBC 3.0 but are still on visual studio 6. on compile some of the ODBC parameter (ex: SQL_SOPT_SS_QUERYNOTIFICATION_OPTIONS) are not found. any help would be greatly appreciated. thanks in advance, Bill Riggio ...

Query times out in SP, but runs fine in query analyzer

I seem to be facing a strange issue in SQL 2008. I have a query which runs fine and fast from query analyser, but times out if run through a stored procedure! The SP just starts with this query and has no other code before this query SELECT col1,col2 FROM TBL1 (nolock) INNER JOIN TBL2 (nolock) ON tbl1.col=LEFT(tbl2.col1,LEN(tbl2.col1)...

SQL Fastest way to compare two dates (non standard varchar format and datetime)

I have two "date" fields that I need to join on. The first is a normal datetime in the format yyyy-mm-dd hh:mm:ss The second is a varchar(8) in the red-headed step child format mmddyyyy Now this gets painful because there is no easy way to convert to the corresponding type. There is a built-in format that is yyyymmdd but that does...

Skip some columns in SqlBulkCopy

I'm using SqlBulkCopy against two SQL Server 2008 with different sets of columns (going to move some data from prod server to dev). So want to skip some columns not yet existed / not yet removed. How can I do that? Some trick with ColumnMappings? Edit: I do next: DataTable table = new DataTable(); using (var adapter = new SqlDataAdap...

Cannot bulk load because the file could not be opened. Operating system error code 1326(Logon failure: unknown user name or bad password.).

bulk upload from csv test file "\servername\wwwroot\Upload\LDSAgentsMap.txt" SET QUOTED_IDENTIFIER ON SET ANSI_NULLS ON GO CREATE PROCEDURE [dbo].[sp_CSVTest_BulkInsert] ( @Path NVARCHAR(128) ) AS DECLARE @Sql NVARCHAR(256) SET @Sql = 'BULK INSERT CSVTest FROM ''' + @Path + ''' WITH ( FIELDTERMINATOR = '','', ROWTERMIN...

SQL Server 2008 - Shredding XML to tables need to keep UNKNOWN DATE value as NULL

Hello. I was wondering if someone could help I've successfully been able to import an XML document to a table with an XML data type in SQL Server2008, how ever when I try and shred from that table to a staging table any DATE values without an entered date are inserted to the staging table as 1900-01-01. Is there a cleaver way i'm mi...

How Can I Rid off Redundant Values from a Column?

This is the sample output Let me explain what's going on: The query returns all invoices # of every year along with the products that is involved in the invoice. As you see, we have two invoice in 2010...The invoices are 30463 and 30516. The invoice 30463 has 4 products, its shipping price is 105.88. As you see the shipping price is r...

I Need some sort of Conditional Join.

Okay, I know there are a few posts that discuss this, but my problem cannot be solved by a conditional where statement on a join (the common solution). I have three join statements, and depending on the query parameters, I may need to run any combination of the three. My Join statement is quite expensive, so I want to only do the join w...

SQL Server 2008 - script data using Scripter.EnumScript fails with "Login failed for user" error

I am trying to script data of a table. If I use windows authentication (Integrated Security=true), code works. If I switch to sql authentication with existing user and password, it fails trying to access returned scripts enumerable. The user is an SQL login and admin. Simplified version of code is here: //string connectionString ...

SQL Server error on stored procedure parameters

I'm getting a SQL Server error on a stored procedure (although it appears to run and run correctly). When I view the stored procedure call in my code, it is underlined, and the highlighted error message says: "Procedure sp_ReferenceSite has no parameters and arguments were supplied." My procedure is called like this: execute dbo.sp_Re...

SQL Server: how to query when the last transaction log backup has been taken?

I would like to query for all databases (in SQL Server 2008 instance) date when the last transaction log backup has been taken. How to do that? I know that this information is somewhere, but I don't know where. ...

Errors: "INSERT EXEC statement cannot be nested." and "Cannot use the ROLLBACK statement within an INSERT-EXEC statement." How to solve this?

I have three stored procedures Sp1, Sp2 and Sp3. The first one (Sp1) will execute the second one (Sp2) and save returned data into @tempTB1 and the second one will execute the third one (Sp3) and save data into @tempTB2. If I execute the Sp2 it will work and it will return me all my data from the Sp3, but the problem is in the Sp1, whe...

SSRS 2008 wordwrapping issues

hi, i am using SSRS 2008 and currently I am facing wordwrapping issues. In report I am placing a table and some 6 columns. My report size is A4 landscape. When running the report,one of the column has a large value without any spaces,the column was not wrapping up,so I changed the layout to A3 landscape and the wrapping started worki...