sql-server-2000

SQL Server 2000 vs SQL Server 2008 Query Performance

I'm working with a client who had a SQL Server 2008 converted from a SQL Server 2000 DB and one of the queries has quite dramatically increased in time since it was on SQL Server 2000. However, if I change the compatibility level to 2008 in the DB, the query goes like a rocket (40-50 times faster). The query does use a number of UDFs. ...

Idea SQL Server 2000

Any quick doc / pdf to understand basics that i can print and have idea? Not 2k8... by quick book i meant something of this sort: http://searchsqlserver.techtarget.com/tip/0,289483,sid87%5Fgci1052507%5Fmem1,00.html?ShortReg=1&mboxConv=searchSQLServer%5FRegActivate%5FSubmit& Little concepts and than the commands. I got it for bac...

How to write a recursive query in SQL Server 2000

I have a table which has a list which looks like this References R. Name LineNo. References A 1.1 (B,24.1) A 6.3 (A, 1.3), (D, 22.1) B 23.1 (A. 1.2) B 24.1 (B,23.1) C 2 (A, 1.1) D 3.12 (A, 6.3) The query sho...

Declaring a default constraint when creating a table

Hi, I am creating a new table in Microsoft SQL server 2000 by writing the code instead of using the GUI, I am trying to learn how to do it "the manual way". This is the code I am actually using, and it works fine: CREATE TABLE "attachments" ( "attachment_id" INT NOT NULL, "load_date" SMALLDATETIME NOT NULL, "user" VARCHAR(25) NOT NU...

TSQL: Remove duplicates based on max(date)

I am searching for a query to select the maximum date (a datetime column) and keep its id and row_id. The desire is to DELETE the rows in the source table. Source Data id date row_id(unique) 1 11/11/2009 1 1 12/11/2009 2 1 13/11/2009 3 2 1/11/2009 4 Expected Survivors 1 13/11/2009 ...

When do you compact a Sql Server Database?

We have a SQL Server 2000 database that holds most of our teams databases running on a relatively old server. Lately we have been having some weird slow down issues on some of our database calls in various applications. (So I know it isn't application specific) It was mentioned to me that we should look into compacting some of our d...

Count of items per date, with no gaps in the dates

I have a table of posts to a website, where each entry has its creation date. I want to return a table like: Date Posts 16-11-2009 5 17-11-2009 0 18-11-2009 4 etc But I'm struggling to find the right SQL. I can easily get a count of posts grouped by date, but this doesn't return the dates when there are no posts (eg it...

SQL Server filegroup full during a large INSERT INTO statement

Consider a SQL script designed to copy rows from one table to another in a SQL 2000 database. The transfer involves 750,000 rows in a simple: INSERT INTO TableB([ColA],[ColB]....[ColG]) SELECT [ColA],[ColB]....[ColG] FROM TableA This is a long running query, perhaps in part because ColB is of type ntext. There are a handful of CONVER...

SQL "Group By" VarChar Field With Max Date or All results of the same date

Hello, Lets say I have this table -------------------------------------------------------------- | ID | DATE | GROUPNAME | RESULT | INFO1 | INFO2 | -------------------------------------------------------------- | 1 | 01/06 | Group1 | 12345 | Abc | xxxx | | 2 | 01/04 | Group2 | 54321 | AAA ...

Rename a NOT NULL column with no default in a SQL Server 2000 table in Merge Replication

Using sp_repladdcolumn I can either: 1) add a column that allows nulls; or 2) add a column with a default value that does not allow nulls. Without dropping and recreating the whole subscription I would like to: 3) add a column with no default value that does not allow nulls. Is this possible? I realize I would need to populate the co...

Find last sunday

How will you find last sunday of a month in sql 2000? ...

TSQL- generate a sequence number for duplicate records

Using SQL Server 2000, consider a source table with more than 400,000 records. The task is to select each regno entry with an incrementing on-the-fly rowid or sequence number for those with duplicates or multiple entries. For those which do NOT have duplicate entries in the source table, the rowid should simply be null. Here's an exam...

Getting error information in DTS package

Is there any way of error handling in DTS packages. Here is the scenario, I have a dts package with some SQL tasks and Active-x script tasks. The SQL task will run the scripts to validate the data in a table and if the data is in correct, the script will raise error in the script making the task to fail. On failure of the SQL task the...

SQL Server: How to generate object scripts without DMO/SMO?

i want to generate scripts for database objects, e.g. tables views stored procedures functions Since: SQL Server Management Objects (SMO) SQL Distributed Management Objects (SQL-DMO) (depricated) are not installed on a fresh install of: Windows XP Windows Vista Windows 7 nor are they redistributable, they are not an option (...

Server Error due to paging issue

Hello all, I think I sorted out my GridView1_PageIndexChanged event and thinking it should work protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e) { GridView1.DataSourceID = "lqPackWeights"; GridView1.PageIndex = e.NewPageIndex; } However, when I now attempt to access page 2 of x, I receive the...

how can I add 2 digit together in SQL Server 2000

Hi, suppose I have a number 62. This is composed of 2 digits How can add 2 digit together divide by 10 and if result = something like 6.2 just take reminder declare @Number int,@Result int set @Number =62 if len(@Number) > 1 set @Result=????=--Add 6 and 2 =8 set @result=@result % 10 --Mod operator print @result -- the r...

Distinct of date

How to find distinct of date in sql 2000? For example :i have a table "Dates".It contains different dates like 26-11-2009, 25-11-2009,26-11-2009.'26-11-2009' has two entries.When i select date from this table i need only two entries such as 25-11-2009 and 26-11-2009. Edited section: In the table 'Emplyoee' there are two fields-JoinDat...

SQL Server 2000 compatible script

Hi, this T-SQL script works fine in SQL Server 2005 but in SQL Server 2000 it says incorrect Syntax near 'Try' 'End'. Any help please? Begin Transaction Begin Try UPDATE Test SET RefID = 'bc27de13-2323-4ce8-8c87-0171efbd812a' WHERE RefID = 'bc27de13-2323-4ce8-8c87-0171ffbd812a'; DELETE FROM Physician WHERE RefID = 'bc27...

SQL query getting data

In SQL Server 2000: hello i have a table with the following structure: sku brand product_name inventory_count ------ ------ ------------- --------------- c001 honda honda car 1 3 t002 honda honda truck 1 6 c003 ford ford car 1 7 t004 ford ford truck 1 ...

SQL Server Service Broker to insert data on a SQL Server 2000

Hi all, I have two servers, the first one with SQL Server 2005 and the second one with SQL Server 2000. I want to insert data from the 2005 to the 2000 and I want to do it unsync (without distributed transactions because "save transaction" are used). Once the information is inserted in the tables of the 2000 server, some instead-of tri...