[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Sql server-t-sql: how do I declare table datatype and fetch a cursor into it?

Posted on 2006-03-24
3
Medium Priority
?
585 Views
Last Modified: 2012-06-27
Hi experts,
I am writing a stored procedure in sql server and instead of declaring so many local variable to hold the resultset from a cursor, I want to be able to declare a rowtype or tabletype datatype to hold the resultset. I am new to sql server but have worked with Oracle database.
Can someone please help alongwith code examples? Thanks
/uzairp
0
Comment
Question by:uzairp
  • 2
3 Comments
 
LVL 14

Accepted Solution

by:
nayernaguib earned 1000 total points
ID: 16287418
This question comes usually from Oracle to SQL Server newcomers. :-)

Unfortunately, There's no way to declare a %ROWTYPE variable in SQL Server. You need to declare as many variables as needed to hold values from a record.

_______________

  Nayer Naguib
0
 
LVL 14

Expert Comment

by:nayernaguib
ID: 16287449
Here's what "Microsoft SQL Server Migration Assistant for Oracle" says:

• Variable declarations including %ROWTYPE on Oracle will be converted to a group of local variables on SQL Server.

_______________

  Nayer Naguib
0
 

Author Comment

by:uzairp
ID: 16296866
Now I know I dont have to spend any more time looking for an equivalent of rowtype. Thanks
/uzairp
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Computer science students often experience many of the same frustrations when going through their engineering courses. This article presents seven tips I found useful when completing a bachelors and masters degree in computing which I believe may he…
What do responsible coders do? They don't take detrimental shortcuts. They do take reasonable security precautions, create important automation, implement sufficient logging, fix things they break, and care about users.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Introduction to Processes

873 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question