日期:2014-05-18  浏览次数:20520 次

FUNCTION 返回TABLE问题
CREATE   FUNCTION   ExecSQL(@strSQL   NVARCHAR(5000))
RETURNS   TABLE
AS
RETURN  
(
      @strSQL  
);
GO

我想通过外边传SQL,返回Table


------解决方案--------------------
no way
------解决方案--------------------
函數裡面不可以 exec(@strSql)
------解决方案--------------------
if object_id( 'Ptest1 ', 'p ') is not null
drop proc ptest1
create proc ptest1
@sid int,@str int
as
if object_id( 'test1 ') is not null
drop table test1
create table test1(
id int,
mon int
)
insert into test1 values(@sid,@str)

exec ptest1 1,2

select * from test1

id mon
----------- -----------
1 2

------解决方案--------------------
存储过程如LS即可
函数则不成