Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Which Views are using a Table/Field

Status
Not open for further replies.

kayek

Programmer
Joined
Jun 19, 2003
Messages
95
Location
US
In SQL Server is there an easy way for me to see which views are using criteria of Where Table1.FileState = "A"?

In my situation we are added additional File Statuses. I need to know what views are using this for a criteria. and I will need to update all these views.

 
You could script all the views and then search for the field name or phrase in query analyzer. This has the advantage that you could change them as you find them.

I'm sure there is some way to pull this out of the system tables, but not sure what. But then you still have to script each view you want to change and then change them. So I don't know as it would save that much time.
In any case you will have to look at each which has the phrase individually as some may need to be changed and some may not based on the purpose of the view.

'Course you will also need to check out any stored procedures or SQL created by the GUI to make sure that is updated as well.
 
I am new to SQL Server. I have been using Access and SQL tables for years but just started using views and and stored procedures recently.

Can you explain more on how to script all the views and then search for the field name or phrase in query analyzer?

I do know how to do simple queries in query analyzer.
 
select object_name(id) from syscomments where text like '%Where Table1[.]FileState = ''A''%'

will catch most of the views unless they are quite long and split across multiple rows in the syscomments system table.f

Best regards,
dmcmunn
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top