How to display n-1 columns from n number of columns, from a
single table in MS SQL server 2005?
Answers were Sorted based on User's Feedback
Answer / k m rajesh
Declare @ColumnName Varchar(50)
Select @ColumnName = Name From syscolumns Where id = object_id(Table_Name) and ColID = (Select Count(name)-1 from SysColumns Where id = object_id(Table_Name))
Is This Answer Correct ? | 0 Yes | 0 No |
Answer / rajesh ranjan
Declare @ColumnName varchar(50)
select @ColumnName=Name from syscolumns where id=object_id
(Table_Name) and colid=1 --2 for second Column, 3 for third
exec ('select '+@ColumnName+' from Table_Name')
Is This Answer Correct ? | 1 Yes | 2 No |
Define union, union all, minus, intersect?
Where are sql server user names and passwords stored in sql server?
what is cursor?why we will go to cursor?advantages &disadvantages of cursors?
Where do we generally create INDEX?
1 Answers Ernst Young, Thomson Reuters,
How to get the definition of a user defined function back?
What is 1nf normalization form?
What is the significance of null value and why should we avoid permitting null values?
what is maximum size of temp db?
How to create a simple user defined function in ms sql server?
What are the acid properties?
How does a profiler work?
What is @@error in sql?