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 2005 Forums
 Other SQL Server Topics (2005)
 how to view different columns

Author  Topic 

matiq12
Starting Member

7 Posts

Posted - 2010-01-28 : 05:48:32
how to view different columns having same name from different tables in same database..
kindly help..

senthil_nagore
Master Smack Fu Yak Hacker

1007 Posts

Posted - 2010-01-28 : 05:53:53
Use alias name!

Select a.userid,b.userid from user_master a inner join dept b on
b.userid=a.userid

Senthil.C
------------------------------------------------------
[Microsoft][ODBC SQL Server Driver]Operation canceled

http://senthilnagore.blogspot.com/
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-01-28 : 06:32:06
quote:
Originally posted by matiq12

how to view different columns having same name from different tables in same database..
kindly help..


do you mean this?

select * from information_schema.columns where column_name='your column name'
Go to Top of Page

matiq12
Starting Member

7 Posts

Posted - 2010-01-28 : 07:12:32
thx a lot senthil_
and visakh for ur help..
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2010-01-28 : 07:26:20
quote:
Originally posted by matiq12

thx a lot senthil_
and visakh for ur help..


Both of them provide you completely different solutions. Which is related to yours?

Madhivanan

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

matiq12
Starting Member

7 Posts

Posted - 2010-01-28 : 07:35:28
i have executed the query u gave Senthil it is executed but it is not getiing the result it jus shows the coloumn name no data. soory too annoy u but if possible kindly help me with tht..
THX for ur corrporation



Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-01-28 : 07:43:06
quote:
Originally posted by matiq12

i have executed the query u gave Senthil it is executed but it is not getiing the result it jus shows the coloumn name no data. soory too annoy u but if possible kindly help me with tht..
THX for ur corrporation






so u were looking for data?
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2010-01-28 : 10:23:13
quote:
Originally posted by matiq12

i have executed the query u gave Senthil it is executed but it is not getiing the result it jus shows the coloumn name no data. soory too annoy u but if possible kindly help me with tht..
THX for ur corrporation






Have you tried Visakh's query?

Madhivanan

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

matiq12
Starting Member

7 Posts

Posted - 2010-01-28 : 11:44:27
ya i have tries tht but its not getting the data in those column:S
Go to Top of Page

vijayisonly
Master Smack Fu Yak Hacker

1836 Posts

Posted - 2010-01-28 : 12:44:37
Can you clearly what exactly is your requirement?

Do you need to see 'data' in those columns or just find out the tables in the database that have the same name you search for?
Go to Top of Page

matiq12
Starting Member

7 Posts

Posted - 2010-01-28 : 15:24:30
i wan to see data from those columns having same name in different tables
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2010-01-29 : 02:11:08
quote:
Originally posted by matiq12

i wan to see data from those columns having same name in different tables


Why do you want to do this?

Madhivanan

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

matiq12
Starting Member

7 Posts

Posted - 2010-01-29 : 04:19:12
thx all ofu for ur corporation i have got my dessired result thx for ur corporatin & help
i have done it by using alias name...
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2010-01-29 : 07:48:23
quote:
Originally posted by matiq12

thx all ofu for ur corporation i have got my dessired result thx for ur corporatin & help
i have done it by using alias name...


Post the working code

Madhivanan

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

- Advertisement -