Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Dynamic Column Names

Author  Topic 

BKSwindell
Starting Member

6 Posts

Posted - 2013-11-05 : 08:10:50
Is it possible to set the column names in a query dynamically with out the use of dynamic SQL?

Example:

SELECT OrderID as "Order_Number"'
Amount as "Total $" & (SELECT SUM(Amount) FROM Orders)
FROM Orders

Should Return:

Order_Number. Total $5000
1234. 1500
6346. 3000
7245. 500

Thanks for the help.

Brad Swindell

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-11-05 : 08:25:46
Not possible

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page

BKSwindell
Starting Member

6 Posts

Posted - 2013-11-05 : 08:27:34
I didn't think so. Just checking. Thanks for the reply.
Go to Top of Page
   

- Advertisement -