Author |
Topic |
strauss_jon
Starting Member
23 Posts |
Posted - 2009-09-09 : 10:46:31
|
Hi there - anyone know how to append to a log file instead of the default overwrite? I've googled it but can’t find anything. I've tried sticking in a –a for append but it doesn’t like it.:out $(root)\log\bla.log:out –a $(root)\log\bla.logThanks in advance, Jon |
|
Bustaz Kool
Master Smack Fu Yak Hacker
1834 Posts |
Posted - 2009-09-09 : 18:33:32
|
Which log file are you referring to?=======================================Men build too many walls and not enough bridges. -Isaac Newton, philosopher and mathematician (1642-1727) |
|
|
strauss_jon
Starting Member
23 Posts |
Posted - 2009-09-10 : 04:29:19
|
Hi - any file. This is just a txt file for logging purposes. I can't find any documentation on the "out" command so I don't know if there's an append option or not. This has got to be pretty straightforward! (I don't suppose t-sql supports interactive help dos does it?)Cheers. |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2009-09-10 : 04:38:48
|
My question is:Which command or application do you use with ':out'? No, you're never too old to Yak'n'Roll if you're too young to die. |
|
|
strauss_jon
Starting Member
23 Posts |
Posted - 2009-09-10 : 04:40:09
|
Sorry, sqlcmd. |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2009-09-10 : 04:50:37
|
Syntax isn't ':out' it is '-o' and it is not a log file it is a result file No, you're never too old to Yak'n'Roll if you're too young to die. |
|
|
strauss_jon
Starting Member
23 Posts |
Posted - 2009-09-10 : 05:19:05
|
Ok, sorry I'm not being overly clear here. I wasn't referring outputting on the same line of the sqlcmd. Here's what i'm doing. Easy stuff...I create a connection via sqlcmd and call a script:sqlcmd -S %svr% -i "%root%\create\db\crt_database.sql" -v db=%db%At the start of the crt_database.sql file, I have::out c:\mylog.logWhich works fine. Then I create a new connection and call a 2nd script file which contains the same logging command. I want to append the log of the 2nd script to c:\mylog.log. By default the 2nd log overwrites the 1st. Sorry for the confusion... |
|
|
strauss_jon
Starting Member
23 Posts |
Posted - 2009-09-10 : 05:49:55
|
ok, another way is to use your -o command, e.g.sqlcmd -S %svr% -i "%root%\create\db\crt_database.sql" -v db=%db% -o c:\mylog.logBut how can you append to this file e.g.sqlcmd -S %svr% -i "%root%\create\db\crt_database.sql" -v db=%db% -o c:\mylog.logsqlcmd -S %svr% -i "%root%\create\db\doSomethingElse" -v db=%db% -o c:\mylog.logsqlcmd -S %svr% -i "%root%\create\db\AnddoSomethingElse" -v db=%db% -o c:\mylog.login order to have logs for the 3 outputs in 1 file. By default, you'll only see the output for the last one 'AnddoSomethingElse'Cheers. |
|
|
strauss_jon
Starting Member
23 Posts |
Posted - 2009-09-11 : 06:01:34
|
Hmmm - still struggling. Ideas? |
|
|
YellowBug
Aged Yak Warrior
616 Posts |
Posted - 2009-09-11 : 06:48:35
|
I suggest the old-fashioned re-direction, with >>, like:sqlcmd -S %svr% -i "%root%\create\db\crt_database.sql" -v db=%db% >> c:\mylog.logsqlcmd -S %svr% -i "%root%\create\db\doSomethingElse" -v db=%db% >> c\:\mylog.logsqlcmd -S %svr% -i "%root%\create\db\AnddoSomethingElse" -v db=%db% >> c:\mylog.log |
|
|
strauss_jon
Starting Member
23 Posts |
Posted - 2009-09-11 : 06:58:30
|
Brilliant, that's all I wanted! Thanks very much...Easy when you know how :-) |
|
|
YellowBug
Aged Yak Warrior
616 Posts |
Posted - 2009-09-11 : 07:12:09
|
You're welcome. Glad I could help! |
|
|
TonyTheDBA
Posting Yak Master
121 Posts |
Posted - 2013-10-07 : 08:30:23
|
Thanks again Yellowbug . . . I'll go back to good old fashioned redirection-- RegardsTony The DBA |
|
|
|