473,387 Members | 1,621 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.

Mutiple Table from Stored procedure

4
Hi
I am using windows applicaiton(.net) as front end,
and I want to get mutiple tables in Dataset by executing a single stored procedure i.e.
SP would return mutiple tables (record sets) with the user specified name.
can anybody guide me no this?

thanks.
Jan 28 '09 #1
6 2149
ck9663
2,878 Expert 2GB
If you are talking about linking multiple tables, you have to find a key that can be use to link those tables and use a JOIN to link them all together.

If you're talking about concatenating those tables, then you just have to match which columns goes to which columns and use UNION ALL.

Happy coding!

-- CK
Jan 28 '09 #2
dewraj
4
thanks ck9663,

Please have look,

create proc mutiDataSet
As
Begin
select * from temp1
select * from temp2
End

I need to create one procedure in above way but when it execute it returns mutiple record set to front end application e.g. .net dataset
those tables can be accessed in following way.
ds.table[0].
ds.table[1].
but inspite of putting 0,1.... I want get some table name form SP
somthing like -
create proc mutiDataSet
As
Begin
(select * from temp1) as EmpData
(select * from temp2) as DeptData
End
so that I can access in below way
ds.table[EmpData].
ds.table[DeptData].

how it can be possible?
Jan 28 '09 #3
ck9663
2,878 Expert 2GB
This would depend on your front-end apps. Try posting this question in the .Net forum for the basics (ie, how to connect to sql server, how to read recordsets, etc). Then we can discuss the T-SQL that will process your data.

Good luck!

-- CK
Jan 28 '09 #4
dewraj
4
ok,thanks,I will do.

however is it possible to name mutiple record set in store procedure ?

something like -

create proc mutiDataSet
As
Begin
(select * from temp1) as EmpData
(select * from temp2) as DeptData
End

thanks
Jan 28 '09 #5
ck9663
2,878 Expert 2GB
No.

Either you create a separate recordset for each table. Or you can use UNION ALL and add a field that can help you identify which table the row came from.

-- CK
Jan 28 '09 #6
dewraj
4
Thanks ck9663 ,

I check with microsoft as well they says-

"In sort, there's no way to actually "name" your result sets. You're stuck using the 0-based result set ordinal in your client code.
Sorry!
Aaron Alton | [COLOR=#0072bc]thehobt.blogspot.com[/COLOR]"
Jan 29 '09 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Robin Tucker | last post by:
Hi, I'm trying to determine with my program whether or not a given database supports a given feature set. To do this I'm querying for certain stored procedures in the sysobjects table and if...
10
by: serge | last post by:
Using "SELECT * " is a bad practice even when using a VIEW instead of a table? I have some stored procedures that are identical with the difference of one statement in the WHERE clause. If I...
7
by: Mike Hubbard | last post by:
I have read many many messages about temporary tables and stored procedures. Still, I am struggling with a simple concept. I have a java program which creates a temporary table. I now want to...
1
by: Lauren Quantrell | last post by:
I have read the newsgroups and see this is a common issue but I saw no resolution for it: I have an Access2K frotn end and SQL Server 2K backend. In access, I create a temp table using code in a...
1
by: BigD | last post by:
This all centers around an Access Data Project I have a stored procedure that aggregates events stored in a table based on intervals I specify. I have a form that supplies parameters for the...
6
by: Peter Neumaier | last post by:
Hi, I am trying to select some data through a stored procedure and would like to store the result in a local access table. Is that possible? Can somebody provide an example? Thanks&regards!...
1
by: jobs | last post by:
I have a growning list of stored procedures that accept a single string as a parameter. The list and parameters are maintained in a table with two columns. Some of the Stored procedures take...
13
nabh4u
by: nabh4u | last post by:
hi, I am trying to insert multiple rows in a table using PL/SQL. I have two procedures and two tables. the first procedure gets the data from the source table, manipulates it and then sends the...
2
by: acw | last post by:
On a SQL Server 2000 db I would like to setup a stored procedure that accesses couple tables and runs the extended stored procedure xp..cmdshell. The goal is to grant users with limited privileges...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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,...

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.