Solved

how to check how many "car" column available in my database

Posted on 2007-11-28
4
204 Views
Last Modified: 2008-02-01
what should the query should I run in order to check how many car column available in my database and belongs to which table?
0
Comment
Question by:motioneye
  • 2
4 Comments
 
LVL 75

Expert Comment

by:Aneesh Retnakaran
ID: 20371660
select TABLE_NAME
from information_Schema.Columns
where Column_Name = 'Car'
0
 
LVL 1

Accepted Solution

by:
Alex342 earned 250 total points
ID: 20371747
SELECT TABLE_NAME, 'username', COLUMNPROPERTY(OBJECT_ID(TABLE_SCHEMA + '.' + TABLE_NAME), COLUMN_NAME, 'ColumnID') AS COLUMN_ID
FROM host.INFORMATION_SCHEMA.COLUMNS


just rename username to car or what you need.
and rename host to name of db.
0
 
LVL 75

Assisted Solution

by:Aneesh Retnakaran
Aneesh Retnakaran earned 150 total points
ID: 20371766
In order to eliminate views add this line in the where part "OBJECTPROPERTY(OBJECT_ID(Table_Schema+'.'+Table_Name),'ISTable' )  = 1  "
select TABLE_NAME
from information_Schema.Columns
where Column_Name = 'Car'
AND OBJECTPROPERTY(OBJECT_ID(Table_Schema+'.'+Table_Name),'ISTable' )  = 1
0
 
LVL 25

Assisted Solution

by:imitchie
imitchie earned 100 total points
ID: 20371770
select TABLE_SCHEMA, TABLE_NAME, DATA_TYPE
from information_schema.columns
where column_name = 'Car'
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When you hear the word proxy, you may become apprehensive. This article will help you to understand Proxy and when it is useful. Let's talk Proxy for SQL Server. (Not in terms of Internet access.) Typically, you'll run into this type of problem w…
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
Viewers will learn how the fundamental information of how to create a table.
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

930 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now