我写了个存储过程:
create procedure Pr_GetSearchPreBooks
(@BClassName varchar(50),
@sSearchKey varchar(50),
@sSearchValue varchar(50)
)
as begin
exec
('
select * from PreBorBook where BClassName='+@BClassName+'
and '+@sSearchKey+' like ''%'+@sSearchValue+'%''
')
end
为什么运行时出错说我表中对应的BClassName列名无效
create procedure Pr_GetSearchPreBooks
(@BClassName varchar(50),
@sSearchKey varchar(50),
@sSearchValue varchar(50)
)
as begin
exec
('
select * from PreBorBook where BClassName='+@BClassName+'
and '+@sSearchKey+' like ''%'+@sSearchValue+'%''
')
end
为什么运行时出错说我表中对应的BClassName列名无效
解决方案 »
- 有没有这样的SQL指令?数据库直接的转换sql-access
- 用游标更新记录,3个字段id,date,dateid,id是顺序的,date是没有顺序的日期,要更新dateid(按date分组按id排序+0000的流水号)
- excel公式问题?
- 一个关于FOXPRO和SQLSERVER数据库表相互导入的问题
- 请教将A表两字段联合B表联合查询的问题
- powerDesigner里面的实例
- 请教关于索引的问题!
- 我想知道SQL Server Management Studio这个软件有什么作用
- 記錄篩選問題
- 自定义函数如何返回两个值
- 一个简单的问题。 呵呵 太菜 不要用板砖拍我
- 如何给分区表建立索引?各路大侠进来支支招
('
select * from PreBorBook where BClassName='''+@BClassName+'''
and '+@sSearchKey+' like ''%'+@sSearchValue+'%''
')
end
('
select * from PreBorBook where BClassName='''+@BClassName+'''
and '+@sSearchKey+' like ''%'+@sSearchValue+'%''
')
--------------------
PreBorBook里面有这个栏位BClassName么?
(@BClassName varchar(50),
@sSearchKey varchar(50),
@sSearchValue varchar(50)
)
as begin
exec
('
select * from PreBorBook where BClassName='''+@BClassName+'''
and '+@sSearchKey+' like ''%'+@sSearchValue+'%''
')
end