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.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 LOOPING HELP

Author  Topic 

pnpsql
Posting Yak Master

246 Posts

Posted - 2012-03-01 : 01:56:54
I NEED TO SIMULATE THIS CODE IN TSQL PLEASE HELP,

V_TYPE IS TABLE VARIABLE

FOR I IN 1 .. V_TYPE.COUNT ()
LOOP
IF V_TYPE.EXISTS (I + 1)
AND V_TYPE (I) <> V_TYPE (I + 1)

PRINT 'OK'

END LOOP;




challenge everything

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2012-03-01 : 02:02:16
what's wrong the the query that i posted in your earlier thread ?

http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=171839


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

pnpsql
Posting Yak Master

246 Posts

Posted - 2012-03-01 : 02:21:37
i need the same in loop structure.



challenge everything
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2012-03-01 : 02:25:41
if your requirement is as such, the query that i posted should be able do that. Unless you have other requirement that is not make known to us

quote:
Originally posted by pnpsql

simply, i have cursor exactly i am working on some accounting entries, and i need to check for
debit and credit match, there is one row with debit and second with credit amount. now i need to check that first and second will be same . please suggest..

challenge everything




KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page
   

- Advertisement -