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 are the restrictions applicable while creating views? : SQL Server Architecture
hi, the following are the outputs of sp_spaceused and sp_tempdbspace sp_spaceused ------------ database size unallocated size tempdb 77752.95 MB 28026.99 MB sp_tempdbspace ------------- database size spaceused tempdb 77752.945312 1.007812 the unused space in sp_spaceused is nearly 28 Gb and in sp_tempdbspace is nearly 76 Gb cany any one explain about this output and why its giving different results.
If we use where clause in the left outer join then how the query would behave/act?
How to delete multiple rows with one delete statement in ms sql server?
Does partitioning help performance?
Do you know what is replace and stuff function in sql server?
What is the difference between value type and reference type?
How adventureworkslt tables are related?
What is faster join or union?
Explain the different types of backups available in sql server? : sql server database administration
To find second largest salary in Employee table
What are the types of sql server?
Oracle (3259)
SQL Server (4518)
MS Access (429)
MySQL (1402)
Postgre (483)
Sybase (267)
DB Architecture (141)
DB Administration (291)
DB Development (113)
SQL PLSQL (3330)
MongoDB (502)
IBM Informix (50)
Neo4j (82)
InfluxDB (0)
Apache CouchDB (44)
Firebird (5)
Database Management (1411)
Databases AllOther (288)