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 |
Explain DBCC?
Explain stored procedure?
What is shared lock?
What is hot add cpu in sql server 2008?
What is an inner join?
Can truncate be rolled back?
What are the advantages of using stored procedures in sql server?
A table contains list of customers and his city with other details. Each customer has a unique number and the table consists millions of data. Query is: I want to retrieve 10 customers from each city, no script, only from single query?
Why the trigger fires multiple times in single login?
Can you explain important index characteristics?
Can store procedure call by user define function in SQL server?
What is the use of tempdb? What values does it hold?