473,387 Members | 3,781 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Stored Procedure into a Cursor

Hi guys!!

I am trying to fill a cursor with the results of a Stored
Procedured, but SQL give me an syntax error message , does any one can
give me some help

I am using SQL Server, this is the first lines of my code

DECLARE FRates_Cursor CURSOR FOR
exec GET_FJRs_Eng 'all'
OPEN FRates_Cursor

if I run just the exec GET_FJRs_Eng 'all' line it give me the data
results I am trying to put into the cursor, what that means is the
stored is working fine
Thanks in advance
Jul 20 '05 #1
2 13643
On 13 Aug 2003 09:09:48 -0700 in comp.databases.ms-sqlserver,
hu***************@tycoelectronics.com (Humberto Zamarron) wrote:
Hi guys!!

I am trying to fill a cursor with the results of a Stored
Procedured, but SQL give me an syntax error message , does any one can
give me some help

I am using SQL Server, this is the first lines of my code

DECLARE FRates_Cursor CURSOR FOR
exec GET_FJRs_Eng 'all'
OPEN FRates_Cursor

if I run just the exec GET_FJRs_Eng 'all' line it give me the data
results I am trying to put into the cursor, what that means is the
stored is working fine


<aol>If there is a way I'd like to know too </aol>:-)

I tried with sp_who with no luck so what I did was copied the SQL out
of sp_who and used the select statement that it uses. That may get you
a workaround for now but if the original SP changes then you have to
remember to change the other one as well :-\

--
Ride Free (but you still have to pay for the petrol)

(replace sithlord with trevor for email)
Jul 20 '05 #2
[posted and mailed, please reply in public]

Humberto Zamarron (hu***************@tycoelectronics.com) writes:
I am trying to fill a cursor with the results of a Stored
Procedured, but SQL give me an syntax error message , does any one can
give me some help

I am using SQL Server, this is the first lines of my code

DECLARE FRates_Cursor CURSOR FOR
exec GET_FJRs_Eng 'all'
OPEN FRates_Cursor

if I run just the exec GET_FJRs_Eng 'all' line it give me the data
results I am trying to put into the cursor, what that means is the
stored is working fine


Well, SQL Server permits you to pass a cursor variable from a stored
procedure to another. It sounds as if this is something you could have
use for here. Please, refer to Books Online for details. And don't
ask *me* about it, because I have never used the feature, and I guess
that I never will.

Another possibility is to get the data into a temp table, and work
from there. For discussion on this, see an article on my web site:
http://www.algonet.se/~sommar/share_data.html.
--
Erland Sommarskog, SQL Server MVP, so****@algonet.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp
Jul 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Michael Trosen | last post by:
Hi Everyone, I hope someone can help, I'm pretty new to pro*c programming. I have the following application setup: a pro*c program calls a stored procedure and recieves a cursor back: the...
4
by: deprins | last post by:
Hello, I have wrote a stored procedure but its real slow. Its activated by a button on web page but its takes to long to process and the web server gives a timeout message after 5 minutes. Is...
3
by: aaj | last post by:
SQL SERVER 2000 Hi all This is my first attempt at writing a stored procedure. I have managed to get it working but its unlikely to be the best way of handling the problem. While writing it I...
8
by: Thomasb | last post by:
With a background in MS SQL Server programming I'm used to temporary tables. Have just started to work with DB2 ver 7 on z/OS and stumbled into the concept of GLOBAL TEMPORARY TABLE. I have...
0
by: Sahadev K | last post by:
Here is the question 1. I have two stored procedures P1 and P2. 2. I want to call stored procedure P2 from P1. 3. Stored Procedure P2 returns a result set(as an open cursor). 4. In P1, I want to...
1
by: deepdata | last post by:
Hi, I am trying to fetch data from db2 (express version) database by calling stored procedure. I have tried to use both cursor and for loop but still i am getting error. --======Start...
2
by: andres | last post by:
hi all, thanks for everyone for your support! i have a report being built in studio 2005. It calls a stored procedure. The SP runs a query and gets a data set which then loops through to get...
12
by: Lucky | last post by:
Hi guys! i want to create one cursor in the t-sql. the problem is i want to use stored procedure instead of select command in cursor. can anyone tell me how can i use stored procedure's o/p to...
1
by: peaceburn | last post by:
Hi, I'm gonna pull my hair in the coming days with these DB2 stored procedures. So the issue, let's assume a simple stored procedure like this : CREATE PROCEDURE MYSCHEMA.PROCEDURE1 ( )...
10
by: PJackson | last post by:
Trying to declare a simple handler for SQLEXCEPTION. Simple stored proc (UDB 8.2) ---- CREATE PROCEDURE TFBUDB.SMACF_SM_DI (IN POL_NBR CHAR(10) , OUT ErrNo INTEGER , OUT ErrMsg CHAR(80) )...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.