2017-04-25 35 views

回答

0
EXECUTE sp_MSForEachDB 
'USE ?; 
SELECT * from table where code=''tbhn'''; 

你也可以忽略系统的数据库,如下面

EXECUTE sp_MSForEachDB 
'if db_id()>4 
begin 
SELECT * from table where code=''tbhn'' 
end'; 
相关问题