Wednesday, March 11, 2020

Use mapped network drive in SQL Server

To use a mapped drive in SQL server make sure that the mapping is done using the xp_cmdshell procedure.

Before the extended procedure can be used it has to b enabled as shown below

EXEC sp_configure 'show advanced options', 1;
GO
RECONFIGURE;
GO

EXEC sp_configure 'xp_cmdshell',1
GO
RECONFIGURE
GO

thereafter map the drive so that SQL understands it

EXEC XP_CMDSHELL 'net use Z: \\192.168.100.36\nansql'