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 |
|
Onamuji
Aged Yak Warrior
504 Posts |
Posted - 2002-01-15 : 14:52:41
|
| I need a procedure that will tell me if a stored procedure returns a recordset or not. Is this possible? I can't figure this out because if the procedure returns an empty recordset I still want to know that its empty vs ones that just don't return one at all. Thanks!- Onamuji |
|
|
sica
Posting Yak Master
143 Posts |
Posted - 2002-01-15 : 16:46:27
|
| You can use OPENQUERY or OPENROWSET to execute the sp and check if it returns something like this:SELECT COUNT(*)FROM OPENROWSET('SQLOLEDB', '<server_name>';'<user>';'<password>', 'EXEC Pubs..byroyalty 100')or use the classic onesCREATE TABLE #temp (id varchar(40))INSERt #TEMPEXEC Pubs..byroyalty 100SELECT COUNT(*) FROM #TEMPDROP TABLE #TEMPand you should get a 10I've tested on SQL 2000 (pubs).SicaEdited by - sica on 01/15/2002 16:47:38 |
 |
|
|
smccreadie
Aged Yak Warrior
505 Posts |
Posted - 2002-01-15 : 17:44:31
|
| Probably even easier to use EXIST.If (NOT) EXIST (Select ....) BEGIN Do something here End |
 |
|
|
|
|
|