# Dig Into Deep

**Engr. Md. Nazim Uddin (MIEB- 24639)**

M.Sc. Eng. (CSE), B.Sc. Engg. (CSE)

Member, Institution of Engineers, Bangladesh (IEB)

**[Office]**

Assistant Programmer

Institute of Information and Communication Technology (IICT)

Khulna University of Engineering & Technology (KUET)

Khulna-920300, Bangladesh

Email: nazim.cse.kuet@gmail.com

Phone: +880 41 769471 Ext. 797 (office)

Cell: +880 171 2988829

Web: http://portal.kuet.ac.bd/nazim

**[Home]**

House# 44/8 KA

Road# South Mujgunni

Mujgunni, Jhurivita

Khulna-900000

Bangladesh

Sir:

Your function to convert nunber to word is a nice tool in respect of Bangladesh. But I am facing a little bit trouble to accomplish it. I am getting “String constants must end with double quote” error. Several time searching the code I am unable to find out it. Sir It is my earnest request to you Kindly fix the same.

Dear Santanu, Sorry for the late replay. If you mail me then the replay may be quicker. I do not know you solve the problem or not but the complete code is here:

USE [dbFHH_new]

GO

/****** Object: UserDefinedFunction [dbo].[udfn_NumberToWords] Script Date: 12/30/2014 16:35:00 ******/

SET ANSI_NULLS ON

GO

SET QUOTED_IDENTIFIER ON

GO

ALTER FUNCTION [dbo].[udfn_NumberToWords] (@intNumberValue INTEGER)

RETURNS VARCHAR(2000)

AS

–select dbo.udfn_NumberToWords(2567)

BEGIN

DECLARE @strNumberString VARCHAR(9)

DECLARE @strReturn VARCHAR(2000)

DECLARE @intUnits SMALLINT

— Create table of number groups

DECLARE @tblNumberGroups TABLE (Units SMALLINT, Hundreds SMALLINT, Tens SMALLINT)

— Handle errors and ”quick wins”

IF @intNumberValue IS NULL RETURN NULL

IF ISNUMERIC(@intNumberValue)=0 RETURN NULL

IF @intNumberValue = 0 RETURN ‘Zero’

IF @intNumberValue 0 OR (@intNumberValue/1000) >0

BEGIN

INSERT INTO @tblNumberGroups (Units, Hundreds, Tens) VALUES (@intUnits, (@intNumberValue % 1000)/100, (@intNumberValue % 1000) % 100 )

SELECT @intNumberValue = CAST (@intNumberValue / 1000 AS INTEGER)

SET @intUnits = @intUnits + 1

END

— Remove last unit added

SET @intUnits = @intUnits-1

— Concatenate text number by reading number groups in reverse order

SELECT @strReturn = ISNULL(@strReturn,’ ‘) +

ISNULL(

ISNULL((CASE Hundreds

WHEN 1 THEN ‘One Hundred ‘

WHEN 2 THEN ‘Two Hundred ‘

WHEN 3 THEN ‘Three Hundred’

WHEN 4 THEN ‘Four Hundred ‘

WHEN 5 THEN ‘Five Hundred ‘

WHEN 6 THEN ‘Six Hundred ‘

WHEN 7 THEN ‘Seven Hundred ‘

WHEN 8 THEN ‘Eight Hundred ‘

WHEN 9 THEN ‘Nine Hundred ‘

END),”) +

CASE WHEN (Hundreds >0 OR Units 0 THEN ‘ and ‘ ELSE ‘ ‘ END +

ISNULL((CASE Tens / 10

WHEN 2 THEN ‘Twenty ‘

WHEN 3 THEN ‘Thirty ‘

WHEN 4 THEN ‘Forty ‘

WHEN 5 THEN ‘Fifty ‘

WHEN 6 THEN ‘Sixty ‘

WHEN 7 THEN ‘Seventy ‘

WHEN 8 THEN ‘Eighty ‘

WHEN 9 THEN ‘Ninety ‘

END),”) +

ISNULL((CASE Tens

WHEN 10 THEN ‘Ten ‘

WHEN 11 THEN ‘Eleven ‘

WHEN 12 THEN ‘Twelve ‘

WHEN 13 THEN ‘Thirteen ‘

WHEN 14 THEN ‘Fourteen ‘

WHEN 15 THEN ‘Fifteen ‘

WHEN 16 THEN ‘Sixteen ‘

WHEN 17 THEN ‘Seventeen ‘

WHEN 18 THEN ‘Eighteen ‘

WHEN 19 THEN ‘Nineteen ‘

END),”) +

COALESCE(

CASE WHEN Tens %10 =1 AND Tens / 10 1 THEN ‘One ‘ END,

CASE WHEN Tens %10 =2 AND Tens / 10 1 THEN ‘Two ‘ END,

CASE WHEN Tens %10 =3 AND Tens / 10 1 THEN ‘Three ‘ END,

CASE WHEN Tens %10 =4 AND Tens / 10 1 THEN ‘Four ‘ END,

CASE WHEN Tens %10 =5 AND Tens / 10 1 THEN ‘Five ‘ END,

CASE WHEN Tens %10 =6 AND Tens / 10 1 THEN ‘Six ‘ END,

CASE WHEN Tens %10 =7 AND Tens / 10 1 THEN ‘Seven ‘ END,

CASE WHEN Tens %10 =8 AND Tens / 10 1 THEN ‘Eight ‘ END,

CASE WHEN Tens %10 =9 AND Tens / 10 1 THEN ‘Nine ‘ END,

”)+

COALESCE(

CASE WHEN Units=1 AND (Hundreds>0 OR Tens>0) THEN ‘Thousand ‘ END,

CASE WHEN Units=2 AND (Hundreds>0 OR Tens>0) THEN ‘Million ‘ END,

CASE WHEN Units=3 AND (Hundreds>0 OR Tens>0) THEN ‘Billion ‘ END,

CASE WHEN Units=4 AND (Hundreds>0 OR Tens>0) THEN ‘Trillion ‘ END,

”)

, ”)

FROM @tblNumberGroups

ORDER BY units DESC

— Get rid of all the spaces

WHILE CHARINDEX(”, @strReturn)>0

BEGIN

SET @strReturn = REPLACE(@strReturn,”,”)

END

SET @strReturn = LTRIM(RTRIM(@strReturn))

RETURN @strReturn + ‘ Taka Only’

END

Dear Sir

Have a good day. I know you have developed the ” The Online Application Submission System ” on behalf of West Zone Power Distribution Company Ltd. I’m a candidate of Assistant Engineer of this company. But it is sorry to say that i could not be able to complete the education information. So in my application the education info shows blank. I would like to get your kind help. I have talk other candidates , some of them have faced the same problem . We would like to see your necessary steps about this type of hazard.

Best Regards

Leton Chandra Dey

RUET, EEE-04

A candidate of WZPDCL