March 13, 2015 at 12:02 pm
I am not sure why my insert or into is not working in my SQL Server R2 2008. I have a code I am using on an existing table and trying to put the data in a brand new table but it keeps giving me an error
select mCid, caucasian, aa, api, aian, mr, his, max(val)
into memberrand
from MEMBERV2_RAND
cross apply (
select AA union all
select API union all
select AIAN union all
select MR union all
select HIS union all
select CAUCASIAN
) v(val)
group by mCid, AA, API, AIAN, MR, HIS, caucasian
;
The error is: Msg 1038, Level 15, State 5, Line 1
An object or column name is missing or empty. For SELECT INTO statements, verify each column has a name. For other statements, look for empty alias names. Aliases defined as "" or [] are not allowed. Change the alias to a valid name.
Do I have to actually create this table with no values first and then run the query? I was hoping this was sort of a make a table query
March 13, 2015 at 12:31 pm
You need to alias your max(val) column. 😉
March 13, 2015 at 12:37 pm
Oh my gosh. Such a simple thing I forgot. Thanks so much
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply