求一个存储过程的写法!在线等,有关查询的
下面两个参数一个是用户的 ID ,@as_syntax是在前台封装好了的查询条件直接当参数传过来.
请叫各位该怎么写呢
ALTER PROCEDURE "ass ". "proc_query_asset_purchase "( in @USERID varchar(20), @as_syntax varchar(4000)
)
AS
select * from UserList where UserID=@USERID ....
------解决方案--------------------alter proc proc_query_asset_purchase
( in @USERID varchar(20),
@as_syntax varchar(4000)
)
AS
exec( 'select * from UserList where UserID= '+@USERID+ ' and '+@aas_syntax)