在存储过程中动态的调用数据库名
CREATE PROCEDURE P_Test @DBName varchar(20), @ID int AS BEGIN EXEC( 'SELECT * FROM '+@DBName+ '.dbo.表名 where ID=@ID') END
CREATE PROCEDURE P_Test @DBName varchar(20), @ID int AS BEGIN EXEC( 'SELECT * FROM '+@DBName+ '.dbo.表名 where ID=@ID') END