sqlserver convert persian and arabic numbers to english

علی ذوالفقار
1402/05/02 08:51:20 (124)
DECLARE @BNUM NVARCHAR(100)
SET @BNUM = N'۱۲۳۴۵۶۷۸۹۰' 
SET @BNUM = N'١٢٣٤٥٦٧٨٩٠' 
SELECT
    CAST(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(
        @BNUM
    ,N'۰',N'0'),N'٠',N'0'),N'۱',N'1'),N'١',N'1'),N'۲',N'2'),N'٢',N'2'),N'۳',N'3'),N'٣',N'3'),N'۴',N'4'),N'٤',N'4'),N'۵',N'5'),N'٥',N'5'),N'۶',N'6'),N'٦',N'6'),N'۷',N'7'),N'٧',N'7'),N'۸',N'8'),N'٨',N'8'),N'۹',N'9'),N'٩',N'9')AS BIGINT ) 

Back