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
 SQL Server 2000 Forums
 SQL Server Administration (2000)
 Duplicate Columns

Author  Topic 

kjmraohyd
Starting Member

34 Posts

Posted - 2006-06-21 : 04:42:12
Hi All,

I want to build the query to get all duplicate (More than 1) column
names defined in each table and to showup from all tables in a DB.

I found one table has 2 columns with the same name and wonder how other tables are. We are in Pre Production Stage.

I tried with Syscolumns, sysobjects with Having Clause but some how it's not working for me.

TIA

Jaganmohan Rao

mwjdavidson
Aged Yak Warrior

735 Posts

Posted - 2006-06-21 : 04:48:00
SQL Server doesn't allow non-unique column names within a table

Mark
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-06-21 : 04:48:44
>>I found one table has 2 columns with the same name

It is not possible at all
Can you post the table structure?

This will show you list of tables and their columns

Select table_name, column_name from information_Schema.columns
order by table_name, column_name


Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2006-06-21 : 04:51:33
is your database case sensitive ? If it is, SQL Server will treat column name with different case as differnet column


KH

Go to Top of Page

kjmraohyd
Starting Member

34 Posts

Posted - 2006-06-21 : 06:02:51
Thanks All. It's a Case sensitive issue and has been resolved

Jagan
Go to Top of Page
   

- Advertisement -