运行字符串查询并将其答案存储在其他变量中,并在其上应用条件 [英] Run string query and store its answer to other variable and apply condition on it

查看:81
本文介绍了运行字符串查询并将其答案存储在其他变量中,并在其上应用条件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在sql server 2005中,使用带有字符串查询的存储过程

我的问题是我必须运行字符串查询并将其答案存储在其他int或字符串变量中,并在其上加上条件

例如

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.

推荐答案

http://msdn.microsoft.com/en-us/library/aa214299%28v=SQL.80%29.aspx[^]

Explore it...

You will get your answer.


您已经准备好了伪代码".转到msdn或任何其他站点(或查阅书籍),查看语法,即可快速启动并运行解决方案.
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.


这篇关于运行字符串查询并将其答案存储在其他变量中,并在其上应用条件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