sql-server-2005

When using the Generate Scripts wizard in SQL Server 2005, where is the Script Behaviour option for DROP followed by CREATE?

Using the Generate Scripts wizard in SQL Server Management Studio 2005 (right click a database -> Tasks -> Generate Scripts...). There is an option for Script Behaviour. The description for the option is as follows: Script Behaviour Generate the script as DROP statements, CREATE statements, or DROP statements followed by CREATE...

SQL Server 2005 error retrieving record based on Datetime primary key column

Hi All, I have a table in SQL Server 2005 with composite primary key, i.e. a foreign key (INT) and DateTime column. When i run the SQL, Select column1 From TABLE where ForeignKey=1 and DateTime='08/26/2010 11:24:36' No record was return when there is such a record. One option to do is Select column1 From TABLE where ForeignKey=1...

SQL Server 2005 database I am using

I have two tables like TaxiBookingDetails which has LoginId,BookingDate,TaxiType (4seater or 8 seater) etc and BookingID I make it as primary key. I have another table called TaxiCountDetails which has TaxiNo and Taxitype . My problem is I want to select or assign to the BookingID for TaxiNo. For example I booked 1 taxi. So when I cli...

The OLE DB provider "MSDASQL" for linked server "(null)" reported an error.

Hi all, I'm very very stuck here, help is greatly appreciated. What am I trying to do? There is an ASP-page (classic ASP) with a CSV upload that gives the following error: Microsoft OLE DB Provider for SQL Server error '80040e14' The OLE DB provider "MSDASQL" for linked server "(null)" reported an error. The provider did not give any...

Send mail by SQL server 2005

i am not getting this store procedure , can you tell where is it "master..xp_sendmail" i have send the mail when any insertion take place in particular table like "Emp" ...

Find storedProcedure by name

Hello, Is there any way I can find in SQL Server Management studio StoredProcedure by name or by part of the name ? (on active database context) Thanks for help ...

SQL 1st of the month to the end of the month.

I have an @StartDate and @EndDate. I need the @StartDate to be the day the query is ran(which will always be the first of the month) and the @EndDate to be exaclty at the end of the month no matter if the month is 30 or 31 days, etc. ...

Array comparison using SQL 2005. Error converting

Ok, no idea why a multi-billion dollar company skimps on array functions for their flagship SQL servers This is why people use MySQL Server. Ok, enough ranting. Using SQL 2005. Let's say i received an array via checkbox from another page using the querystring method: intTask = request.querystring("task") For this example, intTask = "...

SQL 2005 - Linked Server to Oracle Queries Extremely Slow

On my SQL 2005 server, I have a linked server connecting to Oracle via the OraOLEDB.Oracle provider. If I run a query through the 4 part identifier like so: SELECT * FROM [SERVER]...[TABLE] WHERE COLUMN = 12345 It takes over a minute to complete. If I run the same query like so: SELECT * FROM OPENQUERY(SERVER, 'SELECT * FROM TABLE ...

Why is this (non-correlated) subquery causing such problems?

I've got a large query where a simple subquery optimization dropped it from 8 minutes down to 20 seconds. I'm not sure I understand why the optimization had such a drastic effect. In essence, here's the problem part: SELECT (bunch of stuff) FROM a LEFT OUTER JOIN b ON a.ID = b.a LEFT OUTER JOIN c ON b.ID = c.b ... ... I...

How to move tables from one sql server database to another?

We have a database that has grown to about 50GB and we want to pull out a certain set of tables (about 20 of them) from within that database and move them into a new database. All of this would be on the same SQL Server. The tables that we want to pull out are about 12GB of space (6GB data, 6GB indexes). How can we move the tables fro...

Tsql Union Query is breaking sorting in my asp.net gridview

Hello All, I have a stored procedure that works fine on its own. A recent requirement has made me think a Union query will accomplish what I need. Here is the working version. It's uses the ROW_NUMBER() to accomplish paging and sorting correctly SELECT x.TicketID, x.TicketNumber, x.AccountID, x.SkillID FROM ( SELECT ROW_NUMBER() O...

Why would a Stored Procedure run slower than naked T-SQL?

I have a stored procedure in a MS-SQL 2005 database that: Creates two temp tables Executes a query with 7 joins but is not otherwise terribly complex Inserts the results into one of the temp tables Executes two more queries (no joins to "real" tables) that puts records from one of the temp tables into the other. Returns a result set fr...

Index Key Column VS Index Included Column

Hi there Can someone explain this two - Index Key Column VS Index Included Column? Currently, I have an index that has 4 Index Key Column and 0 Included Column. Thanks ...

SSRS 2005 Get Next Record Value

Hello, How to get Next Record value in SSRS 2005? In SSRS 2005 has previous function but it has not NEXT function. Any other way to implement this function? Prompt reply will be appreciated. Thanks, Dhruval Shah ...

How to take differentiate this value in TSQL?

Hi there We have a simplified table like this: TYPE; VALUE AA; 10 BB; 7 CC; 12 I want to do calculation based on TYPE AA & BB so 10 - 7 = 3 How do I achieve this? Thanks ...

How to make my project runnable on any system?

I have developed a solution in Visual Studio 2008 C# WPF! I'm using a service-base SQL database (I've created and managed using Microsoft Visual Studio Sever Explorer), now I'm going to publish it but the problem is that when I install .NET Framework 4.0 and SQLEXPRESS 2005 on other systems, my application doesn't launch! :-( What compon...

Using delimiters to split column in T-SQL while skipping delimiters

OK the question title is vague, but here's the problem. I have a list of filenames in the first column of a table called Files that I want to parse data from that are underscore delimited, however sometimes I want to skip the underscore. Every filename is in the form of: distance1000_7_13_2010_1_13PM_AveryDennisonAD_2300008_10S_Lock.csv...

SQL Server Select on Different column

Hi All, I want to select a value based on different column in SQL Server, say Result = Isnull(A.OUT1,'')<>'' then select A.OUT1 Isnull(A.OUT2,'')<>'' then select A.OUT2 Isnull(A.OUT3,'')<>'' then select A.OUT3 How to form query to get the Result? ...

SQL 2005 - Search String

I want to write a stored procedure that will accept a parameter of @searchString. This will be a varchar(100) and will contain a query value. How can I write the sp so that it could do something like: SELECT * FROM Application a INNER JOIN Applicant app ON app.ApplicationId = a.ApplicationId WHERE a.ApplicationId = @searchString OR app....