December 12, 2011 at 9:50 pm
ashisht4u (12/12/2011)
Lynn,Actually I'm preparing for my interview and I came across some of the question on DB, I'm at C++ but not done much work on SQL-Server. I want to learn db scripting.
Sean,
Can you provide some more information on how could I implement this without using cursor.
Your help on this is appreciated.
Self join on the table using ROW_NUMBER to create a sequence. Join would be offset by 1 on that ROW_NUMBER sequence.
As a side bar, the only questions I ask about a Cursor is "When would you use one?" If the answer isn't "Almost never", then you've given the wrong answer. The next question to follow would be "Except for the almost never occasions, when would you use one?" I'll leave the answer to that question for you to discover on your own. 😉
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing post 16 (of 16 total)
You must be logged in to reply to this topic. Login to reply