I have the following SQL statement that will return all items not in the
list.
It works fine as a simple sql statement but when I make a stored procedure 
with the query it doesn't return the expected results.
This list has been extremely helpful so I thought I might drop it here.
--------------------------------------

SELECT  usockId, usockCode, usockDesc, usockAmount
FROM   dbo.tbl_usocks
WHERE  usockDesc LIKE '%HANDSET%' 
AND usockCode NOT IN ('DCSB01','DCSB02')
ORDER BY usockCode, usockDesc

---------------------------------------

---------------------------------------

CREATE PROCEDURE dbo.DCS_handsets_selected
AS
DECLARE @usockList varchar(2000)

SELECT @usockList = usockCode
FROM tbl_dcs_handsets_selected
WHERE handsetid = 1

SELECT  usockId, usockCode, usockDesc, usockAmount
FROM   dbo.tbl_usocks
WHERE  usockDesc LIKE '%HANDSET%' 
AND usockCode  NOT IN ('@usockList')
ORDER BY usockCode, usockDesc

---------------------------------------

Thanks,
Dave




HTC Disclaimer:  The information contained in this message may be privileged and 
confidential and protected from disclosure. If the reader of this message is not the 
intended recipient, or an employee or agent responsible for delivering this message to 
the intended recipient, you are hereby notified that any dissemination, distribution 
or copying of this communication is strictly prohibited.  If you have received this 
communication in error, please notify us immediately by replying to the message and 
deleting it from your computer.  Thank you.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Purchase from House of Fusion, a Macromedia Authorized Affiliate and support the CF 
community.
http://affiliates.macromedia.com/t.asp?id=2439&p=go/dr_text_aff1

Message: http://www.houseoffusion.com/lists.cfm?link=i:6:1700
Archives: http://www.houseoffusion.com/lists.cfm?link=t:6
Subscription: http://www.houseoffusion.com/lists.cfm?link=s:6
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=<:emailid:>.<:userid:>.<:listid:>

                        

Reply via email to