sql-server-2000

ASP Classic - Recordset Object vs. Command Object

岁酱吖の 提交于 2019-12-07 07:03:26
问题 I am using ASP Classic and SQL Server 2000 to create dynamic websites. I am a bit confused about when to use a recordset object and when to use a command object when querying the database. I was told that if the stored procedure would be returning records from a SELCT statement then I should use a recordset, however if I am up updating or inserting then I should use a command object and pass all data as parameters to the stored procedure. When using a recordset I often pass any required data

Case-insensitive REPLACE() in SQL Server 2000

微笑、不失礼 提交于 2019-12-07 03:46:07
问题 I have a field that contains strings such as 'Blah-OVER', 'Blah-OveR', etc. and want to select them without the 'over's. This only catches the first case (so to speak) and not the others: SELECT field as "before", REPLACE(field, 'OVER', '') as "after" How do I just get them all to say 'Blah-' (preserving the case of what's left) without attempting to cover every case combination with another nested REPLACE function? 回答1: Use a case insensitive collation: SELECT field as "before", REPLACE

What is the limitation in the length of an SqlCommand query

我是研究僧i 提交于 2019-12-07 02:20:08
问题 Is there a limitation in the length of a query that SQL Server can handle? I have a normal SqlCommand object and pass a very long select statement as a string. The query seems to be fine when running against an SQL Server 2005/2008 engine but doesn't execute against an SQL Server 2000 engine. I don't have any error details as I only have this information 3rd hand but my application isn't working as expected. I could go to the trouble of installing an SQL Server 2000 instance but I was just

Why should I upgrade from SQL2000 to SQL2005?

北城余情 提交于 2019-12-07 02:10:34
问题 I'm looking for the single biggest reason you are glad that you've already made the jump from SQL2000 to SQL2005. 回答1: Recursion without creating temporary tables. Native Exception support (Try/Catch instead of if @Error goto) 回答2: Because: Microsoft would like to remind customers that support for SQL Server 2000 Service Pack 3a (SP3a) will end on July 10, 2007. 回答3: Native XML support is big for us here. 回答4: SSIS support. Blows DTS away and is quite handy. :) 回答5: SSRS - A really huge

Date object last modified

元气小坏坏 提交于 2019-12-07 01:32:46
问题 How can I find out the date a MS SQL Server 2000 object was last modified? I need to get a list of all the views, procs, functions etc that were modified since Aug 15th. In sysObjects I can see the date objects were created but I need to know when they were last altered. NB: this is an SQL 2000 database. 回答1: Note that SQL Server actually does not record the last modification date. It does not exist in any system tables. The Schema Changes History report is actually constructed from the

How do I script SQL constraint for a number to fall within a range?

六眼飞鱼酱① 提交于 2019-12-07 00:19:32
问题 Using SQL Server, how do I script a constraint on a field in a table, so that the acceptable range of values is between 0 and 100? 回答1: ALTER TABLE Table ADD CONSTRAINT CK_Table_Column_Range CHECK ( Column >= 0 AND Column <= 100 --Inclusive ) 回答2: A check constraint like "fieldname BETWEEN 0 AND 100" should do it. 回答3: Try: ALTER TABLE myTableName ADD CONSTRAINT myTableName_myColumnName_valZeroToOneHundred CHECK (myColumnName BETWEEN 0 AND 100) This check would be inclusive - here is some

How to convert a varchar column to bit column in SQL SERVER

谁都会走 提交于 2019-12-06 23:15:45
问题 Flag1 is a varchar column with values "true" and "false". I need to convert this into bit column. When I try to do this: Convert(Bit,Flag1) it shows an error Msg 245, Level 16, State 1, Line 2 Syntax error converting the varchar value 'False' to a column of data type bit. 回答1: I suspect that there are other values in addition to 'true' and 'false' in the field 'Flag1'. So check for the values in Flag1. select distinct Flag1 from YouTable. Here is my proof: declare @Flag varchar(25) = 'False'

Check if record exists, if yes “update” if not “insert”

那年仲夏 提交于 2019-12-06 17:02:23
问题 I want to check table PREMIUM_SERVICE_USER if any records exists for strClientID update timeValid for +30 if no records for strClientID insert to premium_service_user table. What am I doing wrong? It increases timeValid for +30 days but inserts another row too. SELECT @pre_var = count(*) FROM PREMIUM_SERVICE_USER WHERE strClientID = @strClientID /* bronze premium - 200 cash */ IF @Premium = 1 BEGIN INSERT INTO PREMIUM_SERVICE_USER (strClientID, timeReg, timeValid, bCurrent, durum) VALUES (

How do I limit a LEFT JOIN to the 1st result in SQL Server?

六月ゝ 毕业季﹏ 提交于 2019-12-06 16:50:56
问题 I have a bit of SQL that is almost doing what I want it to do. I'm working with three tables, a Users, UserPhoneNumbers and UserPhoneNumberTypes. I'm trying to get a list of users with their phone numbers for an export. The database itself is old and has some integrity issues. My issue is that there should only ever be 1 type of each phone number in the database but thats not the case. When I run this I get multi-line results for each person if they contain, for example, two "Home" numbers.

Speed up sql JOIN

北慕城南 提交于 2019-12-06 14:17:06
First of all, some background. We have an order processing system, where staff enter billing data about orders in an app that stores it in a sql server 2000 database. This database isn't the real billing system: it's just a holding location so that the records can be run into a mainframe system via a nightly batch process. This batch process is a canned third party package provided by an outside vendor. Part of what it's supposed to do is provide a report for any records that were rejected. The reject report is worked manually. Unfortunately, it turns out the third party software doesn't catch