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 |
|
elwoos
Master Smack Fu Yak Hacker
2052 Posts |
Posted - 2004-09-03 : 05:48:14
|
| I have a very simple procedure but I'm not sure what's wrong with itCreate Procedure dbo.GetNextPID@NewID int output asset @NewID = exec GETNEXTID @IDType = 'p'I get a syntax error that is something to do with the exec statement.What I am trying to do is call the sproc called GetNextID, which takes a string parameter (in this case just the letter 'p') and returns an integer. It is that integer that I want to be returned from the sproc above. GetNextID will only return a single integer.I am working on SQL server 7 thanks in advancesteveSteve no function beer well without |
|
|
raymondpeacock
Constraint Violating Yak Guru
367 Posts |
Posted - 2004-09-03 : 05:57:47
|
| Try this insteadEXEC @NewID = GETNEXTID @IDType = 'p'Raymond |
 |
|
|
elwoos
Master Smack Fu Yak Hacker
2052 Posts |
Posted - 2004-09-03 : 06:13:10
|
| I don't believe that!! Well actually I do, I just don't understand itMany thanks RaymondsteveSteve no function beer well without |
 |
|
|
raymondpeacock
Constraint Violating Yak Guru
367 Posts |
Posted - 2004-09-03 : 06:18:33
|
| It's just a syntax thing. I've been caught out like that before, so I know how feel!Raymond |
 |
|
|
elwoos
Master Smack Fu Yak Hacker
2052 Posts |
Posted - 2004-09-03 : 06:22:59
|
| I have another one now!!! Clearly not my day again.I have a dynamic statement stored in a variable @SQLID. If I execute this it will always return either a single value or a null. I want to make use of this in a while statement but again it doesn't work.what I have isWHILE EXEC @SQLID IS NOT NULL...I've tried a number of variant but again am stuckAny help would be greatly appreciatedmany thankssteveSteve no function beer well without |
 |
|
|
mr_mist
Grunnio
1870 Posts |
Posted - 2004-09-03 : 06:31:32
|
| I'm not sure that you can do that. I think you will need to work around it, by storing the result in a variable, then comparing to the variable in the WHILE statement. Just be sure to exec it into the variable before each pass.-------Moo. :) |
 |
|
|
elwoos
Master Smack Fu Yak Hacker
2052 Posts |
Posted - 2004-09-03 : 06:33:46
|
| OK thanks, I was somehow hoping for something a little more elegant.Maybe all the weather we are having for the time of year has got to me.Thanks againsteveSteve no function beer well without |
 |
|
|
mr_mist
Grunnio
1870 Posts |
Posted - 2004-09-03 : 06:39:59
|
| Just one thing, have you tried WHILE (EXEC @sqlid) is not null-------Moo. :) |
 |
|
|
elwoos
Master Smack Fu Yak Hacker
2052 Posts |
Posted - 2004-09-03 : 08:33:31
|
| It doesn't seem to like that so I've stuck with your original suggestion which worksmany thankssteveSteve no function beer well without |
 |
|
|
|
|
|