日韩久久久精品,亚洲精品久久久久久久久久久,亚洲欧美一区二区三区国产精品 ,一区二区福利

【SQL SERVER】Convert Float to Varchar

系統(tǒng) 2395 0

Today,my customer asked me to import data to the database(SQL Server 2008 r2).

One of the columns whose type is varchar in the database,however unknow type in excel tab,records the code information.

when I imported the data from the excel to the database,I found that all the code details stored in the database changed to the type like '1.***xe**'.

After a small amount of trial,I found that we must Convert float to decimal before convert to varchar.

View Code
        
          1
        
        
          Select
        
        
          SUBSTRING
        
        (
        
          cast
        
         (
        
          Convert
        
        (
        
          decimal
        
        (
        
          20
        
        ,
        
          8
        
        ),a.Code) 
        
          as
        
        
          varchar
        
        (
        
          20
        
        )),
        
          1
        
        ,
        
          2
        
        ) 
        
          from
        
         a
      

?

【SQL SERVER】Convert Float to Varchar


更多文章、技術(shù)交流、商務(wù)合作、聯(lián)系博主

微信掃碼或搜索:z360901061

微信掃一掃加我為好友

QQ號聯(lián)系: 360901061

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點擊下面給點支持吧,站長非常感激您!手機微信長按不能支付解決辦法:請將微信支付二維碼保存到相冊,切換到微信,然后點擊微信右上角掃一掃功能,選擇支付二維碼完成支付。

【本文對您有幫助就好】

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描上面二維碼支持博主2元、5元、10元、自定義金額等您想捐的金額吧,站長會非常 感謝您的哦!!!

發(fā)表我的評論
最新評論 總共0條評論
主站蜘蛛池模板: 阳谷县| 公安县| 黄大仙区| 尼木县| 枣庄市| 图木舒克市| 沿河| 三都| 伊吾县| 宁夏| 台南市| 石柱| 乌什县| 兴业县| 大同县| 龙州县| 永济市| 浦北县| 山阴县| 襄樊市| 垣曲县| 南阳市| 乐都县| 长丰县| 彭阳县| 香港 | 满城县| 原平市| 宁都县| 内江市| 长治县| 准格尔旗| 辽宁省| 泰兴市| 梓潼县| 常宁市| 武城县| 永仁县| 三穗县| 凤阳县| 来安县|