Please start any new threads on our new site at We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Save Password
Forgot your Password?

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Row Type Equivalent in SQL Server
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Starting Member

1 Posts

Posted - 06/04/2004 :  02:50:14  Show Profile  Reply with Quote
I have a scenario like , i have select abt 50 column from 3 different tables in a single query.

I have declared a cursor fwith the above sql statement.
I need to loop thru each record.
Since no of columns is 50 its diffuclt to create 50 variable and use
FETCH NEXT FROM <cursor_name> INTO ,variable_list>

I need to declare a %rowtype variable similar to the one we have in ORACLE cursors.Is there any thing equivalent to this in SQL Server.

Help me out

- Naveen Singh.


United Kingdom
22859 Posts

Posted - 06/04/2004 :  05:15:02  Show Profile  Reply with Quote
Do you have to use a cursor? Might help to know what you are actually doing in the "loop" in case there is a "different way" in SQL server

To knock-up a list of @ variables for a given table (which you can then cut,paste&butcher!) the following may help, just put the name of your table at the appropriate point

SELECT	'@'+ REPLACE(COLUMN_NAME, ' ', '_') + ' = [' + COLUMN_NAME + '],'
WHERE	TABLE_NAME = 'MyTableNameHere'

Go to Top of Page

Flowing Fount of Yak Knowledge

2916 Posts

Posted - 06/04/2004 :  05:25:18  Show Profile  Reply with Quote
Try to stay away from cursors.....their performance 99.9999% of the time sucks.
post a sample of your code (and if possible input data), and a better (faster) solution may arise.
Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.02 seconds. Powered By: Snitz Forums 2000