首页 > 解决方案 > SQL“','附近的语法不正确”

问题描述

所以这是代码:

create procedure udp_import_oltp_data
as
    truncate table customer_stg
    insert into customer_stg
    (
        customer_no,
        customer_name,
        customer_address,
        po_address,
        zip_code,
        city,
        region,
        country
    )
    select (customerid, cust_name, (street_no + ' ' + street_name), po_address, zip, town_city, area, country) from [1385651_OLTP].dbo.customer

“customerid”后面的逗号就是它所说的那个,我也把它用于“国家”后面的右括号。我做了一些搜索,但找不到任何东西。

标签: sqlsql-server

解决方案


不要在选择列列表周围使用括号。它应该是:

select customerid, cust_name, (street_no + ' ' + street_name), po_address, zip, town_city, area, country 
from ...

推荐阅读