Looking for an Object in a SQL Database

Hello:

I'm trying to look for an object in a SQL database.  I cannot tell if the object is a table, view, or stored procedure.

Is there a "select" script or something along those lines that I can run, to look for this object?

I'd rather not run anything that's going to create another object in SQL, unless doing so is easy and will not do any harm.

Thanks!

TBSupport
LVL 1
TBSupportAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Vikas GargBusiness Intelligence DeveloperCommented:
Hi,

You can use this query

select * from sys.objects where name = 'Your Value'

and the column type_desc will let you know it is a  table or proc etc.
0
Vitor MontalvãoMSSQL Senior EngineerCommented:
SELECT *
FROM sys.objects
WHERE name='NameOfTheObjectIWantToFind'

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Éric MoreauSenior .Net ConsultantCommented:
why not use this free tool from Red Gate: http://www.red-gate.com/products/sql-development/sql-search/

It will not only find the object but also all the references to it.
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

TBSupportAuthor Commented:
Hello:

SQL is not pulling up any records, for this object, even though it exists according to a separate stored procedure.

Could it be an alias or something that I need to look for?

Thanks!

TBSupport
0
TBSupportAuthor Commented:
Hello:

I just found out that it's a user defined function.  How do I find it and the programming behind it?

TBSupport
0
Éric MoreauSenior .Net ConsultantCommented:
In SSMS, expand your database, than expand programmability, than Functions and you will find your UDF under one of the folder (depending on the type of UDF). You will then be able to right-click on it and select Modify to see the code behind
0
Vitor MontalvãoMSSQL Senior EngineerCommented:
I just found out that it's a user defined function
UDFs should be returned by my query. How did you found out?
0
TBSupportAuthor Commented:
Hi Vitor:

I believe that I right-clicked on the stored proc and viewed its dependencies, to find out.

TBSupport
1
Vitor MontalvãoMSSQL Senior EngineerCommented:
Good catch.
I usually don't use SSMS options so I didn't even know that option exists. I'm an old fashion guy that likes to type SQL commands :)
0
TBSupportAuthor Commented:
Me, too!  :)

TBSupport
0
Scott PletcherSenior DBACommented:
You can use:
EXEC sp_helptext 'name'
to get the text for objects that have text.

You can use:
EXEC sp_help 'name'
to get info about any object in the db.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.