Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

using IN clause in stored procedures

Status
Not open for further replies.

bsh17

MIS
Jan 12, 2005
1
0
0
US
I have a question regarding if and how this can be done in a stored procedure.

the sql statement uses an IN statement, from a string that I am building in the proc.

I basically use a string like to build a variable @sc - which equals 'H','X','T'


select @sc = @sc + ",'" + @ssss + "'"


and then the where statement looks like this:

d.sc in (@sc)

so this comes back empty.

when I do this below, it comes back with Data. How can I get the IN statement to work in a Stored proc.

d.sc = @sc1 or d.sc = @sc2 - sc1 = 'H', sc2 = 'X'.

bsh
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top