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 Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

stored procedure parameter in the IN clause

Status
Not open for further replies.

MatthewS

MIS
Jan 17, 2001
1
US
This is in SQL2000 ex.

create procedure ... @Name varchar(254), @Date smalldatetime

Select.......
Where (db.Name IN (@Name)) AND
(db.Date = @Date)

@Name = ('George', 'Mike')
SQL does not return any data to my query
if I remove @name and hard code ('George',.... then it works just fine. I have been trying for a while to figure this out. If anyone has any suggestions I would appreciate it.

Thanks in advance
MatthewS
 
Either use a sub-query as in:

Where (db.Name IN (SELECT Name from table where Name = @Name)) AND (db.Date = @Date)


or set it = to a single value as in:
Where (db.Name = @Name) AND
(db.Date = @Date) Tom Davis
tdavis@sark.com
 
Either use a sub-query as in:

Where (db.Name IN (SELECT Name from table where Name = @Name)) AND (db.Date = @Date)

set it = to a single value as in:

Where (db.Name = @Name) Tom Davis
tdavis@sark.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top