SQL - Creating a field name form SELECT - TechRepublic
Question
October 29, 2009 at 05:46 AM
martinbullock15

SQL – Creating a field name form SELECT

by martinbullock15 . Updated 16 years, 8 months ago

Hi

I am setting up a set of queries and for one of them i need to create a field name which is part self typed (constant) and part concatenated with a result of a single row field

SELECT ‘ENDDATE_P’ + PERIODNO

so ‘ENDDATE_P’ is the constant which i have typed and PERIODNO is the result from the single row field.

This is so as we move through the year the name of the column move, so the resulting field name would be: ENDDATE_P1, ENDDATE_P2 ENDDATE_P3…..

when i try to run the query i get the following error

“Error converting data type varchar to float.”

Thanks in advance for any suggestions or alternatives

Kind Regards

Martin

This discussion is locked

All Comments