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
 Transact-SQL (2005)
 How to SELECT Field Name ONLY?

Author  Topic 

knockyo
Yak Posting Veteran

83 Posts

Posted - 2007-07-16 : 23:46:58
Hi,

Actually I just want to SELECT the table with FIELD NAME only. I don't want select all the records.

Hope can guide me.

Thanks.

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2007-07-16 : 23:51:17
[code]SELECT * FROM TABLE WHERE 1 = 2

OR

SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'yourtable'[/code]


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

rahulnadkarni
Starting Member

5 Posts

Posted - 2007-07-16 : 23:51:34
Hi,

I think currently you aretrying
Select * from [TableName]

You need to try as:
Select [FieldName1] , [FieldName2] FROM [TableName]

Thanks,
Rahul
Go to Top of Page
   

- Advertisement -