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.
Author |
Topic |
ararun
Starting Member
4 Posts |
Posted - 2008-03-05 : 07:42:33
|
greetingsi want to use the select statement to select all the fields fromm the table except primary field. thank you |
|
dataguru1971
Master Smack Fu Yak Hacker
1464 Posts |
Posted - 2008-03-05 : 07:45:56
|
What is the problem?Select [columnname], columname2....etcFROM Table Poor planning on your part does not constitute an emergency on my part. |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-03-05 : 08:15:49
|
Make use of the outputselect column_name+',' from information_schema.columnswhere table_name='your table' and column_name<>'pkcol'MadhivananFailing to plan is Planning to fail |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-03-05 : 08:29:42
|
[code]SELECT c.ORDINAL_POSITION, c.COLUMN_NAMEFROM INFORMATION_SCHEMA.COLUMNS AS cLEFT JOIN INFORMATION_SCHEMA.KEY_COLUMN_USAGE AS kcu ON kcu.TABLE_CATALOG = c.TABLE_CATALOG AND kcu.TABLE_SCHEMA = c.TABLE_SCHEMA AND kcu.TABLE_NAME = c.TABLE_NAME AND kcu.COLUMN_NAME = c.COLUMN_NAMEWHERE kcu.ORDINAL_POSITION IS NULL AND c.TABLE_SCHEMA = 'dbo' AND c.TABLE_NAME = 'Activity'ORDER BY c.ORDINAL_POSITION[/code] E 12°55'05.25"N 56°04'39.16" |
|
|
ararun
Starting Member
4 Posts |
Posted - 2008-03-06 : 01:20:09
|
Thanks for ur replay. |
|
|
|
|
|