sql-server-2000

Passing delimited string to stored procedure to search database

泄露秘密 提交于 2019-12-01 01:06:17
How can i pass a string delimited by space or comma to stored procedure and filter result? I'm trying to do something like - Parameter Value -------------------------- @keywords key1 key2 key3 Then is stored procedure i want to first find all records with first or last name like key1 filter step 1 with first or last name like key2 filter step 2 with first or last name like key 3 Another example: col1 | col2 | col3 ------------------------------------------------------------------------ hello xyz | abc is my last name | and i'm a developer hello xyz | null | and i'm a developer If i search for

SQL Running Subtraction

喜欢而已 提交于 2019-12-01 00:40:44
I have a result set as below: Item ExpectedQty ReceivedQty Short Item01 30 45 5 Item01 20 45 5 Item02 40 38 2 item03 50 90 10 item03 30 90 10 item03 20 90 10 query is: select a.Item, a.ExpectedQty,b.ReceivedQty, b.Short from a join b on a.Item = b.Item I need to get result as in second chart. Basically I have a total of received quantity in each line and I need to show received quantity against Expected Quantity, if there is any shortage I need to show in last line. Expected: Item ExpectedQty ReceivedQty Short item01 30 30 0 item01 20 15 5 item02 40 38 2 item03 50 50 0 item03 30 30 0 item03 20

classic ASP protection against SQL injection

浪子不回头ぞ 提交于 2019-11-30 23:55:53
I've inherited a large amount of Classic ASP code that is currently missing SQL injection protection, and I'm working on it. I've examined in detail the solutions offered here: Classic ASP SQL Injection Protection On the database side, I have a Microsoft SQL server 2000 SP4 Unfortunately stored procedures are not an option. After studying php's mysql_real_escape_string ( http://www.w3schools.com/php/func_mysql_real_escape_string.asp ) , I've replicated its functionality in ASP. My question(s) are: 1) Does Microsoft SQL server 2000 have any other special characters that need to be escaped that

Have you ever had SQL Server 2008 return a different result set than SQL Server 2000?

可紊 提交于 2019-11-30 23:43:23
I am not looking for help with the actual code of my stored procedure (yet anyway), but a client sent me a copy of his SQL Server 2000 database stating that a particular proc was returning incorrect results; I restored the database to my server (SQL Server 2008R2) and ran the proc and it produced the correct results. Keep in mind there is no front-end that could be causing the difference - in both the cases I simply execute the proc thru enterprise manager and management studio. I am wondering if there are any known differences that might contribute/cause this problem? This particular proc

SQL Server How to output one table result from multiple results with a WHILE query

元气小坏坏 提交于 2019-11-30 23:19:02
From this answer: Is there a way to loop through a table variable in TSQL without using a cursor? I'm using the method WHILE EXISTS(SELECT * FROM #Temp) The problem is that it's outputting multiple tables, if possible I'd like to output as a single table. Declare @Id int WHILE EXISTS(SELECT * FROM #Temp) Begin Select Top 1 @Id = Id From #Temp --Do some processing here Delete #Temp Where Id = @Id End So right now it outputs this: x y -- -- 1 a x y -- -- 1 b But I'd like it to output this: x y -- -- 1 a 2 b What I'm trying to achieve , I have this in a field: 1234,1432,1235 I have a process that

MSSQL: Update statement avoiding the CHECK constraint

烈酒焚心 提交于 2019-11-30 22:47:39
Working in MS2000, I have a table called JobOwners that maps Jobs (JPSID) to the Employees that own them (EmpID). It also contains the date they started owning that job (DateStarted), date they stopped owning that job (DateEnded) and if the ownership is active (IsActive). Looks like this. CREATE TABLE JobOwners ( LogID int NOT NULL IDENTITY(1,1) PRIMARY KEY, JPSID int NOT NULL FOREIGN KEY REFERENCES JobsPerShift(JPSID), EmpID int NOT NULL FOREIGN KEY REFERENCES Employees(EmpID), DateStarted datetime, DateEnded datetime, IsActive tinyint NOT NULL ) There should be no duplicates of JPSID that

SQL Running Subtraction

做~自己de王妃 提交于 2019-11-30 19:24:14
问题 I have a result set as below: Item ExpectedQty ReceivedQty Short Item01 30 45 5 Item01 20 45 5 Item02 40 38 2 item03 50 90 10 item03 30 90 10 item03 20 90 10 query is: select a.Item, a.ExpectedQty,b.ReceivedQty, b.Short from a join b on a.Item = b.Item I need to get result as in second chart. Basically I have a total of received quantity in each line and I need to show received quantity against Expected Quantity, if there is any shortage I need to show in last line. Expected: Item ExpectedQty

Entity Framework 6 supports SQL Server 2000?

五迷三道 提交于 2019-11-30 18:59:41
Anybody knows if SQL Server 2000 is supported in EF 6 for Code First? In the official websites I haven't found anything about which SQL Server versions are supported in EF 6. In some blogs I've found that SQL Server 2000 is not supported, but these blogs aren't from official sources. Looking at the source code of EF 6 it seems that is supported I've found some code with SQL Server 2000 considerations. For example: SqlVersion is a class with an enum of SQL Server versions, SQL Server 2000 is in this enum. https://entityframework.codeplex.com/SourceControl/latest#src/EntityFramework.SqlServer

How can I find sql server port number from windows registry?

坚强是说给别人听的谎言 提交于 2019-11-30 18:52:05
How can I find sql server port number from windows? Is there any generic way to find port number for sql server 2000, 2005 and 2008? Martin SQL Server 2000 Default instance HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSSQLServer\MSSQLServer\SuperSocketNetLib\TCP Named instance HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\(InstanceName)\MSSQLServer\SuperSocketNetLib\TCP SQL Server 2005 There is no distinction between default and named instances. An instance is assigned a number based on the order it was installed. We first need to locate the registry key for the instance, which looks

There is already an object named '##Temp' in the database

丶灬走出姿态 提交于 2019-11-30 17:37:07
I have a stored procedure on SQL Server 2000. It contains: select ... into ##Temp ... ... drop table ##Temp When I run the stored procedure with ADO a second time, it prompts: There is already an object named '##Temp' in the database. Could anyone kindly tell me what's wrong? You should re-write your stored proc to drop the temp table if it exists, then you won't ever have this issue IF (SELECT object_id('TempDB..##Temp')) IS NOT NULL BEGIN DROP TABLE ##Temp END Since you chose to use a global temporary table ##Temp , it is visible to all SQL connections at any given time. Obviously, while the