SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Issue with IN
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

atlachar123456
Starting Member

USA
33 Posts

Posted - 11/17/2011 :  13:29:32  Show Profile  Reply with Quote
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 - 11/17/2011 :  14:03:59  Show Profile  Reply with Quote
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 - 11/17/2011 :  14:18:35  Show Profile  Reply with Quote
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
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.16 seconds. Powered By: Snitz Forums 2000