Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Issue with IN

Author  Topic 

atlachar123456
Starting Member

33 Posts

Posted - 2011-11-17 : 13:29:32
Hi,
Actually here i think no need to write a parsing string
IF(@supervisorId IS NOT NULL) AND (@supervisorId <> 0)
BEGIN
DELETE FROM #Rpt22036WorkTable
WHERE ISNULL(supervisorId,0) <> @supervisorId
END

from the above code i am handling with ALL and deleting single selected id instead of this i want to delete multiple ids for this

can i use this statement as
WHERE ISNULL(supervisorId,0) IN (@supervisorId)
instead of <> can i use IN ?



atlaaaaaaaa

X002548
Not Just a Number

15586 Posts

Posted - 2011-11-17 : 14:03:59
you better start making backups now..but hey it's only a temp table

Can you post something would sound like a business requirement?

This is just flat out wrong

WHERE ISNULL(supervisorId,0) <> @supervisorId


And yes, you need a user defined function

What does the sting look like?


CREATE FUNCTION [dbo].[udf_Table](@ParmList varchar(8000), @Delim varchar(20))
RETURNS @table TABLE
(Parameter varchar(255))

AS

/*
SELECT * FROM dbo.udf_Table( 'a|~|b|~|c', '|~|')
*/

BEGIN
DECLARE @x int, @Parameter varchar(255)

WHILE CHARINDEX(@Delim, @ParmList)-1 > 0
BEGIN
INSERT INTO @table(Parameter)
SELECT SUBSTRING(@ParmList,1,CHARINDEX(@Delim, @ParmList)-1)


SELECT @ParmList = SUBSTRING(@ParmList,CHARINDEX(@Delim, @ParmList)+LEN(@Delim), LEN(@ParmList)-CHARINDEX(@Delim,@ParmList))
END
INSERT INTO @table(Parameter) SELECT @ParmList
RETURN
END
GO



Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx


Want to help yourself?

http://msdn.microsoft.com/en-us/library/ms130214.aspx

http://weblogs.sqlteam.com/brettk/

http://brettkaiser.blogspot.com/


Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2011-11-17 : 14:18:35
a cross post

http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=168045

Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx


Want to help yourself?

http://msdn.microsoft.com/en-us/library/ms130214.aspx

http://weblogs.sqlteam.com/brettk/

http://brettkaiser.blogspot.com/


Go to Top of Page
   

- Advertisement -