SQLTeam.com | Weblogs | Forums

Changing variable values when deploying scripts to prod


When auto deploying (via powershell) what would be the best option to specify passwords and specific server names based on environment vars or Maybe prompt the person deploying it?

EXEC master.dbo.sp_addlinkedserver @server = N'BISERVER', 
@srvproduct=N'', @provider=N'SQLNCLI', @datasrc='PLEASE_PROVIDE_BISERVER'

EXEC master.dbo.sp_addlinkedsrvlogin @rmtsrvname=N'BISERVER',@useself=N'False',

If you use powershell I would use named parameters in powershell:

How to Use Parameters in PowerShell Part I - Simple Talk (red-gate.com)

1 Like