Skip to content

Instantly share code, notes, and snippets.

@PRElias
Created July 19, 2018 22:31
Show Gist options
  • Save PRElias/5d4ebe6aefffb340fcbf2de380c10ec3 to your computer and use it in GitHub Desktop.
Save PRElias/5d4ebe6aefffb340fcbf2de380c10ec3 to your computer and use it in GitHub Desktop.
Backup não testado de um script para criar um linked server e ler planilhas no SQL Server
/****** Object: LinkedServer [EXCEL] Script Date: 09/06/2013 10:02:20 ******/
EXEC master.dbo.sp_addlinkedserver @server = N'EXCEL', @srvproduct=N'Excel files', @provider=N'ADsDSOObject', @datasrc=N'c:\temp\importacoes.xls', @provstr=N'Excel 8.0'
/* For security reasons the linked server remote logins password is changed with ######## */
EXEC master.dbo.sp_addlinkedsrvlogin @rmtsrvname=N'EXCEL',@useself=N'False',@locallogin=NULL,@rmtuser=NULL,@rmtpassword=NULL
GO
EXEC master.dbo.sp_serveroption @server=N'EXCEL', @optname=N'collation compatible', @optvalue=N'false'
GO
EXEC master.dbo.sp_serveroption @server=N'EXCEL', @optname=N'data access', @optvalue=N'true'
GO
EXEC master.dbo.sp_serveroption @server=N'EXCEL', @optname=N'dist', @optvalue=N'false'
GO
EXEC master.dbo.sp_serveroption @server=N'EXCEL', @optname=N'pub', @optvalue=N'false'
GO
EXEC master.dbo.sp_serveroption @server=N'EXCEL', @optname=N'rpc', @optvalue=N'false'
GO
EXEC master.dbo.sp_serveroption @server=N'EXCEL', @optname=N'rpc out', @optvalue=N'false'
GO
EXEC master.dbo.sp_serveroption @server=N'EXCEL', @optname=N'sub', @optvalue=N'false'
GO
EXEC master.dbo.sp_serveroption @server=N'EXCEL', @optname=N'connect timeout', @optvalue=N'0'
GO
EXEC master.dbo.sp_serveroption @server=N'EXCEL', @optname=N'collation name', @optvalue=null
GO
EXEC master.dbo.sp_serveroption @server=N'EXCEL', @optname=N'lazy schema validation', @optvalue=N'false'
GO
EXEC master.dbo.sp_serveroption @server=N'EXCEL', @optname=N'query timeout', @optvalue=N'0'
GO
EXEC master.dbo.sp_serveroption @server=N'EXCEL', @optname=N'use remote collation', @optvalue=N'true'
GO
EXEC master.dbo.sp_serveroption @server=N'EXCEL', @optname=N'remote proc transaction promotion', @optvalue=N'true'
GO
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment