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 |
|
Ex
Posting Yak Master
166 Posts |
Posted - 2005-02-24 : 17:38:55
|
| hey alltrying to work out how to do this i have a stored procedure that was originally called from a cursor YUK! :)cursors gone and now a temp table is being passed in (not much better but only good way to do it at the moment)but i have a problem i am sure this will be easy but just cant get itthe input table has a column with PartentID//@inputTable (ParentID,ChangeInSize,...)this is my old code SELECT @CurrSpares = SparesInBytes FROM ENTITYWHERE EntityID = @ParentID AND MajorBuildNo = 0 AND MinorBuildNo = 0 AND AutoSize <> 1IF ((@CurrSpares - @ChangeInSize) < 0) BEGIN RETURN -1 ENDjust wondering how to do this condition in a set version? the only way i can think of is to put a identity column on the input table variable and do a while loop is there a better way? |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2005-02-24 : 19:35:21
|
| if exists (select * from ENTITY e join #inputtable t on e.EntityID = t.ParentID and e.MajorBuildNo = 0 and e.MinorBuildNo = 0 and e.AutoSize <> 1 where e.SparesInBytes - t.ChangeInSize) < 0beginreturn -1end==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
|
|
|