2

I need to find a view in SQL Server 2000, 2005 and 2008. Actually, I'd like to be able to find anything using a simple query. I tried one answer which did not work - How can I check if a View exists in a Database?

Is there a script to search for views or any other object that is guaranteed to work in all SQL Server versions I mentioned? I prefer something which does not need you to know table names and such to find a view.

4
  • If you are using SQL Server Management Studio you can simple press F6 and use the searching engine. Commented Nov 20, 2013 at 19:01
  • Why did i get -1 for this question ? Commented Nov 20, 2013 at 19:02
  • @gotqn - What does F6 do ? If I know, I can manually go to that menu. f6 does nothing for me. Commented Nov 20, 2013 at 19:04
  • It should open your Object Explorer - technet.microsoft.com/en-us/library/ms174205.aspx and using it you can search for your view - technet.microsoft.com/en-us/library/ms173849.aspx Commented Nov 20, 2013 at 19:27

2 Answers 2

3

you may need this query

SELECT TABLE_NAME as ViewName,
VIEW_DEFINITION as ViewDefinition
FROM INFORMATION_SCHEMA.Views
Sign up to request clarification or add additional context in comments.

Comments

1

If you need SQL Server 2000 compatibility (so sys.views is not available) you can query INFORMATION_SCHEMA.VIEWS

For other types of objects the SQL Server 2000 view sysobjects is still available in later versions for backward compatibility reasons.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.