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)
 Select As clause

Author  Topic 

hugh_mungo
Starting Member

10 Posts

Posted - 2008-02-04 : 10:59:10
Is it possible to run a select statement to get the values for the AS clause e.g.

SELECT person.empnumb AS (SELECT datadict.caption FROM datadict WHERE field = 'empnumb')

I tried this but got a syntax error

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-02-04 : 11:04:50
Only with the use of the dynamic sql.
http://www.sommarskog.se/dynamic_sql.html



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-02-05 : 08:22:41
quote:
Originally posted by hugh_mungo

Is it possible to run a select statement to get the values for the AS clause e.g.

SELECT person.empnumb AS (SELECT datadict.caption FROM datadict WHERE field = 'empnumb')

I tried this but got a syntax error


Why did you store alias names in seperate table?

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -