Jump to content

Recommended Posts

Posted
Bhaiyyalu please help on this .I have a powershell script commands below for database deployment.Is it possible to come up with a PS function script where I can define -serverinstance and -database as variables.The reason is I need to define these variables at run time using a tool.
 
 
Add-PSSnapin SqlServerCmdletSnapin100
Add-PSSnapin SqlServerProviderSnapin100 
invoke-sqlcmd -inputfile "C:\nix_SQL\hxsdb.sql" -serverinstance "dsmdb5" -database "test1854" 
invoke-sqlcmd -inputfile "C:\nix_SQL\hxmsp.sql" -serverinstance "dsmdb5" -database "test1854" 
invoke-sqlcmd -inputfile "C:\nix_SQL\hxcsp.sql" -serverinstance "dsmdb5" -database "test1854" 
invoke-sqlcmd -inputfile "C:\nix_SQL\atsdb.sql" -serverinstance "dsmdb5" -database "tes1t854x" 
invoke-sqlcmd -inputfile "C:\nix_SQL\assp.sql" -serverinstance "dsmdb5" -database "test1854x"
×
×
  • Create New...