create proc sp_ST_product_getlist1
@city nvarchar(10), --城市
@text nvarchar(50) --输入条件
as
declare @sql nvarchar(500),@where nvarchar(500),@order nvarchar(500)
select @sql='select website, loc, productId, city, category, title, img, startTime, oldprice, endTime, price, rebate, sort, ischeck from ST_product',
@where='',@order=' sort asc'
if @city <> ''
if @where <> ''
set @where = @where+' and (city='+@city+')'
else
set @where = @where+' (city='+@city+')'
if @text <>''
if @where <> ''
set @where = @where+' and ((title like ''%'+@text+'%'') or (website like ''%'+@text+'%''))'
else
set @where = @where+' ((title like ''%'+@text+'%'') or (website like ''%'+@text+'%''))'
if @where <> ''
set @where =' where'+@where
if @order <> ''
set @order =' order by'+@order
exec(@sql+@where+@order)goexec sp_ST_product_getlist1
'全国','蝶恋' 为什么会提示 列名 '全国' 无效。
@city nvarchar(10), --城市
@text nvarchar(50) --输入条件
as
declare @sql nvarchar(500),@where nvarchar(500),@order nvarchar(500)
select @sql='select website, loc, productId, city, category, title, img, startTime, oldprice, endTime, price, rebate, sort, ischeck from ST_product',
@where='',@order=' sort asc'
if @city <> ''
if @where <> ''
set @where = @where+' and (city='+@city+')'
else
set @where = @where+' (city='+@city+')'
if @text <>''
if @where <> ''
set @where = @where+' and ((title like ''%'+@text+'%'') or (website like ''%'+@text+'%''))'
else
set @where = @where+' ((title like ''%'+@text+'%'') or (website like ''%'+@text+'%''))'
if @where <> ''
set @where =' where'+@where
if @order <> ''
set @order =' order by'+@order
exec(@sql+@where+@order)goexec sp_ST_product_getlist1
'全国','蝶恋' 为什么会提示 列名 '全国' 无效。
解决方案 »
- 服务器 'XXXXX' 上的 MSDTC 不可用
- 从数据库提取text的一部分?
- 字符转换问题
- 每次人多,读数据库次数增多的时候,sql数据库就占用cpu100%,有什么办法当某个连接读取数据库占用cpu达到50的时候就把该连接断掉吗??
- 前天参加面试时考了这样一道数据库题目,请帮我看一下,该怎样做呢?
- 如何取得本机SQL SERVER已安装实例名称,,,我只要本机的,不要局域网内的
- 关于SQL 2000的图片存放
- 各位高手能不能对存储过程的的如何学更能提高程序的效率 及更规范 给点建议啊!!1
- 如何使用更简单的方法进行网简通信
- 怎么把select count(*) from table的返回值赋给一变量
- Response.Write("<script defer>confirm('你确定吗?')</script>")
- 对表数据复制,如何查看相关日志
alter proc sp_ST_product_getlist1
@city nvarchar(10), --城市
@text nvarchar(50) --输入条件
as
declare @sql nvarchar(500),@where nvarchar(500),@order nvarchar(500)
select @sql='select website, loc, productId, city, category, title, img, startTime, oldprice, endTime, price, rebate, sort, ischeck from ST_product',
@where='',@order=' sort asc'
if @city <> ''
if @where <> ''
set @where = @where+' and (city='''+@city+''')' --两边少了单引号
else
set @where = @where+' (city='''+@city+''')' --两边少了单引号
if @text <>''
if @where <> ''
set @where = @where+' and ((title like ''%'+@text+'%'') or (website like ''%'+@text+'%''))'
else
set @where = @where+' ((title like ''%'+@text+'%'') or (website like ''%'+@text+'%''))'
if @where <> ''
set @where =' where'+@where
if @order <> ''
set @order =' order by'+@order
exec(@sql+@where+@order)