Click here to Skip to main content
15,897,151 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
In sql server 2005 using store procedure with string query

My problem is that I have to run string query and store its answer to other int or string variable and put condition on it

e.g.

DECLARE @P_GetTableQuery VARCHAR(500)

SET @P_GetTableQuery =  ('SELECT COUNT(*)  FROM  '+  @P_tableName + '	WHERE ee_nEmployee = ' + @P_ee_nEmployee)


if @P_GetTableQuery =0 
begin
  do this
end
else
begin
 do this
end


How to do this? Need help.
Posted
Updated 7-May-10 20:59pm
v4

 
Share this answer
 
You've already got your "pseudo code" in place. Go to msdn or any other site (or consult a book), have a look at the syntax and you can get your solution up and running very quick.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900