Oct 20, 2007 #1 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 ?
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 ?
Oct 20, 2007 #2 mrdenny Programmer May 27, 2002 11,595 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 Upvote 0 Downvote
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
Oct 21, 2007 Thread starter #3 aomara MIS Nov 18, 2002 48 LY 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 Upvote 0 Downvote
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