Author |
Topic |
smitha
Posting Yak Master
100 Posts |
Posted - 2009-12-08 : 06:31:11
|
Hi,How to display only the column names? I don't want data to be displayed.Thanks in advanceSmitha |
|
RickD
Slow But Sure Yak Herding Master
3608 Posts |
Posted - 2009-12-08 : 06:51:15
|
select top 0 * from table or:set rowcount 0select * from table |
|
|
rajdaksha
Aged Yak Warrior
595 Posts |
Posted - 2009-12-08 : 07:07:57
|
OrSELECT * FROM <Table_Name> WHERE 1 = 2-------------------------R... |
|
|
smitha
Posting Yak Master
100 Posts |
Posted - 2009-12-09 : 01:49:10
|
quote: Originally posted by rajdaksha OrSELECT * FROM <Table_Name> WHERE 1 = 2-------------------------R...
I am not getting blank in the list.Actually I want to update the column names of the table in the list box in my application. I have written code for this. but column names are not getting updated.Smitha |
|
|
smitha
Posting Yak Master
100 Posts |
Posted - 2009-12-09 : 01:51:07
|
quote: Originally posted by RickD select top 0 * from table or:set rowcount 0select * from table
I tried both queries.In the 1st query it is showing blank in the list box.In the 2nd query it is showing the values of the 1st column.Smitha |
|
|
rajdaksha
Aged Yak Warrior
595 Posts |
Posted - 2009-12-09 : 02:13:39
|
HiI think u need this...SELECT NAME FROM SYS.COLUMNS WHERE [OBJECT_ID] = OBJECT_ID('Your_Table_Name') -------------------------R... |
|
|
smitha
Posting Yak Master
100 Posts |
Posted - 2009-12-09 : 02:38:30
|
Hi,I wrote your code like this:SELECT nameFROM sys.columnsWHERE (object_id = OBJECT_ID(' dbo.ELECTROLYSER1'))But gave me no resultSmitha |
|
|
rajdaksha
Aged Yak Warrior
595 Posts |
Posted - 2009-12-09 : 02:57:46
|
quote: Originally posted by smitha Hi,I wrote your code like this:SELECT nameFROM sys.columnsWHERE (object_id = OBJECT_ID(' dbo.ELECTROLYSER1'))But gave me no resultSmitha
Try this...SELECT nameFROM sys.columnsWHERE (object_id = OBJECT_ID('ELECTROLYSER1'))-------------------------R... |
|
|
smitha
Posting Yak Master
100 Posts |
Posted - 2009-12-09 : 03:08:05
|
quote: Originally posted by rajdaksha
quote: Originally posted by smitha Hi,I wrote your code like this:SELECT nameFROM sys.columnsWHERE (object_id = OBJECT_ID(' dbo.ELECTROLYSER1'))But gave me no resultSmitha
Try this...Thanks I got the answerSELECT nameFROM sys.columnsWHERE (object_id = OBJECT_ID('ELECTROLYSER1'))-------------------------R...
Smitha |
|
|
rajdaksha
Aged Yak Warrior
595 Posts |
Posted - 2009-12-09 : 03:11:24
|
quote: Originally posted by smitha
quote: Originally posted by rajdaksha
quote: Originally posted by smitha Hi,I wrote your code like this:SELECT nameFROM sys.columnsWHERE (object_id = OBJECT_ID(' dbo.ELECTROLYSER1'))But gave me no resultSmitha
Try this...Thanks I got the answerSELECT nameFROM sys.columnsWHERE (object_id = OBJECT_ID('ELECTROLYSER1'))-------------------------R...
Smitha
Enjoy Madi -------------------------R... |
|
|
RickD
Slow But Sure Yak Herding Master
3608 Posts |
Posted - 2009-12-09 : 06:32:13
|
This is a perfect example of someone not knowing how to ask the right question. |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2010-01-06 : 08:40:27
|
quote: Originally posted by RickD select top 0 * from table or:set rowcount 0select * from table
Set rowcount 0 will give you all rows MadhivananFailing to plan is Planning to fail |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2010-01-06 : 08:41:34
|
orselect column_name from information_schema.columns where table_name='ELECTROLYSER1'MadhivananFailing to plan is Planning to fail |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2010-01-06 : 09:44:35
|
quote: Originally posted by madhivanan orselect column_name from information_schema.columns where table_name='ELECTROLYSER1'MadhivananFailing to plan is Planning to fail
this is my preffered method |
|
|
|