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.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 sp_depends makes me angry

Author  Topic 

ajthepoolman
Constraint Violating Yak Guru

384 Posts

Posted - 2002-11-18 : 17:02:39
I tried to use sp_depends to get a table name, but it returns that line of crap at the top: "In the current database, the specified object is referenced by the following:"

That nice little sentance is throwing me off! Is there a way to have it just return the columns and their values?

Thanks all!

Aj

MichaelP
Jedi Yak

2489 Posts

Posted - 2002-11-18 : 17:09:30
Not sure exactly what you are trying to do, but the following examples might help you:


EXEC sp_columns 'MyTableName'
EXEC sp_PKeys 'MyTableName'
EXEC sp_FKeys @FKTABLE_NAME='MyTableName'
EXEC sp_FKeys 'MyTableName'


Michael

<Yoda>Use the Search page you must. Find the answer you will.</Yoda>
Go to Top of Page

ajthepoolman
Constraint Violating Yak Guru

384 Posts

Posted - 2002-11-20 : 12:18:51
I am trying to best determine which lookup table to open based on a query name.

For instance, if I have a query called qryStatesLst, when a user needs to add a value to a combobox, I want the application to open up the xtblStates table.

Unfortunately, not all of my queries match my naming convention, so if I can't find a direct correlation between a list query and a table, then I want to search the dependancies of that list query and try to match a table to it.

sp_depends would work just fine, except for that line at the top. But I found another undocumented query sp_MSdependencies which is doing just what I want.

Thanks all!

Aj

Go to Top of Page

nr
SQLTeam MVY

12543 Posts

Posted - 2002-11-20 : 12:27:24
if you look at sp_depends you will see that that message comes from the line
raiserror(15459,-1,-1)

You could create another SP without that line.
Or better incorporate the code from sp_depends that you need in your SP.

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page
   

- Advertisement -