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 |
rtutus
Aged Yak Warrior
522 Posts |
Posted - 2007-02-25 : 14:46:03
|
Hi, I use insert into like this, but when there re no rows returned by EXEC (@sql) I get the error :There are no matching rows on which to reportand nothing after that in my query runs. Is there a way to avoid that pls? Here is that part of the query that causes the error:SET @sql =' EXEC sys.sp_helprotect @username="' + @myVar + '"'print @loginParamINSERT INTO #permissions([Owner],[Object],[Grantee],[Grantor],[ProtectType],[Action],[Column])EXEC (@sql) |
|
Kristen
Test
22859 Posts |
Posted - 2007-02-25 : 15:20:29
|
Are you trying to do:INSERT INTO #permissions(...)EXEC sys.sp_helprotect ...because if so that is not what your @sql is going to do!Kristen |
 |
|
rtutus
Aged Yak Warrior
522 Posts |
Posted - 2007-02-25 : 17:14:48
|
I just found it s funny actually, although i get the message There are no matching rows on which to report my queries still execute it s just that my last statement select * from tempdb..#permissions to show the results does n t execute for some reason, so after runing my whole queries, I always have to run it again seperately to get the results of my query. So there was no error :)Thanks |
 |
|
Kristen
Test
22859 Posts |
Posted - 2007-02-26 : 06:18:33
|
Actually looking at your SQL again I think it will insert the rows into #permissions !!But I reckon you could just doINSERT INTO #permissions([Owner], [Object], [Grantee], [Grantor], [ProtectType], [Action], [Column])EXEC sys.sp_helprotect @username = @myVar Kristen |
 |
|
rtutus
Aged Yak Warrior
522 Posts |
Posted - 2007-02-26 : 09:09:15
|
that s better then Thank you Kristen :) |
 |
|
|
|
|
|
|