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

Passing Parameter to EXISTS Function

Status
Not open for further replies.

aomara

MIS
Nov 18, 2002
48
LY
In my stored Procuder, I read the query written in a table to a parameter " @query ".

I would like to pass this parameter to EXISTS funcation (like this "EXISTS @query"), but EXISTS Function can't take parameters.

Does any body have any idea ?
 
To have the full query as a parameter you will need to use dynamic SQL.

It is recommended to not use dynamic SQL so it would be better if you could find a way to write the query without the full query as a parameter.

Denny
MCSA (2003) / MCDBA (SQL 2000)
MCTS (SQL 2005 / Microsoft Windows SharePoint Services 3.0: Configuration / Microsoft Office SharePoint Server 2007: Configuration)
MCITP Database Administrator (SQL 2005) / Database Developer (SQL 2005)

My Blog
 
Many Thanks mrdenny.

I develop this statement.

EXEC sp_executesql @p_condquery, N'@p_condresult INT OUTPUT', @p_condresult OUTPUT

IF @p_condresult>0
BEGIN
...
...
END
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top