Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Scan of table
Message
General information
Forum:
Microsoft SQL Server
Category:
Other
Title:
Environment versions
SQL Server:
SQL Server 2000
Miscellaneous
Thread ID:
01312331
Message ID:
01312882
Views:
14
Sure, even WHILE EXISTS(...) should work, but I just wanted to use the variable itself as WHILE terminator.


>Or
>
>WHILE 1=1
>    BEGIN
>       PRINT @ClaimRef
>       SELECT @MasterRef = c.MasterRef,
>              @ClaimRef  = c.ClaimRef
>		FROM claim c
>			INNER JOIN (SELECT MIN(ClaimRef) AS ClaimRef FROM claim
>					WHERE ClaimRef > @ClaimRef) Tbl1
>			ON p.ClaimRef = Tbl1.ClaimRef
>	IF @@ROWCOUNT = 0
>		BREAK
>    END
>
>>Right,
>>not help at all.
>>Hmm
>>
>>Create Procedure DontUseCursors
>>As
>>DECLARE @MasterRef    varchar(10)
>>DECLARE @ClaimRefCurr varchar(10)
>>DECLARE @ClaimRef     varchar(10)
>>
>>SELECT @MasterRef    = c.MasterRef,
>>       @ClaimRef     = c.ClaimRef
>> FROM claim c
>>      INNER JOIN (SELECT MIN(ClaimRef) AS ClaimRef FROM Claim) Tbl1
>>ON c.ClaimRef = Tbl1.ClaimRef
>>
>>WHILE @ClaimRef IS NOT NULL
>>    BEGIN
>>       print @ClaimRef
>>       SET @ClaimRefCurr = @ClaimRef
>>       SET @ClaimRef     = NULL
>>       SELECT @MasterRef = c.MasterRef,
>>              @ClaimRef  = c.ClaimRef
>> 	FROM claim c
>>        INNER JOIN (SELECT MIN(ClaimRef) AS ClaimRef FROM claim
>>                           WHERE ClaimRef > @ClaimRefCurr) Tbl1
>>	ON p.ClaimRef = Tbl1.ClaimRef
>>    END
>>
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform