sql-server-2000

Can SQL Sub-query return two/more values but still compare against one of them?

I have this query: SELECT Items.Name, tblBooks.AuthorLastName, tblBooks.AuthorFirstName FROM Items WHERE Items.ProductCode IN ( SELECT TOP 10 Recommended.ProductCode FROM Recommended INNER JOIN Stock ON Recomended.ProductCode = Stock.ProductCode AND Stock.StatusCode = 1 WHERE (Recommended.Type = 'TOPICAL') ORDER BY CHECKSUM(NEWID()));...

Syncing SQL server 2000 with 2005 -- will DTS still work?

Hi, we have a local staging server running sql server 2000 and a remote public version also running sql server 2000. The remote version will be upgraded to 2005 and I am wondering if the DTS packages we have in place will continue to function between the two machines? If not, what would be the simplest, most efficient way to sync betwee...

SQL Server : Creating an index on a table variable

Can you create a index on a table variable in SQL Server 2000? i.e. DECLARE @TEMPTABLE TABLE ( [ID] [int] NOT NULL PRIMARY KEY ,[Name] [nvarchar] (255) COLLATE DATABASE_DEFAULT NULL ) Can I create a index on Name? ...

What happened with SQL English query?

SQL Server 2000 was deployed with English Query. At that time, I was young and new to SQL so I skipped that chapter. Now after years, there is again an idea of making a logical program which can understand simple user questions. Is there any alternative to that? Where is English Query now? Best regards, Admir ...

How to find sql2000 databases info using Sqlserver SMO

Hi How to Find sqlserver2000 databases info using SQLSERVER-SMO ...

SQL Server 2000 DTS packages suddenly not updating global variables

I've had a couple of DTS packages that run as scheduled jobs that worked fine for weeks after they were designed and deployed. They basically query a database and return data for a particular date range, outputting it in the form of text files for transmission to vendors. The first step in each process is to query a process log table t...

How do i represent an unknown number of columns in SSRS?

Hey all, I'm working on a rather complex report in Sql Server Reporting Services. My SP returns a dynamic number of columns each of which are dynamically named. Basically think of a time keeping application. Each column that is dynamic represents a time bucket that time was charged to for that team. If no time was charged to that buc...

Why would you have a clustered composite index when none of the fields are used together?

In a legacy database (SQL Server 2000), we have a clustered index that looks like this: CREATE CLUSTERED INDEX [IX_usr] ON [dbo].[usr] ( [uid] ASC, [ssn] ASC, [lname] ASC ) The thing is, as far as I know none of these fields are used together in a WHERE clause. Nor is there really any reason to use any of them together. ...

SELECT DISTINCT not working in .NET application, but works in SQL Mgmt Studio

I have a web app where I am calling a SELECT DISTINCT query on two joined tables. If I try to run the query from the web page, I get the following error: "The text, ntext, or image data type cannot be selected as DISTINCT". When I run it from within SQL Management Studio, the query runs fine - no error. Even more interestingly, there are...

How to figure out which column/value the COALESCE operator successfully selected?

I have a table that I wish to find the first non-null value from 3 (and only 3) columns for each ID starting with Col1 then to Col2 then to Col3 Note: Col3 is NEVER NULL ID Col1 Col2 Col3 ------------------------------ 1 A B X 2 NULL C X 3 NULL NULL X 4 D NULL X To get the ...

how can i get rows with similar column value

how can i get rows with similar column value ...

SQL Server: How to abort a series of batches in Query Analyzer?

i have a series of T-SQL statements separated by the special Query Analyzer batch separator keyword: GO If one batch fails, i need Query Analyzer to not try subsequent batches - i want it to stop processing the series of batches. For example: PRINT 'This runs' go SELECT 0/0, 'This causes an error' go PRINT 'This should not run' go...

MS-SQL Server 2000 slow full text indexing

We have a full text index on a fairly large table of 633,569 records. The index is rebuilt from scratch as part of a maintenance plan every evening, after a bunch of DTS packages run that delete / insert records. Large chunks of data are deleted, then inserted (to take care of updates and inserts), so incremental indexing is not a possib...

SQL Server 2000 Deadlock

We are experiencing some very annoying deadlock situations in a production SQL Server 2000 database. The main setup is the following: SQL Server 2000 Enterprise Edition. Server is coded in C++ using ATL OLE Database. All database objects are being accessed trough stored procedures. All UPDATE/INSERT stored procedures wrap their intern...

Is there a way to persist a variable across a go?

Is there a way to persist a variable across a go? Declare @bob as varchar(50); Set @bob = 'SweetDB'; GO USE @bob --- see note below GO INSERT INTO @bob.[dbo].[ProjectVersion] ([DB_Name], [Script]) VALUES (@bob,'1.2') See this SO question for the 'USE @bob' line. ...

how to know how many users are connected to a particular database in sqlserver2000

how to know how many users are connected to a particular database ...

SQL Query Help

Am Using SQL SERVER - 2000 Table Structure CARDEVENTDATE CARDEVENTTIME CARDNO 20090224 92007 485 20090224 92345 321 20090225 163932 168 20090225 164630 471 20090225 165027 488 20090225 165137 247 20090225 ...

Can I get a list of rows with varchar values that aren't castable to datetime?

I have a legacy SQL Server 2000 database that has one column that has a date that is stored as a varchar instead of a datetime for whatever reason. I want to make a view against this data and use a datetime field instead of a varchar to make making a report against the field easier. The good news is that most of the values look like th...

Stored proc to copy relational data (SQL Server 2000)

I've got the following tables (only key columns shown): Order OrderItem OrderItemDoc Document ======= =========== ============ ========== OrderId OrderItemId OrderItemId DocumentId --etc-- OrderId DocumentId --etc-- --etc-- I'm writing a stored procedure to 'clone' an Order (takes an exist...

Easy performance metrics for SQL Server 2000

The reports that I use (and update) are taking a long time (some take hours). I felt this is far too long and asked previously about this. After taking a long look at various web sites that discuss SQL performance, they all take the stance of being DBA's. However I'm not, and neither are my colleagues (I guess if we had a DBA then we wou...