I have a stored procedure what produces N number of rows.
The rows are ordered by a cataegoryType as follows
catA
catB
catC
What is needed to do on the C++ code side is break these out into
their respective categories by iterating through the rows and checking
the category type. Is there a way to let the DB do this via some sort of
subselect on the rows returned via the stored procedure.
Thanks in advance. 3 3858
kjc (ks*****@elp.rr .com) writes: I have a stored procedure what produces N number of rows. The rows are ordered by a cataegoryType as follows
catA catB catC
What is needed to do on the C++ code side is break these out into their respective categories by iterating through the rows and checking the category type. Is there a way to let the DB do this via some sort of subselect on the rows returned via the stored procedure.
I'm sorry, but I don't understand the question. Maybe you could clarify
with an example?
(I do suspect though, that whatever you are trying to do, you should do it
on the the C++ side.)
--
Erland Sommarskog, SQL Server MVP, es****@sommarsk og.se
Books Online for SQL Server SP3 at http://www.microsoft.com/sql/techinf...2000/books.asp
Thanks for the reply.
I guess what I'm trying to say is that the stored procedure returns
what amounts to a heterogeneous collection. If I made three separate
calls to the DB I would not have this problem ie..
call stored_proc_for _typeA
call stored_proc_for _typeB
call stored_proc_for _typeC
But, this is inefficient, so I'm making one call to a stored procedure
to like
call stored_proc_for _AllTypes
But, on the C++ side, these still must be broken out based on the type.
Erland Sommarskog wrote: kjc (ks*****@elp.rr .com) writes:
I have a stored procedure what produces N number of rows. The rows are ordered by a cataegoryType as follows
catA catB catC
What is needed to do on the C++ code side is break these out into their respective categories by iterating through the rows and checking the category type. Is there a way to let the DB do this via some sort of subselect on the rows returned via the stored procedure.
I'm sorry, but I don't understand the question. Maybe you could clarify with an example?
(I do suspect though, that whatever you are trying to do, you should do it on the the C++ side.)
kjc (ks*****@elp.rr .com) writes: I guess what I'm trying to say is that the stored procedure returns what amounts to a heterogeneous collection. If I made three separate calls to the DB I would not have this problem ie..
call stored_proc_for _typeA call stored_proc_for _typeB call stored_proc_for _typeC
But, this is inefficient, so I'm making one call to a stored procedure to like call stored_proc_for _AllTypes
But, on the C++ side, these still must be broken out based on the type.
I still don't understand what you are after.
Obviously you stored_for_AllT ypes can say:
SELECT * FROM tbl WHRE type = 'typeA'
SELECT * FROM tbl WHRE type = 'typeB'
SELECT * FROM tbl WHRE type = 'typeC'
But that is not very much more efficient than making three stored procedure
calls.
But I don't see the problem for the C++ code. You get the data into some
data structure, depending on which client library you use. Using an
ORDER BY clause in the SQL makes it a little simpler for the C++ code
to find the boundaries.
(Actually there is a way to produce more than one result set from query,
by using the COMPUTE BY clause. But I would recommend use of this
deprecated feature.)
--
Erland Sommarskog, SQL Server MVP, es****@sommarsk og.se
Books Online for SQL Server SP3 at http://www.microsoft.com/sql/techinf...2000/books.asp This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: M Wells |
last post by:
Hi All,
Further to my previous long-winded question about a situation in which
we appear to be mysteriously losing data from our mssql2k server.
We discovered an update statement, in the stored procedure we believe
is at fault, after which no error check was being performed.
Under certain conditions, this update is fired against the same record
in the same table as the immediately preceding update statement within
|
by: Greg Stark |
last post by:
So I have a query in which some of the select values are subqueries. The
subqueries are aggregates so I don't want to turn this into a join, it would
become too complex and postgres would have trouble optimizing things.
So my question is, is there some way to have a subselect return multiple
columns and break those out in the outer query?
Something like:
SELECT x,y,z,
|
by: Neil Zanella |
last post by:
Hello,
I would like to ask the about the following...
PostgreSQL allows tables resulting from subselects to be renamed with
an optional AS keyword whereas Oracle 9 will report an error whenever
a table is renamed with the AS keyword. Furthermore, in PostgreSQL
when the result of a subselect is referenced in an outer select
it is required that the subselect result be named, whereas this
is not true in Oracle. I wonder what standard SQL...
|
by: Mike L. Bell |
last post by:
Query:
update table1 t1
set end_time = (
select end_time
from table2 t2
where t2.key1 = t1.key1
and t2.key2 = t1.key2
)
where exists
|
by: James |
last post by:
I have a performance problem with the following query and variations on the
subselect. The EXISTS version of the first example will complete in ~10
minutes. The NOT logic in both the examples makes them both keep running
long enough that a communications error is the only result returned so far.
This is a federated view computer ~160 k rows, computer_sys_id is PK .
matched_sware ~ 18 million no PK , no index.
Any suggestions on...
| |
by: Terentius Neo |
last post by:
Is it possible to combine (in DB2 UDB 8.1) a stored procedure and a
select statement? I mean something like this:
Select
c.number,
call procedure( c.number ) as list
from
table c
With best regards
|
by: Dino L. |
last post by:
How can I run stored procedure (MSSQL) ?
|
by: Guoqi Zheng |
last post by:
Dear sir,
I am about to finish a new asp.net application, I used a lot of ms sql
stored procedure. Those stored procudure I think is the most important part
of the application.
Now I am about to distribute this application to clients. I definitely don't
like them to look at my stored procedure.
Is there a way I can protect the source code of my stored procedure? What
|
by: Bart op de grote markt |
last post by:
Hello,
I have a problem with a subselect I use in a stored procedure:
UPDATE #TEMP_TABLE
SET P_ID_1=(SELECT top 1 b.P_ID_1 from #TEMP_TABLE b where
b.ID=PARENT_ID),
P_ID_2=PARENT_ID,
P_ID_3=ID
WHERE PARENT_ID IN (SELECT P_ID_2
|
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,...
|
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...
| |
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |