Operand type clash after partition - only occurs when INSERT INTO

21 views Asked by At

Am trying to add a flag into a query and am using the following line

,ROW_NUMBER () over (partition by JOB.\[Employee Number\],JOB.\[Eff Date\] ORDER BY JOB.\[Employee Number\]) as \[RN\]

When i run this in the whole query as a SELECT only it works and returns me a figure, when i then include the INSERT INTO code it returns the following message:

Msg 206, Level 16, State 2, Line 13

Operand type clash: date is incompatible with int

Ive tried dropping the column and adding it as a DATE and also as an INT, even as a FLOAT but neither works.

Adding Column as DATE returns

Msg 241, Level 16, State 1, Line 13

Conversion failed when converting date and/or time from character string.

Ive also tried avoiding the INSERT INTO and using a temptable, but the data cant be then called downstream.

0

There are 0 answers