0

I have some trouble, in seeing the syntax error below statement. I tried to run this on fiddle demo and it works. I'm using Sql Server 2005 and the compatibility mode is 90.

SELECT
    C.col,C.value,C.sortorder
FROM
    PAY_REGISTRY PR
CROSS APPLY
(
VALUES (9,'Basic Salary',SALARY),
    (10,'SANS Withholding',SANS),
    (11,'Probationary Withholding',PROBI),
    (12,'After PP Deduction',A_PP),
    (13,'DAF Deduction',DAF),
    (14,'Annual Leave',LIV_A),
    (15,'Sick Leave',LIV_S),
    (16,'Rest and Recreation',LIV_R),
    (17,'Maternity Leave',LIV_M),
    (18,'Paternity Leave',LIV_P),
    (19,'Unpaid Leave',LIV_U),
    (20,'Meal Allowance',MEAL),
    (21,'Transportation Allowance',TRANS),
    (22,'Business and Travel Allowance',TRAVEL),
    (23,'Site Allowance',[SITE]),
    (24,'Mobile / Phone Allowance',PHONE),
    (25,'Education Allowance',EDU),
    (26,'Bonus',BONUS),
    (27,'Adjustment',ADJ),
    (28,'AL Pay',AL_P),
    (29,'Gross Pay',GROSS),
    (30,'Retention Gross Pay',L_PP),
    (31,'SHI Employee',SHI_EE),
    (32,'SHI Employer',SHI_ER),
    (33,'PIT',PIT),
    (34,'Net Pay',NPAY),
    (35,'Adjustment (Advance)',ADJ_AP),
    (36,'Total Advance Salary',FS_AP),
    (37,'Adjustment (Final)',ADJ_FP),
    (38,'Total Final Salary',FS_FP)
    ) C (sortorder,col,value)
Ice_Drop
  • 452
  • 1
  • 9
  • 19

1 Answers1

3

The table values constructor was added in SQL Server 2008. You can use a derived table with (select ... union all select ...) instead.

Mikael Eriksson
  • 136,425
  • 22
  • 210
  • 281
  • your quick @Mikael, I found the solution already and just posting why is it that 'values' are not working. Many Thanks! – Ice_Drop Jul 15 '13 at 04:15