--SELECT SUBSTRING('SQL Tutorial', 1, 100) AS ExtractString;
-- SELECT dbo.ConvertToBangla(12456.9087)
ALTER FUNCTION ConvertToBangla(@StringName nvarchar(50))
RETURNS NVARCHAR(50)
AS
BEGIN
--Declare @StringName nvarchar(50);
Declare @FinalString nvarchar(50);
Declare @FinalString2 nvarchar(50);
Declare @SingleCharacter nvarchar(1);
Declare @len int;
Declare @Templen int;
--SET @StringName = '8767564.89780';
SET @FinalString = N'';
SET @len = (SELECT LEN(@StringName));
SET @Templen = 1;
--SELECT @len
WHILE @Templen <= @len
BEGIN
SELECT @SingleCharacter = SUBSTRING(@StringName, @Templen,1)
--SELECT @SingleCharacter;
SELECT @FinalString2 =
CASE
WHEN @SingleCharacter = '1' THEN N'১'
WHEN @SingleCharacter = '2' THEN N'২'
WHEN @SingleCharacter = '3' THEN N'৩'
WHEN @SingleCharacter = '4' THEN N'৪'
WHEN @SingleCharacter = '5' THEN N'৫'
WHEN @SingleCharacter = '6' THEN N'৬'
WHEN @SingleCharacter = '7' THEN N'৭'
WHEN @SingleCharacter = '8' THEN N'৮'
WHEN @SingleCharacter = '9' THEN N'৯'
WHEN @SingleCharacter = '0' THEN N'০'
WHEN @SingleCharacter = '.' THEN N'.'
ELSE N''
END
--SELECT @FinalString2;
SET @FinalString = @FinalString + @FinalString2
SET @Templen = @Templen + 1;
END;
--SELECT @FinalString;
RETURN @FinalString
END
-- SELECT SUBSTRING('SQL Tutorial', 1,1) AS ExtractString;
-- SELECT dbo.ConvertToBangla(12456.9087)
ALTER FUNCTION ConvertToBangla(@StringName nvarchar(50))
RETURNS NVARCHAR(50)
AS
BEGIN
--Declare @StringName nvarchar(50);
Declare @FinalString nvarchar(50);
Declare @FinalString2 nvarchar(50);
Declare @SingleCharacter nvarchar(1);
Declare @len int;
Declare @Templen int;
--SET @StringName = '8767564.89780';
SET @FinalString = N'';
SET @len = (SELECT LEN(@StringName));
SET @Templen = 1;
--SELECT @len
WHILE @Templen <= @len
BEGIN
SELECT @SingleCharacter = SUBSTRING(@StringName, @Templen,1)
--SELECT @SingleCharacter;
SELECT @FinalString2 =
CASE
WHEN @SingleCharacter = '1' THEN N'১'
WHEN @SingleCharacter = '2' THEN N'২'
WHEN @SingleCharacter = '3' THEN N'৩'
WHEN @SingleCharacter = '4' THEN N'৪'
WHEN @SingleCharacter = '5' THEN N'৫'
WHEN @SingleCharacter = '6' THEN N'৬'
WHEN @SingleCharacter = '7' THEN N'৭'
WHEN @SingleCharacter = '8' THEN N'৮'
WHEN @SingleCharacter = '9' THEN N'৯'
WHEN @SingleCharacter = '0' THEN N'০'
WHEN @SingleCharacter = '.' THEN N'.'
ELSE N''
END
--SELECT @FinalString2;
SET @FinalString = @FinalString + @FinalString2
SET @Templen = @Templen + 1;
END;
--SELECT @FinalString;
RETURN @FinalString
END
-- SELECT SUBSTRING('SQL Tutorial', 1,1) AS ExtractString;
No comments:
Post a Comment