SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Column and constraint Lookup


Column and constraint Lookup

Author
Message
Nilesh-788004
Nilesh-788004
SSC-Addicted
SSC-Addicted (402 reputation)SSC-Addicted (402 reputation)SSC-Addicted (402 reputation)SSC-Addicted (402 reputation)SSC-Addicted (402 reputation)SSC-Addicted (402 reputation)SSC-Addicted (402 reputation)SSC-Addicted (402 reputation)

Group: General Forum Members
Points: 402 Visits: 140
Hi,
Iam trying to figure out how to find a column in Object Explorer or in a list of Stored Procedures (Object Explorer) and a string in database especially when one is working with 400-500 tables and 100's of stored Procedures.
In Sybase and Oracle ( Toad) it is easy to find such info .But in SQL Server One has to go to Menu Edit-Find-FInd inFiles. If you Stored Procedures are on Desktop . i know sysobjects.But I am not able to get the right info.
Is there a system stored Procedure or a script
For example,
I want to find Column DealerPriorityID in a stored Porcedures and in a table and a particulsr word say 'Chain Saw' in SQL Server 2005.

Is there a script

thank you
Florian Reischl
Florian Reischl
SSChampion
SSChampion (13K reputation)SSChampion (13K reputation)SSChampion (13K reputation)SSChampion (13K reputation)SSChampion (13K reputation)SSChampion (13K reputation)SSChampion (13K reputation)SSChampion (13K reputation)

Group: General Forum Members
Points: 13999 Visits: 3934
Hi

To find out which object is referenced by any other use:

SELECT OBJECT_NAME(referencing_id) referencing,
OBJECT_NAME(referenced_id) referenced,
*
FROM sys.sql_expression_dependencies



To find out which procedure uses "CustomerId" use:

SELECT OBJECT_NAME(object_id), *
FROM sys.all_sql_modules
WHERE definition LIKE '%CustomerId%'



To find out which table contains a special word (within its data) there is no build in function.

Greets
Flo


The more I learn, the more I know what I do not know
Blog: Things about Software Architecture, .NET development and T-SQL

How to Post Data/Code to get the best Help How to Post Performance Problems
Nilesh-788004
Nilesh-788004
SSC-Addicted
SSC-Addicted (402 reputation)SSC-Addicted (402 reputation)SSC-Addicted (402 reputation)SSC-Addicted (402 reputation)SSC-Addicted (402 reputation)SSC-Addicted (402 reputation)SSC-Addicted (402 reputation)SSC-Addicted (402 reputation)

Group: General Forum Members
Points: 402 Visits: 140
Thanks for your reply.But the 1st query gives me an error in Adventure Works DB:
Msg 208, Level 16, State 1, Line 1
Invalid object name 'sys.sql_expression_dependencies'.

So I tried to see if there is a spelling mistake in 'sys.sql_expression_dependencies'.

I typed .sql_expression_dependencies' in google and found this link
http://msdn.microsoft.com/en-us/library/bb677315.aspx

and copy pasted

SELECT OBJECT_NAME(referencing_id) AS referencing_entity_name,
o.type_desc AS referencing_desciption,
COALESCE(COL_NAME(referencing_id, referencing_minor_id), '(n/a)') AS referencing_minor_id,
referencing_class_desc, referenced_class_desc,
referenced_server_name, referenced_database_name, referenced_schema_name,
referenced_entity_name,
COALESCE(COL_NAME(referenced_id, referenced_minor_id), '(n/a)') AS referenced_column_name,
is_caller_dependent, is_ambiguous
FROM sys.sql_expression_dependencies AS sed
INNER JOIN sys.objects AS o ON sed.referencing_id = o.object_id
WHERE referencing_id = OBJECT_ID(N'Production.vProductAndDescription');

.Still it gives me the same error irrespective of any Database. This time I tried in Northwinds.

SAme error.
Jeffrey Williams 3188
Jeffrey Williams 3188
SSC-Dedicated
SSC-Dedicated (31K reputation)SSC-Dedicated (31K reputation)SSC-Dedicated (31K reputation)SSC-Dedicated (31K reputation)SSC-Dedicated (31K reputation)SSC-Dedicated (31K reputation)SSC-Dedicated (31K reputation)SSC-Dedicated (31K reputation)

Group: General Forum Members
Points: 31102 Visits: 10092
Are you on SQL Server 2005?

Jeffrey Williams
Problems are opportunities brilliantly disguised as insurmountable obstacles.

How to post questions to get better answers faster
Managing Transaction Logs

Florian Reischl
Florian Reischl
SSChampion
SSChampion (13K reputation)SSChampion (13K reputation)SSChampion (13K reputation)SSChampion (13K reputation)SSChampion (13K reputation)SSChampion (13K reputation)SSChampion (13K reputation)SSChampion (13K reputation)

Group: General Forum Members
Points: 13999 Visits: 3934
Oups... sorry! I just tried on my SQL Server 2008.

Just researched... so this should work on SQL Server 2005:

SELECT OBJECT_NAME(object_id) referencing,
OBJECT_NAME(referenced_major_id),
*
FROM sys.sql_dependencies



Greets
Flo


The more I learn, the more I know what I do not know
Blog: Things about Software Architecture, .NET development and T-SQL

How to Post Data/Code to get the best Help How to Post Performance Problems
Nilesh-788004
Nilesh-788004
SSC-Addicted
SSC-Addicted (402 reputation)SSC-Addicted (402 reputation)SSC-Addicted (402 reputation)SSC-Addicted (402 reputation)SSC-Addicted (402 reputation)SSC-Addicted (402 reputation)SSC-Addicted (402 reputation)SSC-Addicted (402 reputation)

Group: General Forum Members
Points: 402 Visits: 140
Thank you Very much .I got it. I am in SQL Server 2005.
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search