'('附近的语法不正确

时间:2019-04-08 04:50:55

标签: sql-server

我收到此错误

  

'('

附近的语法不正确

我找不到语法问题在哪里。怎么了?如何解决?

INSERT INTO Recurring (WO_DespatchName, 
                       FORMAT(start_date, 'dd/MMM/yyyy hh:mm tt') AS start_date, 
                       WO_MaidName, WO_CustomerName, WO_Address, 
                       FORMAT (end_date, 'dd/MMM/yyyy hh:mm tt') AS end_date,  
                       WO_ContactNumber, WO_Addresss) 
VALUES (@WO_DespatchName, @start_date, 
        @WO_MaidName, @WO_CustomerName, @WO_Address,
        @end_date, @WO_ContactNumber, @WO_Addresss); 

SELECT SCOPE_IDENTITY();

1 个答案:

答案 0 :(得分:2)

您假设将FORMAT用于values。尝试如下更新查询。

INSERT INTO Recurring (WO_DespatchName, 
                       start_date, 
                       WO_MaidName, WO_CustomerName, WO_Address, 
                       end_date,  
                       WO_ContactNumber, WO_Addresss) 
VALUES (@WO_DespatchName, 
        FORMAT(@start_date, 'dd/MMM/yyyy hh:mm tt'), 
        @WO_MaidName, @WO_CustomerName, @WO_Address,
        FORMAT (@end_date, 'dd/MMM/yyyy hh:mm tt'), 
        @WO_ContactNumber, @WO_Addresss); 

SELECT SCOPE_IDENTITY();