473,770 Members | 1,991 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Creating Cursor from Stored Procedure

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 create
cursor?

i'm using sql 2000 and .net 2.0

thanks,

Lucky

Jun 20 '06
12 31008
i didn't get you. what do you mean by make myself clear? didn't i gave
you the example? check my post before. and i clearly said what i wanted
to know. in the same post. but instead of targeting the problem you
said there is a syntaxt mistake in the code.

The problem is quite simple to understand. and tha is HOW TO USE OUTPUT
OF THE PROCEDURE TO CREATE CURSOR.

is it very hard to understand? i didnt know the syntaxt and all i
wanted to know was the syntaxt.

but instead telling me that, you asked me what kind of business logic i
want to use. do it really matter to know how the cursor can be created
from the output of the procedure?

and if you are member of the group for years than you should at least
be experienced by now to understand what one is asking.

as far as i know. the example i've posted was of MS SQL SERVER wasn't
from Oracle. but you cared to know wether i want to use PL/SQL or
T-SQL? i didn't asked to optimize some code.

ALL I ASKED IS JUST ONE DEFINATION OF CREATING CURSOR.

Erland Sommarskog wrote:
Lucky (tu************ @gmail.com) writes:
I'm quite dissappointed with your Questions. what i wanted to do so far
is to use output of the stored procedure in the select statement of the
Declaring CURSOR. but you have diverted the conversation on the
different track.


Yes, I want to help you to solve the real problem.

I've been following technical newsgroups on Usenet for many years, and I
early made the observation that when people asked "funny questions" was
that they were trying to get from A to B, but instead they were asking
of how to get from C ro D, because they the way from A to C and from
D to B and now they were standing at deep ravine and not being able to
cross. While there in fact there was a straight motorway from A to B,
which was easy to point to, once the real problem had been uncovered.
-- for your convinience i gave you expamle of declaring cursor that i
had copied form the ms sql help but instead of understanding the
problem you complained about the syntaxt though that example was for to
understand the problem but you missed the target.


I'm afraid that those are the rules. If you cannot make yourself clear
what you are asking for, then you will not get very good answers. I'm
sorry, but while I'm good at SQL, I am not good reading other people's
thoughts.
-- PL SQL is of course in Oracle to write some custom business logic.
the same way you can do in SQL Server the name used in here is T-SQL.
it shouldn't be hard for you to understand.


It happens frequently enough that people who use Oracle, MySQL or some
other engine post to this newsgroup, that I felt obliged to rule out this
possibility.

--
Erland Sommarskog, SQL Server MVP, es****@sommarsk og.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx


Jun 26 '06 #11
Lucky (tu************ @gmail.com) writes:
i didn't get you. what do you mean by make myself clear?
That I did not understand what you was looking for. And I am sorry,
to that end I am the sole judge. You may know what you were looking
for, but that does not mean that you manage to convey that message.
The problem is quite simple to understand. and tha is HOW TO USE OUTPUT
OF THE PROCEDURE TO CREATE CURSOR.


And that is a such a strange thing to, thar there is all reason to ask
what you want really want to do. In fact, any question that involves a
cursor will be met with the suspicion that the cursor may not be needed.

But there is also one more reason to ask what you really want to do:
there may be several options, and which is the best one, depends on
your actual business problem.

Finally, please remember that on Usenet you never get less help than
you pay for.

--
Erland Sommarskog, SQL Server MVP, es****@sommarsk og.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx
Jun 26 '06 #12
I'm agree with you on avoiding CURSORs and i always welcome suggestions
on doing things other ways.
the foreach loop you suggested me was a good suggestion. i already
tried that that to avoid cursor but the problem was with the bunch of
line to modify tables,procedur es,views and all i wanted to do is to
write some logic to update all database rather than doing it manually.

i found the way out and i did it.

but you know when you are on job you have immense pressure on you and
that time you can't wait to explain everything. if it would be
something that i needed for more then 1 time then i would have
discussed the problem in more detail and of course also might welcomed
your suggestions.

i trully appriciate the help i get from groups and that is why i always
prefer groups then tutorials and books. Learning from others experience
is always better then anything.

Erland Sommarskog wrote:
Lucky (tu************ @gmail.com) writes:
i didn't get you. what do you mean by make myself clear?


