Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 how to find string

Author  Topic 

hh1234
Starting Member

30 Posts

Posted - 2011-09-23 : 16:03:54
Hi. While on the SQL Server I want to find the following string:

IPAddr.IP_Addresses0

I know I need to Query for this but I don't know what the syntax should be?

Select ?????

Also, is there a way to find out exactly where this string lives in the DB? Example: Can you search for it and have it navigate right to the table/view where it lives?

Thanks.

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2011-09-23 : 16:14:18
This looks like an object and not data. Are you asking to search the schema for it or the data for it?

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

hh1234
Starting Member

30 Posts

Posted - 2011-09-23 : 16:28:02
[quote]Originally posted by tkizer

This looks like an object and not data. Are you asking to search the schema for it or the data for it?

Hi, what I am trying to do is find where this object is? This is in the SCCM 2007 DB And there is a TON of tables and views and I want to find where this information lives.

Is it possible to find in a Query statement?
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2011-09-23 : 16:35:43
You can search the catalog through the INFORMATION_SCHEMA views:

select TABLE_NAME
from COLUMNS
where COLUME_NAME = 'IP_Addresses0'

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

hh1234
Starting Member

30 Posts

Posted - 2011-09-23 : 16:46:50
I ran that and it returns an error.

Msg 208, Level 16, State 1, Line 1
Invalid object name 'COLUMNS'.

I tried singular as well 'COLUMN' and I get the same error.


Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2011-09-23 : 16:57:39
Sorry, here you go:

select TABLE_NAME
from INFORMATION_SCHEMA.COLUMNS
where COLUME_NAME = 'IP_Addresses0'

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

hh1234
Starting Member

30 Posts

Posted - 2011-09-23 : 17:47:10
I ran that and it worked. I returns the following:

TABLE_NAME
v_RA_System_IPAddresses
System_IP_Address_ARR

I then looked at every TABLE and nowhere can I find v_RA_System_IPAddresses. In fact no table even begins with v_RA.

So where did it find this information/

Sorry for all the entry level questions but I'm totally new at SQL.

Thanks.
Go to Top of Page

ehorn
Master Smack Fu Yak Hacker

1632 Posts

Posted - 2011-09-23 : 17:51:59
Hello OP,

You can check more information about the Object in INFORMATION_SCHEMA.TABLE table.

Something like;
SELECT * 
FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_NAME = 'v_RA_System_IPAddresses'


Perhaps it is a view and not a table.

HTH.
Go to Top of Page

hh1234
Starting Member

30 Posts

Posted - 2011-09-23 : 18:35:32
ehorn, that worked....thank you!!
Go to Top of Page

ehorn
Master Smack Fu Yak Hacker

1632 Posts

Posted - 2011-09-23 : 18:47:06
yvw, Tara did the heavy lifting. :)

Have a nice evening.
Go to Top of Page
   

- Advertisement -