Im using SQL Server Management Studio 2008 (ssms.exe) connected with a local SQL Server 2000, so I notice that every time I try enter on Linked Server option It crash inmediatly so I want to delete all the servers linkeds there for try again.
What script should I use or what command on T-SQL I have to run for delete all and without specifying the name of each server linked.
Thanks
You can execute sp_dropserver for all linked servers using the database cursor. The following example shows how to do this.  
    DECLARE @sql NVARCHAR(MAX)
    DECLARE db_cursor CURSOR FOR  
        select 'sp_dropserver ''' + [name] + '''' from sys.servers
    OPEN db_cursor   
    FETCH NEXT FROM db_cursor INTO @sql   
    WHILE @@FETCH_STATUS = 0   
    BEGIN   
           EXEC (@sql)
           FETCH NEXT FROM db_cursor INTO @sql   
    END   
    CLOSE db_cursor   
    DEALLOCATE db_cursor
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With