Topics Topics Help/Instructions Help Edit Profile Profile Member List Register Paatha Gnyapakaalu - Archives from Old DB  
Search New Posts 1 | 2 | 8 Hours Search New Posts 1 | 3 | 7 Days Search Search Tree View Tree View Latest tweets Live Tweets   Hide Images

Rate this post by selecting a number. 1 is the worst and 5 is the best.

    (Worst)    1    2    3    4    5     (Best)

Author Message
Top of pagePrevious messageNext messageBottom of page Link to this message

Mrbezawada
Pilla Bewarse
Username: Mrbezawada

Post Number: 89
Registered: 10-2011
Posted From: 205.172.134.23

Rating: N/A
Votes: 0

Posted on Monday, September 28, 2015 - 4:13 pm:   

Blaze Annay, I dont have any script. But I created one for you. Check this and let me know:


CREARE PROCEDURE MyDatabase.dboTABLE_INFO(@DatabaseName NVARCHAR(20))
AS
BEGIN

DECLARE @SQL NVARCHAR(1000);

SET @SQL = 'USE '+@DatabaseName ;

SET @SQL = @SQL + CHAR(13);

SET @SQL = @SQL + '
SELECT OBJECT_NAME(parent_object_id) AS TABLE_NAME
, type_desc AS CONSTRAINT_TYPE
, OBJECT_NAME(OBJECT_ID) AS NAME_OF_CONSTRAINT
FROM sys.objects
WHERE type_desc LIKE '''+'%CONSTRAINT%''
ORDER BY OBJECT_NAME(parent_object_id), type_desc
SELECT Tab.name AS TABLE_NAME, Ind.name AS Index_Name
FROM sys.[indexes] Ind
INNER JOIN sys.[tables] AS Tab
ON Tab.[object_id] = Ind.[object_id]
WHERE Ind.name IS NOT NULL '

EXECUTE sp_executesql @SQL;

END

EXEC MyDatabase.dboTABLE_INFO 'MyDataBase'
Bezawada Bewarse Batchey

Topics | Last Hour | Last Day | Last Week | Tree View | Search | Help/Instructions | Program Credits Administration