Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Other Forums
 Other Topics
 DOS -Q

Author  Topic 

X002548
Not Just a Number

15586 Posts

Posted - 2010-07-28 : 15:03:14
Why am I getting a syntax error?


COPY \\PAERSCBVD0402\D$\BACKUP\PAERSCBVD0402\QA\databases\blddistm\blddistm_MIGRATE.BAK \\PAERSCBVD0403\D$\BACKUP\PAERSCBVD0402\QA\databases\blddistm\blddistm_MIGRATE.BAK -QUIET




Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

Add yourself!
http://www.frappr.com/sqlteam



tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-07-28 : 15:24:24
Because -Q isn't available for copy command. Run copy /? from a cmd window to check it out.

Use xcopy instead.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-07-28 : 15:24:48
By the way, it's actually not DOS anymore. MOO

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2010-07-28 : 17:02:44
you say potato, I say potato

What the hell is it then?

cmdshell?


Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

Add yourself!
http://www.frappr.com/sqlteam



Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2010-07-28 : 17:03:38
you couldn't just say /Y


Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

Add yourself!
http://www.frappr.com/sqlteam



Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-07-28 : 17:06:49
quote:
Originally posted by X002548

you say potato, I say potato

What the hell is it then?

cmdshell?




I've heard various ways to say it: cmd, command, cmdshell. The reason it's not DOS anymore is that DOS is an operating system. Windows hasn't needed DOS in a while.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-07-28 : 17:09:36
Whether or not you can use -Y is dependent upon your requirement. If you are trying to suppress the question prompt, then yes -Y.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2010-07-28 : 17:13:20
MOO indeed...

So why does this stop after the copy...this in a bat file


osql -i D:\backup\paerscbvd0402\dev\databases\blddistm\sql\BackupCopyRestore.sql -o D:\backup\paerscbvd0402\dev\databases\blddistm\bin\Migrate_paerscbvd0402_dev_blddistm.log -E -S PAERSCBVD0402\DEV
osql -i D:\backup\paerscbvd0402\dev\databases\blddistm\sql\MakeBKP.sql -o D:\backup\paerscbvd0402\dev\databases\blddistm\bin\MakeBKP.log -E -S PAERSCBVD0402\DEV
D:\backup\paerscbvd0402\dev\databases\blddistm\bin\CopyBKP.bat > D:\backup\paerscbvd0402\dev\databases\blddistm\bin\CopyBKP.log
osql -i D:\backup\paerscbvd0402\dev\databases\blddistm\sql\AlterDB.sql -o D:\backup\paerscbvd0402\dev\databases\blddistm\bin\AlterDB.log -E -S PAERSCBVD0403\DEV
osql -i D:\backup\paerscbvd0402\dev\databases\blddistm\sql\RestoreBKP.sql -o D:\backup\paerscbvd0402\dev\databases\blddistm\bin\RestoreBKP.log -E -S PAERSCBVD0403\DEV
osql -i D:\backup\paerscbvd0402\dev\databases\blddistm\sql\SetDB.sql -o D:\backup\paerscbvd0402\dev\databases\blddistm\bin\SetDB.log -E -S PAERSCBVD0403\DEV




Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

Add yourself!
http://www.frappr.com/sqlteam



Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2010-07-28 : 17:14:39
I think you got that backwards


COPY [/D] [/V] [/N] [/Y | /-Y] [/Z] [/A | /B ] source [/A | /B]
[+ source [/A | /B] [+ ...]] [destination [/A | /B]]

source Specifies the file or files to be copied.
/A Indicates an ASCII text file.
/B Indicates a binary file.
/D Allow the destination file to be created decrypted
destination Specifies the directory and/or filename for the new file(s).
/V Verifies that new files are written correctly.
/N Uses short filename, if available, when copying a file with a
non-8dot3 name.
/Y Suppresses prompting to confirm you want to overwrite an
existing destination file.
/-Y Causes prompting to confirm you want to overwrite an
existing destination file.
/Z Copies networked files in restartable mode.




Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

Add yourself!
http://www.frappr.com/sqlteam



Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2010-07-29 : 02:26:03
"So why does this stop after the copy"

osql ...
osql ...
CopyBKP.bat
osql ...
osql ...
osql ...

The BAT file will NOT return. You have to do

EXEC CopyBKP.bat

or somesuch (CMD CopyBKP.bat perhaps?) if you want it to return. And it may have to do its own ">" logging as the outer ">" may not apply.
Go to Top of Page

robvolk
Most Valuable Yak

15732 Posts

Posted - 2010-07-29 : 07:04:27
call CopyBKP.bat
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2010-07-30 : 06:17:22
That's it! Thanks Rob.
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2010-07-30 : 09:18:37
REALLY....

Thanks a bunch ladies and gents!!!

Beers are on me




Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

Add yourself!
http://www.frappr.com/sqlteam



Go to Top of Page
   

- Advertisement -