Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
reogeo
Starting Member
2 Posts |
Posted - 2012-05-06 : 11:35:52
|
Hi all,I want to include 2 independent select staments in a SP..For exampleSelect A,B,C from AlbhabetsSelect 1,2 from numbersAnd get the output as A B C 1 2Is it possible?Why i need this is To avoid database roundtrips to make the execution time less..Thanks in Advance |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-05-06 : 13:24:14
|
hmm...are the tables related in some way? if not how will you determine which row to be merged with which row from second table? it doest make any sense------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
sunitabeck
Master Smack Fu Yak Hacker
5155 Posts |
Posted - 2012-05-06 : 17:21:24
|
I share Visakh's opinion on this. What you are trying to do seems like a marriage of convenience that is bound to cause a lot of problems.Almost any method you use to connect to the database allows you to retrieve multiple recordsets and process them. For example in ADO.Net, if you are using ExecuteReader, you can use NextResult() method to move to the next result set. There is a nice and simple example here: http://msdn.microsoft.com/en-us/library/haa3afyz(v=vs.80).aspxIf you are unable to do that and end up making two round trips to the database, you can mitigate the impact by making sure that the connection pooling can be used. http://msdn.microsoft.com/en-us/library/8xx3tyca.aspx |
 |
|
|
|
|