SQLCMD –Copy files from Source to Dest- Using Robocopy



SQLCMD –Copy files from Source to Dest- Using Robocopy:SETVAR DATABASE UAT:SETVAR SOURCE HQDBSU01:SETVAR DESTINATION HQDBSU02:SETVAR SOURCEPATH G:\MSSQL:SETVAR COPYPATH G$\MSSQLSET NOCOUNT ONGO:CONNECT $(SOURCE)print 'Files in sourcePath'!!dir $(SourcePath)\*.*Goprint 'Files in Destination Path':CONNECT $(DESTINATION)!!dir $(SOURCEPATH)\*.*Go:CONNECT $(SOURCE)print '*** Copy database $(DATABASE) from Source server $(Source) to Destination server $(destination) ***'!!ROBOCOPY $(SOURCEPATH)\ \\$(DESTINATION)\$(COPYPATH) $(DATABASE)*.*GOprint 'Files in Destination Path':CONNECT $(DESTINATION)!!dir $(SOURCEPATH)\*.*Go:CONNECT $(SOURCE)print 'Files in Destination Path':CONNECT $(DESTINATION)!!dir $(SOURCEPATH)\*.* ................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download