截取的SQl语句如下
insert into [T_Mall_Customer] ([Customer_Id],[Customer_NameAb],
[Customer_Name],[CounterStatus],[CounterOpenDate],[TransType],[SettlementType],[SettlementDate],
[CollectionCycle],[FixDeductPoint],[CityLevel],[MallLevel],[CustomerLevel],[CounterPosition],
[CounterArea],[Brand_Id],[SalesClerk_Id],[ShopAssistantCount],[MinSaleAmount],[CounterDeposit],
[CounterExpense],[IsImageCounter],[IsImportantCounter],[SalesDepContactor],[SalesDepTel],[SalesDepFax],
[SalesDepMobile],[FinanceDepContactor],[FinanceDepTel],[FinanceDepFax],[FinanceDepMobile],[FinanceDepCheckSheet],
[InvoiceType],[UniteNum],[Province_Id],[City_Id],[MallAddress],[MallZipCode],
[CustomerInvoiceAddress],[CustomerInvoiceZipCode],[ContractStatus],[Creator],[CreateDate],[Status],
[description],[programname],[stationid],[RecordCreationDate],[RecordCreator],[RecordVersion],
[SalesDepConTitle],[FinanceDepConTitle],[Customer_Code]) values(N'787f266f-fb1c-4484-8e7a-e1611bbc0cd2',N'jh',
N'nmmn',(select case  when N'3' ='NULL' or N'3'='' then null else N'3' end),N'2011-10-12',(select case  when N'1' ='NULL' or N'1'='' then null else N'1' end),(select case  when N'1' ='NULL' or N'1'='' then null else N'1' end),(select case  when N'-0.239' ='-0.239' or N'-0.239'='' then null else -0.239 end),
0,12,(select case  when N'' ='NULL' or N''='' then null else N'' end),(select case  when N'' ='NULL' or N''='' then null else N'' end),(select case  when N'' ='NULL' or N''='' then null else N'' end),(select case  when N'' ='NULL' or N''='' then null else N'' end),
(select case  when N'-0.239' ='-0.239' or N'-0.239'='' then null else -0.239 end),(select case  when N'0d567904-3bdf-476e-b44d-58224755943e' ='NULL' or N'0d567904-3bdf-476e-b44d-58224755943e'='' then null else N'0d567904-3bdf-476e-b44d-58224755943e' end),N'0004',(select case  when N'0' ='-0.239' or N'0'='' then null else 0 end),0,0,
(select case  when N'0' ='-0.239' or N'0'='' then null else 0 end),N'False',N'False',N'',N'',N'',
N'',N'',N'',N'',N'',N'纸本对账',
(select case  when N'' ='NULL' or N''='' then null else N'' end),N'',(select case  when N'' ='NULL' or N''='' then null else N'' end),(select case  when N'' ='NULL' or N''='' then null else N'' end),N'hgjjh',N'',
N'hgjjh',N'',(select case  when N'0' ='NULL' or N'0'='' then null else N'0' end),N'001',N'2011-10-12',(select case  when N'0' ='NULL' or N'0'='' then null else N'0' end),
N'',N'CMallCustomer',N'b6ad75f255cb45c',N'2011-10-12 20:11:52',N'001',null,
N'',N'',N'fdfddf')

解决方案 »

  1.   

    这么长?能不能定位到哪个Case  When?
      

  2.   

    唉,看不到你报了什么错?这样吧,你自己编个简单的select case when结构,在sql2005上运行下,看看是不是对了。如果是对了,那你就得好好研究出错信息了。sql2005对有些写法还是不支持的,但elect case when这个结构应该是支持的吧
      

  3.   

    哦,就是不支持子查询来赋值。解决的方法是定义一个变量,用select case when then end先给变量赋值,然后再看看这种版本问题的语法不兼容,最好还是升级数据库啦
      

  4.   

    insert into [T_Mall_Customer] ([Customer_Id],[Customer_NameAb],
    [Customer_Name],[CounterStatus],[CounterOpenDate],[TransType],[SettlementType],[SettlementDate],
    [CollectionCycle],[FixDeductPoint],[CityLevel],[MallLevel],[CustomerLevel],[CounterPosition],
    [CounterArea],[Brand_Id],[SalesClerk_Id],[ShopAssistantCount],[MinSaleAmount],[CounterDeposit],
    [CounterExpense],[IsImageCounter],[IsImportantCounter],[SalesDepContactor],[SalesDepTel],[SalesDepFax],
    [SalesDepMobile],[FinanceDepContactor],[FinanceDepTel],[FinanceDepFax],[FinanceDepMobile],[FinanceDepCheckSheet],
    [InvoiceType],[UniteNum],[Province_Id],[City_Id],[MallAddress],[MallZipCode],
    [CustomerInvoiceAddress],[CustomerInvoiceZipCode],[ContractStatus],[Creator],[CreateDate],[Status],
    [description],[programname],[stationid],[RecordCreationDate],[RecordCreator],[RecordVersion],
    [SalesDepConTitle],[FinanceDepConTitle],[Customer_Code]) 
    values(
    N'787f266f-fb1c-4484-8e7a-e1611bbc0cd2',N'jh',
    N'nmmn',
    (case  when N'3' ='NULL' or N'3'='' then null else N'3' end),N'2011-10-12',
    (case  when N'1' ='NULL' or N'1'='' then null else N'1' end),
    (case  when N'1' ='NULL' or N'1'='' then null else N'1' end),(case  when N'-0.239' ='-0.239' or N'-0.239'='' then null else -0.239 end),0,12,(case  when N'' ='NULL' or N''='' then null else N'' end),(case  when N'' ='NULL' or N''='' then null else N'' end),(case  when N'' ='NULL' or N''='' then null else N'' end),(case  when N'' ='NULL' or N''='' then null else N'' end),
    (case  when N'-0.239' ='-0.239' or N'-0.239'='' then null else -0.239 end),(case  when N'0d567904-3bdf-476e-b44d-58224755943e' ='NULL' or N'0d567904-3bdf-476e-b44d-58224755943e'='' then null else N'0d567904-3bdf-476e-b44d-58224755943e' end),N'0004',(case  when N'0' ='-0.239' or N'0'='' then null else 0 end),0,0,
    (case  when N'0' ='-0.239' or N'0'='' then null else 0 end),N'False',N'False',N'',N'',N'',
    N'',N'',N'',N'',N'',N'纸本对账',
    (case  when N'' ='NULL' or N''='' then null else N'' end),N'',(case  when N'' ='NULL' or N''='' then null else N'' end),(case  when N'' ='NULL' or N''='' then null else N'' end),N'hgjjh',N'',
    N'hgjjh',N'',(case  when N'0' ='NULL' or N'0'='' then null else N'0' end),N'001',N'2011-10-12',(case  when N'0' ='NULL' or N'0'='' then null else N'0' end),
    N'',N'CMallCustomer',N'b6ad75f255cb45c',N'2011-10-12 20:11:52',N'001',null,
    N'',N'',N'fdfddf')select case when
    改為
     case when
      

  5.   

    哈哈哈哈...
    to“roy_88(中國風)”太感谢你了,你太强了,太牛逼了,我问了公司所有人,还在网上查了,都没有结果,谢谢了,鲜花送给你,哈哈哈哈,高兴啊...