久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

Ms Sql 將 varchar 轉(zhuǎn)換為 Big Int

Ms Sql convert varchar to Big Int(Ms Sql 將 varchar 轉(zhuǎn)換為 Big Int)
本文介紹了Ms Sql 將 varchar 轉(zhuǎn)換為 Big Int的處理方法,對(duì)大家解決問(wèn)題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)吧!

問(wèn)題描述

限時(shí)送ChatGPT賬號(hào)..

我在下方的 varchar 中有 Customer_Telephone_Number 值.

I have Customer_Telephone_Number value in varchar in below side.

Customer_Telephone_Number 值:(222)-3333-333

Customer_Telephone_Number value : (222)-3333-333

INSERT INTO DATABASE_1.dbo.CUSTOMER_TABLE 
(
Customer_Telephone_Number
)

Select

CONVERT(BIGINT,Customer_Telephone_Number)

from 
DATABASE_2.DBO.CUSTOMER_TABLE 

如果我嘗試將 Customer_Telephone_Number 值插入到 Database_1 中,我會(huì)遇到以下異常.

If ? try to insert Customer_Telephone_Number value to Database_1 , i get below exception.

Error converting data type varchar to bigint.

那么我該如何解決這個(gè)問(wèn)題,或者我可以刪除("和)"來(lái)解決問(wèn)題嗎?

任何幫助將不勝感激.

謝謝.

推薦答案

一個(gè)快速而骯臟的方法是:

A quick and dirty way would be:

Select
    CONVERT
    (
        BIGINT,
        REPLACE
        (
            REPLACE
            (
                REPLACE
                (
                    REPLACE
                    (
                        Customer_Telephone_Number,
                        ' ',--Replace white spaces
                        ''
                    ),
                    '-',--Replace dashes
                    ''
                ),
                '(',--Replace open parenthesis
                ''
            ),
            ')',--Replace close parenthesis
            ''
        )
     )
from 
    DATABASE_2.DBO.CUSTOMER_TABLE 

您可以運(yùn)行以下命令以查看其他潛在字符:

You can run the following in order to see other potential characters:

select Customer_Telephone_Number 
from DATABASE_2.DBO.CUSTOMER_TABLE
where ISNUMERIC
    (
        REPLACE
        (
            REPLACE
            (
                REPLACE
                (
                    REPLACE
                    (
                        Customer_Telephone_Number,
                        ' ',--Replace white spaces
                        ''
                    ),
                    '-',--Replace dashes
                    ''
                ),
                '(',--Replace open parenthesis
                ''
            ),
            ')',--Replace close parenthesis
            ''
        )
    ) = 0

這將為您提供無(wú)法轉(zhuǎn)換為 BIGINT 的電話號(hào)碼列表.檢查原因(例如,如果它們中有 .)并像我在示例中所做的那樣在 REPLACE 中添加這些字符.

This will give you a list of telephone numbers that cannot get converted to BIGINT . Check why (for instance if they have a . in them) and add these characters in the REPLACE as i did in the example.

這篇關(guān)于Ms Sql 將 varchar 轉(zhuǎn)換為 Big Int的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

【網(wǎng)站聲明】本站部分內(nèi)容來(lái)源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問(wèn)題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請(qǐng)聯(lián)系我們刪除處理,感謝您的支持!

相關(guān)文檔推薦

What SQL Server Datatype Should I Use To Store A Byte[](我應(yīng)該使用什么 SQL Server 數(shù)據(jù)類型來(lái)存儲(chǔ)字節(jié) [])
Interpreting type codes in sys.objects in SQL Server(解釋 SQL Server 中 sys.objects 中的類型代碼)
Typeorm .loadRelationCountAndMap returns zeros(Typeorm .loadRelationCountAndMap 返回零)
MS SQL: Should ISDATE() Return quot;1quot; when Cannot Cast as Date?(MS SQL:ISDATE() 是否應(yīng)該返回“1?什么時(shí)候不能投射為日期?)
Converting the name of a day to its integer representation(將一天的名稱轉(zhuǎn)換為其整數(shù)表示)
How to convert nvarchar m/d/yy to mm/dd/yyyy in SQL Server?(如何在 SQL Server 中將 nvarchar m/d/yy 轉(zhuǎn)換為 mm/dd/yyyy?)
主站蜘蛛池模板: 成人精品久久日伦片大全免费 | 亚洲成人一区 | 国产欧美一级二级三级在线视频 | 视频一区二区在线观看 | 国产亚洲一区二区在线观看 | 欧美日韩中文字幕在线 | 欧美激情久久久 | 日韩一区在线播放 | 亚洲成人精品国产 | 毛片一级电影 | 中文字幕av在线播放 | 国产精品成人av | 97精品国产97久久久久久免费 | 亚洲系列第一页 | 国产一区二区三区亚洲 | 高清国产午夜精品久久久久久 | 国产第一区二区 | 成人动漫视频网站 | 日韩一区二区在线视频 | 日韩免费视频 | 欧美视频中文字幕 | 日本免费小视频 | 91大神在线资源观看无广告 | 免费观看www7722午夜电影 | 嫩草黄色影院 | 色就干| 一级毛片免费看 | 精品一区二区三区在线观看国产 | 久久午夜精品福利一区二区 | 久久久久国产精品午夜一区 | 天天色av| 99久久精品免费看国产高清 | 精品久久香蕉国产线看观看亚洲 | 日韩网| 久久久久久久久综合 | 在线视频日韩精品 | 日韩电影中文字幕在线观看 | 中文字幕一区二区在线观看 | 精品欧美一区二区在线观看视频 | 亚洲一区二区三区四区在线观看 | 亚洲欧美中文日韩在线v日本 |