That I did not understand what you was looking for. And I am sorry,
to that end I am the sole judge. You may know what you were looking
for, but that does not mean that you manage to convey that message.
The problem is quite simple to understand. and tha is HOW TO USE OUTPUT
OF THE PROCEDURE TO CREATE CURSOR.


And that is a such a strange thing to, thar there is all reason to ask
what you want really want to do. In fact, any question that involves a
cursor will be met with the suspicion that the cursor may not be needed.

But there is also one more reason to ask what you really want to do:
there may be several options, and which is the best one, depends on
your actual business problem.

Finally, please remember that on Usenet you never get less help than
you pay for.

--
Erland Sommarskog, SQL Server MVP, es****@sommarsk og.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx


Jun 27 '06 #13

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

Similar topics

6
19030
by: Matthew Houseman | last post by:
All, I've created a synonym that points to a package over a database link like so: CREATE SYNONYM API_MYLINK FOR USER.CSAPI_V2@INSTANCE.DOMAIN.COM I've granted execute like so: grant execute on CSAPI_V2 to scott; When I attach to the database in C# using ODP.NET and attempt to
7
2230
by: Philip Mette | last post by:
Does anyone have any good references they could recommend on Cursor based SQL writing? I have to create SQL that can loop though records simular to VB loops and I have been told that this is the way to go. Any recommendations would be helpful.
15
3826
by: Philip Mette | last post by:
I am begginner at best so I hope someone that is better can help. I have a stored procedure that updates a view that I wrote using 2 cursors.(Kind of a Inner Loop) I wrote it this way Because I couldn't do it using reqular transact SQL. The problem is that this procedure is taking longer and longer to run. Up to 5 hours now! It is anaylizing about 30,000 records. I think partly because we add new records every month. The procedure...
3
6113
by: DarthMacgyver | last post by:
Hello, I recently wrote a survey application. Each question is very similar. The first questions gives me a problem when there are multiple people taking the survey (The Database connection Timed out) I am using the Data Access Application Blocks as ASP.NET (using VB.NET) and SQL 2000. In there first question there can be up to 27 answers. So I figured instead of making 27 different trips to the database I woulc just concatenate my...
8
14020
by: Yusuf INCEKARA | last post by:
I have a stored procedure : CREATE PROCEDURE STP_GETSTORELIST @RETCUR CURSOR VARYING OUTPUT AS set @RETCUR = CURSOR FORWARD_ONLY STATIC FOR SELECT ID,STORE_NAME FROM T_INF_STORE ORDER BY STORE_NAME OPEN @RETCUR
13
5027
by: JayCallas | last post by:
I know this question has been asked. And the usual answer is don't use cursors or any other looping method. Instead, try to find a solution that uses set-based queries. But this brings up several questions / senarios: * I created several stored procedures that take parameters and inserts the data into the appropriate tables. This was done for easy access/use from client side apps (i.e. web-based).
2
23125
by: Chris Zopers | last post by:
Hello, I've created a stored procedure that loops through a cursor, with the following example code: DECLARE curPeriod CURSOR LOCAL for SELECT * FROM tblPeriods DECLARE @intYear smallint DECLARE @intPeriod smallint DECLARE @strTekst varchar(50)
2
22880
by: Bill_DBA | last post by:
I have the following stored procedure that is called from the source of a transformation in a DTS package. The first parameter turns on PRINT debug messages. The second, when equals 1, turns on the openning, fetching, and closing of a cursor. Things are fine if only one of the two parameters was set to 1. When run with both parameters turned on, "dba_test_dts 1, 1", DTS source (tab) preview fails because it thinks no row was returned....
1
7164
by: =?Utf-8?B?cmFuZHkxMjAw?= | last post by:
Can anyone offer pointers to articles/examples of passing a Ref Cursor ***IN*** to an Oracle stored procedure. I find tons of examples for getting a ref cursor OUT of a stored procedure. I'm using the Microsoft.Practices.EnterpriseLibrary.Data.DatabaseFactory, NOT the ODT.NET library (please don't ask why). Thanks, Randy
0
9618
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9454
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10259
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
7456
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6710
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5354
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4007
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3609
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2849
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.