-- Aggiungi il linked server CONSUNI
EXEC master.dbo.sp_addlinkedserver 
    @server = N'CONSUNI', 
    @srvproduct = N'SQL Server'

-- Configura l'autenticazione per il linked server
EXEC master.dbo.sp_addlinkedsrvlogin 
    @rmtsrvname = N'CONSUNI',
    @useself = N'False',
    @locallogin = NULL,
    @rmtuser = N'F701264',
    @rmtpassword = N'contrsei'
GO

-- Configura le opzioni RPC e Data Access
EXEC master.dbo.sp_serveroption 
    @server = N'CONSUNI', 
    @optname = N'rpc', 
    @optvalue = N'true'
GO

EXEC master.dbo.sp_serveroption 
    @server = N'CONSUNI', 
    @optname = N'rpc out', 
    @optvalue = N'true'
GO

EXEC master.dbo.sp_serveroption 
    @server = N'CONSUNI', 
    @optname = N'data access', 
    @optvalue = N'true'
GO
