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 |
anjaliv
Starting Member
10 Posts |
Posted - 2011-07-12 : 11:55:39
|
I am getting an error "A severe error occurred on the current command. The results, if any, should be discarded." when following command is run.I am using SQL server 2005.The script runs for some time and then gives an error.FETCH name_cur INTO @dbName, @tableName WHILE @@Fetch_Status = 0BEGIN SET @sql -....insert into [dbo].[Table1] (obj_name, obj_type)EXEC (@sql)UPDATE [dbo].[Table1] SET db_name = @dbName ,table_name = @tableName WHERE db_name IS NULLFETCH name_cur INTO @dbName, @tableNameENDCLOSE name_curDEALLOCATE name_cur |
|
Seventhnight
Master Smack Fu Yak Hacker
2878 Posts |
Posted - 2011-07-12 : 13:11:02
|
I'm pretty sure there is more to it than this... is there a line number with the error? did you include that line?We could probably be even more helpful if you let us know what you were trying to do with the cursor... The likelyhood is that a cursor is unnecessary.Corey I Has Returned!! |
 |
|
anjaliv
Starting Member
10 Posts |
Posted - 2011-07-12 : 14:18:11
|
I am finding dependent objects on a particular table. I have table names and db names in another table. I am fetching them into a cursor and storing dependency in other table. This is the requirement. And I am not sure why this error is occuring. |
 |
|
jimf
Master Smack Fu Yak Hacker
2875 Posts |
Posted - 2011-07-12 : 15:14:34
|
select object_name(id),object_name(depid) from sys.sysdependsJimEveryday I learn something that somebody else already knew |
 |
|
anjaliv
Starting Member
10 Posts |
Posted - 2011-07-12 : 16:31:29
|
How can I find the type of object in sys.sysdepends? I want object dependency on tables. |
 |
|
|
|
|