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

Pass through query with input parameters

Status
Not open for further replies.

ChopinFan

Technical User
Oct 4, 2004
149
US
How do I get a pass through query to accept input parameters? I have no problem using the syntax below in regular SQL queries and it prompts the user for the information, but it isn't liking this in a pass through for some reason.

--Input Parameters
@Value1 varchar(500),
@Value2 varchar(2)

AS
set nocount on

Declare @SQL varchar(500)

Set @SQL = '
SELECT Table.Field1
FROM Table
WHERE ((Table.Field2) in (' +@Value1+ ')) and ((Table.Field3) in ('+@Value2+'))'

Exec (@SQL)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top