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 |
What is the default order of an order by clause?
What is a covered index?
What is the ‘fillfactor’?
What are the pros and cons of putting a scalar function in a queries select list or in the where clause?
Can we drop user if user mapped to any logins
How are the unique and primary key constraints different?
How do I start sql server?
You want to implement the many-to-many relationship while designing tables. How would you do it?
What is always encrypted?
Which data types generate inaccurate results if used with an = or <> comparison in a where clause of a sql statement?
Please get the 4 th maximum salary from a table without using any sql keyword (TOP,MAX are mot allowed)
What is live lock and deadlock? what is Lock escalation?