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.
Author |
Topic |
duhaas
Constraint Violating Yak Guru
310 Posts |
Posted - 2006-11-17 : 15:42:36
|
Why do I keep getting invalid column name when running this"SELECT TRADER, RECORD_ID, TIMEVAL, FIELD_NAME, OLD_VALUE, NEW_VALUE, DATENAME(m, (CONVERT(char, dbo.juliandate(JULDATE), 110))) + ' ' + CONVERT(char(4), YEAR(CONVERT(char, dbo.juliandate(JULDATE), 110))) AS dateyearFROM MAUDITWHERE TRADER = 'TNIELSEN' AND RECORD_ID = 'Swap TICKER/SECTYPE' order by dateadd(month, datediff(month,0,dateyear),0) |
|
TG
Master Smack Fu Yak Hacker
6065 Posts |
Posted - 2006-11-17 : 15:55:54
|
becuase you can't refer to a column alias in the same statement that defines the alias. You 'll need to order by the <columnNumber> or the entire expression or use a derived table.Be One with the OptimizerTG |
 |
|
|
|
|
|
|