sql存储过程中执行sql语句
2009-05-22 10:18
232 查看
今天写sql语句快写晕了,后来网上查到了资料自己又整理下,最终的代码备份一下
create proc [dbo].[search_ProductTakeStockView_byCP]
@code varchar(50),@producctName varchar(50)
as
declare @s varchar(100)
set @s='select * from ProductTakeStockView where 1=1'
if @code<>''
set @s = @s +' and code='''+@code+''''
if @producctName<>''
set @s= @s + ' and productName='''+@producctName+''''
exec(@s)
create proc [dbo].[search_ProductTakeStockView_byCP]
@code varchar(50),@producctName varchar(50)
as
declare @s varchar(100)
set @s='select * from ProductTakeStockView where 1=1'
if @code<>''
set @s = @s +' and code='''+@code+''''
if @producctName<>''
set @s= @s + ' and productName='''+@producctName+''''
exec(@s)
相关文章推荐
- 在SQL SERVER中定时执行SQL语句,或者存储过程
- 生成SQL语句字符串,通过存储过程执行
- 存储过程中执行动态Sql语句
- 存储过程中执行动态Sql语句
- 存储过程————执行拼接的SQL语句的字符串
- Asp.Net访问Oracle 数据库执行SQL语句和调用存储过程
- 存储过程中执行动态Sql语句
- MYSQL存储过程执行用字符串拼成的sql语句
- oracle 解除 sql语句、存储过程在执行中造成的锁
- MySQL 存储过程中执行动态 SQL 语句
- SQL SERVER 统计SQL语句或存储过程执行时间
- 在SQL SERVER中定时执行SQL语句,或者存储过程.
- MSSQL存储过程中执行动态Sql语句
- mysql存储过程执行动态sql语句
- 一个存储过程:带参数动态执行sql语句:Execute Immediate
- 存储过程里面执行SQL语句
- Ruby on Rails中执行存储过程和指定SQL语句的方法
- oracle 解除 sql语句、存储过程在执行中造成的锁
- 存储过程中执行动态Sql语句
- 执行字符串SQL语句--带有参数的存储过程以及 int类型的字符串变量注意事项