请问,我想定义一个自定义函数,向函数中传入一个变量,该变量将用一个字段的名称赋值。这样可以吗?
好比这样:create function abc( @a nchar(20),@b nchar(20) )
return table
begin
select @a,@b from table
end如果想向函数中传入字段名称,还有其他方法吗?thanks a lot.
好比这样:create function abc( @a nchar(20),@b nchar(20) )
return table
begin
select @a,@b from table
end如果想向函数中传入字段名称,还有其他方法吗?thanks a lot.
as
begin
exec('select '+@a+','+@b+' from table')
end
用楼上的存储过程吧