select Prod_id,prod_apply_person,state,state2,Prod_type,Prod_name_eng,prod_name,prod_sort,prod_make_co,Prod_sureness_stock='*******' ,prod_apply_date  
from product  where 1=1 and prod_apply_person=1 union all select prod_id,prod_apply_person,state,state2,prod_type ,Prod_name_eng ,Prod_name ,prod_sort  ,prod_make_co='*******' ,cast(Prod_sureness_stock as varchar(100)),prod_apply_date  
from product  where 1=1 and prod_apply_person<>1

解决方案 »

  1.   

    既然你的Prod_sureness_stock为int型,对于下面这句.就要进行类型转换
    ,Prod_sureness_stock='*******'改为:
    select Prod_id,prod_apply_person,state,state2,Prod_type,Prod_name_eng,prod_name,prod_sort,prod_make_co,cast(Prod_sureness_stock as varchar)='*******' ,prod_apply_date  
    from product  where 1=1 and prod_apply_person=1 union all 
    select prod_id,prod_apply_person,state,state2,prod_type ,Prod_name_eng ,Prod_name ,prod_sort  ,prod_make_co='*******' ,Prod_sureness_stock,prod_apply_date  
    from product  where 1=1 and prod_apply_person<>1
      

  2.   

    '*********'转换为数据类型为 int 时应该是什么?你知道么?我不知道。
      

  3.   

    select Prod_id,prod_apply_person,state,state2,Prod_type,Prod_name_eng,prod_name,prod_sort,prod_make_co,cast(Prod_sureness_stock as varchar(50))='*******' ,prod_apply_date  
    from product  where 1=1 and prod_apply_person=1 union all 
    select prod_id,prod_apply_person,state,state2,prod_type ,Prod_name_eng ,Prod_name ,prod_sort  ,prod_make_co='*******' ,cast(Prod_sureness_stock as varchar(50)),prod_apply_date  
    from product  where 1=1 and prod_apply_person<>1
      

  4.   

    select Prod_id,prod_apply_person,state,state2,Prod_type,Prod_name_eng,prod_name,prod_sort,prod_make_co,Prod_sureness_stock='*******' ,prod_apply_date
    ---------------------------------^^^用半角的=号  
    from product  where 1=1 and prod_apply_person=1 union all 
    select prod_id,prod_apply_person,state,state2,prod_type ,Prod_name_eng ,Prod_name ,prod_sort  ,prod_make_co='*******' ,Prod_sureness_stock,prod_apply_date  
    from product  where 1=1 and prod_apply_person<>1
     product.prod_make_co和 product.Prod_sureness_stock有没有数据值的字段?
      

  5.   

    cast(Prod_sureness_stock as varchar(50))
      

  6.   

    不明白你为啥要给一个int型赋‘*******’这样的值呢?
      

  7.   

    既然你的Prod_sureness_stock为int型,对于下面这句.就要进行类型转换
    ,Prod_sureness_stock='*******'改为:
    select Prod_id,prod_apply_person,state,state2,Prod_type,Prod_name_eng,prod_name,prod_sort,prod_make_co,cast(Prod_sureness_stock as varchar)='*******' ,prod_apply_date  
    from product  where 1=1 and prod_apply_person=1 union all 
    select prod_id,prod_apply_person,state,state2,prod_type ,Prod_name_eng ,Prod_name ,prod_sort  ,prod_make_co='*******' ,Prod_sureness_stock,prod_apply_date  
    from product  where 1=1 and prod_apply_person<>1