0

在看到下面语句的语法错误时,我遇到了一些麻烦。我试图在小提琴演示上运行它并且它有效。我用的是Sql Server 2005,兼容模式是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)
4

1 回答 1

3

SQL Server 2008 中添加了表值构造函数。您可以使用派生表来(select ... union all select ...)代替。

于 2013-07-15T04:12:03.843 回答