有什么方法可以将数据库名称传递给 tsql 函数,以便它可以在该数据库上执行选择
ALTER function [dbo].[getemailjcp]
(
@DB_Name varchar(100)
)
Returns varchar(4000)
AS
BEGIN
DECLARE @out varchar (4000);
DECLARE @in varchar (1000);
Set @out =
(select substring
((select ';' + e.email from
(SELECT DISTINCT ISNULL(U.nvarchar4, 'NA') as email
FROM [@DB_Name].dbo.Lists ...