Question : Dynamically name my column in sql

Hello experts,

I would like to be able to name a column in a select statement where I'm using on a temp table I am creating.

I tried this - did not work

SELECT
   Apples,
   Oranges As (Select top 1 fruit from table)
FROM
   #tempT

---

Also tried this,

declare @test varchar(10)
set @test = (Select top 1 fruit from table)

Select
   Apples,
   Oranges as @test
From
   #tempT


... did not work.

How can I make it work? I hope I was clear with what I am trying to achieve.

Thanks in advance

Answer : Dynamically name my column in sql

Thank you for your responses.

Solution:
1.)  Uninstalled Crystal Reports for Visual Studio 2010
2.)  Backed out all of the changes I made to the client (Crystal Reports 2008 runtime, etc.)
3.)  Since my Visual Studio .Net project uses Crystal Reports heavily, I stopped using Visual Studio 2010 and reverted back to using Visual Studio 2005.

I am going to wait for the full Crystal Reports for Visual Studio 2010 version is released,, along with the related runtime redistributable package, which the Url I had attached to the initial question said "...is intended to be used on a test development computer to try out the new version of the developer offering; and therefore, does not provide the runtime redistributable packages required to deploy your VS 2010 application."  This websites work-around did not work after trying many differant things.

By the way, I didn't see a release date, for the full version of Crystal Reports for Visual Studio 2010, on the websites I visited.  Does anybody know of any specific release date?

Please let me know
Thanks again
Random Solutions  
 
programming4us programming4us