select max(cast(MONITOR_GROUP_ID as int))   fresh_no from ca_MONITOR_GROUP_INFOint换成INTEGER也不行..
是啥原因呢?!

解决方案 »

  1.   

    select max(cast(MONITOR_GROUP_ID as decimal))   fresh_no from ca_MONITOR_GROUP_INFO
      

  2.   

    CAST(expr AS type), CONVERT(expr,type), CONVERT(expr USING transcoding_name) The CAST() and CONVERT() functions take a value of one type and produce a value of another type. The type can be one of the following values: BINARY[(N)] CHAR[(N)] DATE DATETIME DECIMAL SIGNED [INTEGER] TIME UNSIGNED [INTEGER] 
      

  3.   

    MONITOR_GROUP_ID as int换成char ,  mysql与sqlserver是不同 , 他不能直接转换为数值形式
    如要转
    可以用replace
      

  4.   

    select cast(max(MONITOR_GROUP_ID) as UNSIGNED),fresh_no from ca_MONITOR_GROUP_INFO;
      

  5.   

    select convert(max(MONITOR_GROUP_ID) as UNSIGNED),fresh_no from ca_MONITOR_GROUP_INFO;试试