2014-09-26 2 views

ответ

1

Это должно сделать:

declare @syn nvarchar(30) 
declare @temp1 nvarchar(30) 
declare read_cur cursor for select distinct name from sys.synonyms where is_ms_shipped = 0 

open read_cur 
fetch read_cur into @syn 
while @@fetch_status = 0 
begin 
     --select read_cur into @temp1 
     set @temp1='drop synonym '[email protected] 
     exec sp_executesql @temp1 

     fetch read_cur into @syn 
end 
close read_cur 
deallocate read_cur 
+0

Да, это работает для меня, но быть уверен, что я удалить только синонимы из требуемой схемы I модифицированного кода для: «падение синоним my_schema» набор @ TEMP1 = + @syn Потому что я не хочу отказаться от синонимов из другой схемы, просто my_schema. Большое спасибо! – codelikeprogrammerwoman