Comments
2 comments
-
I should explain I get the error :
Error: Error occurred connecting to database: Cannot open database "xxxx" requested by the login. The login failed. Login failed for user 'xxxx' -
You should be able to get around this by enclosing the DB name with spaces in double quotes:
sqlcompare /db1:Adventureworks /db2:"Some Spaces"
The issue occurs because spaces separate the switches so without the quotes the database name is interpreted as just the part up to the first space and you get the error.
Add comment
Please sign in to leave a comment.
Basic version of the script follows :
Works
CD\
SET FDate=%Date:~-10,10%
SET Fdate=%FDate:/=-%
MD C:\Snapshots\SERVERNAME
MD C:\Snapshots\SERVERNAME\%FDate%
DEL C:\Snapshots\SERVERNAME\%FDate%\*.* /Q
SQLCompare /Server1:SERVERNAME /Database1:DBNameWithoutSpaces /MakeSnapshot:"C:\Snapshots\SERVERNAME\%FDate%\FileNameHere.snp"
Fails
CD\
SET FDate=%Date:~-10,10%
SET Fdate=%FDate:/=-%
MD C:\Snapshots\SERVERNAME
MD C:\Snapshots\SERVERNAME\%FDate%
DEL C:\Snapshots\SERVERNAME\%FDate%\*.* /Q
SQLCompare /Server1:SERVERNAME /Database1:DB Name With Spaces /MakeSnapshot:"C:\Snapshots\SERVERNAME\%FDate%\FileNameHere.snp"
Running 8.50.12.20 Pro Edition
Any ideas anyone ?
Thanks
Ryan