日期:2014-05-18 浏览次数:20423 次
create procedure book_history @bname char(30)='SQL%' as with cte_book as (select * from book08 where bname like @bname) select cte_book.bname,history08.*,reader08.name from cte_book left outer join history08 join reader08 on reader08.lno = history08.lno on cte_book.ISBN = history08.ISBN go execute book_history
--直接拼串就可以实现你的功能 create procedure book_history @bname char(30) /*模糊查询的关键字*/ as declare @sql nvarchar(1024) set @sql = '一段SQL语句'+‘%' + convert(nvarchar(50),@bname) + '%'' exec(@sql) go
------解决方案--------------------
支持的,建议你把数据表发上来,数据发上来 大家帮你看看
------解决方案--------------------
char(30)=
改为 varchar(30) 看看