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 |
oceanboy
Starting Member
44 Posts |
Posted - 2007-06-01 : 02:32:09
|
Hello!Is it possible to have an output in a form of table from stored procedure? I am writing a stored procedure that will update a table and then i need to find out which IDs haven't been updated. I guess I can just insert those values into another table but beside this, is there any other way to do so? thanks!OB |
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2007-06-01 : 02:34:20
|
what do you mean "output in a form of table" ? in terms of rows & columns ?a typical "select col1, col2, col3 from table1" will returns the result in terms of rows & columns KH |
 |
|
dinakar
Master Smack Fu Yak Hacker
2507 Posts |
Posted - 2007-06-01 : 12:29:35
|
You can just return the values via SELECT statement and have your app receive into into one of the Data controls like a datareader or daatset (assuming you are using .NET).Dinakar Nethi************************Life is short. Enjoy it.************************http://weblogs.sqlteam.com/dinakar/ |
 |
|
oceanboy
Starting Member
44 Posts |
Posted - 2007-06-04 : 00:50:53
|
No, i am using classic VB6. So, select statement will do the job? Just an extra question, what if I have 2 or more select statement in the stored procedure? Or this is not a best practice. Sorry guys, still very new to development. |
 |
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2007-06-04 : 11:00:36
|
In VB6, make use of Recordset object and use it's .NextRecordSet method to get successive resultsetsAlso, you should avoid returning more than one resultset as you cant design any reports using those SPsMadhivananFailing to plan is Planning to fail |
 |
|
heze
Posting Yak Master
192 Posts |
Posted - 2007-06-05 : 13:13:14
|
you an also parametrize your sproc so that you always return one table onlycreate proc myProc@myParam as varchar(10)asif (@myParam="somethingYoudecide1")selectstatement1...if (@myParam="somethingYoudecide2")selectstatement2...if (@myParam="somethingYoudeciden")selectstatementn...go |
 |
|
oceanboy
Starting Member
44 Posts |
Posted - 2007-06-07 : 00:39:12
|
thanks guys! got it! |
 |
|
|
|
|