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
 select [all columns except name, address] fromList

Author  Topic 

landau66
Yak Posting Veteran

61 Posts

Posted - 2008-07-28 : 07:25:03
hi all!

i have a table, with about 25 columns. with the help of select, i want to show all columns except two.

select [all columns except name, address] from TestList

is there a way to write it that way??

thank u very much in advance and greetings from vienna

landau

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-07-28 : 07:33:16
Make use of the result

Select column_name+',' from information_schema.columns
where table_name='TestList' and column_name not in ('name', 'address')

Madhivanan

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

VGuyz
Posting Yak Master

121 Posts

Posted - 2008-07-28 : 07:43:13

Try this sp,This would give the whole structure of u'r table.
From there get the column name and edit the column,
Which u want.

sp_help 'Table_name'

Madhi's query also correct,
This is the another way.
Go to Top of Page

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2008-07-28 : 08:33:56
see:

http://weblogs.sqlteam.com/jeffs/jeffs/archive/2007/07/26/60271.aspx

- Jeff
http://weblogs.sqlteam.com/JeffS
Go to Top of Page
   

- Advertisement -