General information
Forum:
Microsoft SQL Server
Title:
Can sp_pkeys be used as a function in T-SQL?
Hi. I'm attempting to make use of a SP from within a SQL statement. What I would like to return is a table of table names that have a trigger associated as well as the primary key's column name associated with the table. The problem I am having is retrieving the PK for the retrieve tables.
Here's what I have so far, but as you can see with the portion immediately following the sp_pkeys SP, it is incomplete and destined for failure.
SELECT sysobjects.name, sp_pkeys sysobjects.name
FROM sysobjects
WHERE (id IN
(SELECT DISTINCT parent_obj FROM sysobjects WHERE xtype = 'TR'))
ORDER BY name
Any suggestions?
Doug
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only