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 Development (2000)
 Store all fields name into a table

Author  Topic 

Sun Foster
Aged Yak Warrior

515 Posts

Posted - 2006-08-01 : 11:15:22
I need to store all field's name (about 100 fields) as data into one field of table.
Can someone help me to code it?

nr
SQLTeam MVY

12543 Posts

Posted - 2006-08-01 : 11:19:13
You mean column names from a table?

insert names
select name from syscolumns where id = object_id('mytable')

or look at information_schema.columns

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

Sun Foster
Aged Yak Warrior

515 Posts

Posted - 2006-08-01 : 11:28:35
It works great! Thank you!!!
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-08-01 : 11:59:38
Why do you want to store them in new table? Whenever needed query it in information_schema.columns


Madhivanan

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

- Advertisement -