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
 Transact-SQL (2000)
 Sys columns

Author  Topic 

nitin1353
Constraint Violating Yak Guru

381 Posts

Posted - 2006-10-05 : 09:04:19
Gurus
In the database we have the name of all the objects in syscolumns table,is there any system object from where i can find out the name of all the columns in the table?
Plz help
Regards
Nitin

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2006-10-05 : 09:15:54
sysobjects contains all objects in the database
syscolumns contains all columns of tables & views


KH

Go to Top of Page

chiragkhabaria
Master Smack Fu Yak Hacker

1907 Posts

Posted - 2006-10-05 : 09:18:57
There is a view called information_schema.columns

Chirag
Go to Top of Page

nitin1353
Constraint Violating Yak Guru

381 Posts

Posted - 2006-10-05 : 09:23:24
Thanks
But how wil i find out columns of a particular table?
Regards
Nitin
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2006-10-05 : 09:35:44
[code]
use Northwind
select COLUMN_NAME from INFORMATION_SCHEMA.COLUMNS where TABLE_NAME = 'Customers'
select name from syscolumns where id = object_id('Customers')
[/code]


KH

Go to Top of Page

nitin1353
Constraint Violating Yak Guru

381 Posts

Posted - 2006-10-05 : 09:56:11
Hi
Can you please let me know how will i use this with my update statement in script section?
Thanks
Regards
Nitin
Go to Top of Page

DonAtWork
Master Smack Fu Yak Hacker

2167 Posts

Posted - 2006-10-05 : 10:03:46
sounds like another DYNAMIC SQL update. You NEED to know the table name and the column names you are updating BEFORE you do the update, you dont look them up at run time!!! Format in the front end! Look in BOL! Ask Peso! <insert more standard answers here>

[Signature]For fast help, follow this link:
http://weblogs.sqlteam.com/brettk/archive/2005/05/25.aspx
Learn SQL
http://www.sql-tutorial.net/
http://www.firstsql.com/tutor.htm
http://www.w3schools.com/sql/default.asp
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2006-10-05 : 10:07:04
This thread is related to http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=73083


KH

Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-10-05 : 11:53:21
>>Format in the front end! Look in BOL! Ask Peso!

You forget Learn SQL


Madhivanan

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

- Advertisement -