首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > SQL Server >

FUNCTION 返回TABLE有关问题

2012-01-09 
FUNCTION返回TABLE问题CREATEFUNCTIONExecSQL(@strSQLNVARCHAR(5000))RETURNSTABLEASRETURN(@strSQL)GO我

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

热点排行