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 |
|
1sabine8
Posting Yak Master
130 Posts |
Posted - 2007-10-11 : 05:05:37
|
| Hi,I need to know whether a stored procedure returns only a single record or it can return more than one if the query if for example to return all records in a specific date range.Thanks. |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-10-11 : 05:08:50
|
It can return as many records as you want. E 12°55'05.25"N 56°04'39.16" |
 |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2007-10-11 : 05:12:34
|
| [code]Select count(*)from OPENROWSET('SQLOLEDB','Data Source=MyServer;Trusted_Connection=yes;Integrated Security=SSPI', 'Execute DB1..MyProc1')[/code]Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
 |
|
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2007-10-11 : 05:28:27
|
| Execute DB1..MyProc1select @@RowCount as returnedRows_______________________________________________Causing trouble since 1980blog: http://weblogs.sqlteam.com/mladenpSSMS Add-in that does a few things: www.ssmstoolspack.com |
 |
|
|
jackv
Master Smack Fu Yak Hacker
2179 Posts |
Posted - 2007-10-11 : 05:29:39
|
| If you're thinking about processing at the client side, e.g in .NET , you return the recordset as an object and then iterate through the recordset in your applicationJack Vamvas--------------------Search IT jobs from multiple sources- http://www.ITjobfeed.com/SQL |
 |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2007-10-11 : 05:49:53
|
quote: Originally posted by spirit1 Execute DB1..MyProc1select @@RowCount as returnedRows_______________________________________________Causing trouble since 1980blog: http://weblogs.sqlteam.com/mladenpSSMS Add-in that does a few things: www.ssmstoolspack.com
Spirit1,That wont work unless SELECT is really the last statement in the proc. Lets say there is some temp table processsing like this.Create Table #temp(...)set nocount onInsert #Tempselect * from SomeTable-- do some processing on temp table here....select * from #tempdrop table #tempGO thenSELECT @@ROWCOUNT wil return 0 no matter what is the result of SELECT statement.Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
 |
|
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2007-10-11 : 05:51:57
|
| true._______________________________________________Causing trouble since 1980blog: http://weblogs.sqlteam.com/mladenpSSMS Add-in that does a few things: www.ssmstoolspack.com |
 |
|
|
|
|
|