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即可
函数则不成