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.
| Author |
Topic |
|
bkpgamble
Starting Member
30 Posts |
Posted - 2006-11-01 : 03:29:02
|
| Dont know if this is the right forum to post this on but here we go.I'am creating a rexx, and I need to use osql as well.My problem is that I want the osql error message to be captured in rexxlike this------------sql = *sql statement*"OSQL -S s122x98 -E -r 1 -w 200 -Q """sql""" | rxqueue" newq sqlrc = rcsay 'sql rc' sqlrc-------------problem is the rexx, just says return code 0 even if the sql statement is invalid.So how do I get the Osql error message into the RC of the rex ?Thanks |
|
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2006-11-01 : 07:58:13
|
| Use the -o flag to pour the output into a file, then have your Rexx code use the file. |
 |
|
|
bkpgamble
Starting Member
30 Posts |
Posted - 2006-11-02 : 03:23:44
|
| Yea proberly the way I'am going to do it just wanted to se if there was a nother way |
 |
|
|
bkpgamble
Starting Member
30 Posts |
Posted - 2006-11-08 : 05:06:05
|
| I'am still having problemsI now use the -o c:\out.txtand it dosent work as I would like it toif I enter a valid osql commandALTER INDEX [testI] ON [DRE].[TBtest] REORGANIZEthere is no output and the rexx runs finewenn I make the statement invalid likeAL INDEX [testI] ON [DRE].[TBtest] REORGANIZEI get an OSQL error and this error is NOT put into the output file as I would like but just printed on screenhow to I get this error into a file ? |
 |
|
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2006-11-08 : 07:57:14
|
| I just ran a similar test and got error output in the file. You might need to use the -r and -m parameters to modify how errors are reported, Books Online describes them in more detail. |
 |
|
|
bkpgamble
Starting Member
30 Posts |
Posted - 2006-11-09 : 02:44:01
|
| I already have them on but wenn I get anny error in my osql I still cant get it into the file"OSQL -S Server -E -r 1 -m -n -w 200 -i c:\load2.sql -o c:\out.txt"can you se were I did something wrong ? |
 |
|
|
bkpgamble
Starting Member
30 Posts |
Posted - 2006-11-09 : 02:45:57
|
| Ahh I figured it out thanks :) |
 |
|
|
|
|
|