For further information and to obtain a zipped copy of the databases related to the initials of the Quran you may refer to the following links:

 

Quran Sql server database :  http://www.sharemation.com/godistheone/gval_data.zip?uniq=-brsele

 

Quran Microsoft Access database : http://www.sharemation.com/godistheone/db.zip?uniq=-brsele

 

And For further information and to obtain a zipped copy of the excel files you may refer to the following links:

 

http://www.sharemation.com/godisone/Quran_initial.zip?uniq=-brsele

and

http://www.sharemation.com/godistheone/Quran_I_letter.zip?uniq=-brsele

 

I have created excel file by using the below function.

 

All of function that has been used in Sql server data bases:

 

Function number : 1

Input:Arabic verse

Ouput:return all Bismillah letter

output: return Bismillah letter of verse

 

 

CREATE    function retBisLetter(@st nvarchar(2000))

returns nvarchar(254)

as

begin

    declare @x nvarchar(254)

    declare @len int

    declare @s nvarchar(254)

    declare @g int

    declare @we nvarchar(50)

 

    set @s=''

    set @len=len(@st)

   

WHILE (@len <> 0)

BEGIN

    set @we=substring(@st,@len,1)

                                                      

    if @we in('È' ,'Ó' ,'ã' ,'Ç' ,'á' ,'å' ,'Ñ' ,'Í' ,'ã' ,'ä' ,'í' ,'Æ' ,'Â' ,'Å' ,'Ã')

    begin

      if charindex(@we,@s)=0 set @s=@s+' '+@we

    end

    set @len=@len-1

END

set @x=@s

    RETURN(isnull(@x,''))

end

 

Function number : 2

Input:Arabic verse

Ouput:return Bismillah letter Count

 

create     function retBisLettercnt(@st nvarchar(2000))

returns float

as

begin

    declare @x float

    declare @x2 nvarchar(254)

    set @x2=dbo.retBisletter(@st)

    set @x2=replace(@x2,' ','')

    set @x2=ltrim(rtrim((@x2)))

    set @x=len(@x2)

    RETURN(isnull(@x,0))

end

 

Function number : 3

Input:Arabic verse

Ouput:return GSV of verse

 

CREATE      function retGSV(@st nvarchar(2000))

returns float

as

begin

    declare @x int

    declare @len int

    declare @s int

    declare @g int

    declare @we nvarchar(50)

 

    set @s=0

    set @len=len(@st)

   

WHILE (@len <> 0)

BEGIN

   set @we=substring(@st,@len,1)

   set @g=dbo.retGSVforone(@we)

   set @s=@s+@g

   set @len=@len-1

END

set @x=@s

    RETURN(isnull(@x,0))

end

 

Function number : 4

Input:one Arabic letter

Ouput:return GSV of one letter

 

CREATE          function retGSVforone(@st nvarchar(50))

returns int

as

begin

    declare  @x int

    set  @x=0

    if @st='Ç' set @x=1

    if @st='È' set @x=2

    if @st='Ì' set @x=3

    if @st='Ï' set @x=4

    if @st='å' set @x=5

    if @st='æ' set @x=6

    if @st='Ò' set @x=7

    if @st='Í' set @x=8

    if @st='Ø' set @x=9

    if @st='í' set @x=10

    if @st='ß' set @x=11

    if @st='á' set @x=12

    if @st='ã' set @x=13

    if @st='ä' set @x=14

    if @st='Ó' set @x=15

    if @st='Ú' set @x=16

    if @st='Ý' set @x=17

    if @st='Õ' set @x=18

    if @st='Þ' set @x=19

    if @st='Ñ' set @x=20

    if @st='Ô' set @x=21

    if @st='Ê' set @x=22

    if @st='Ë' set @x=23

    if @st='Î' set @x=24

    if @st='Ð' set @x=25

    if @st='Ö' set @x=26

    if @st='Ù' set @x=27

    if @st='Û' set @x=28

    if @st='Æ' set @x=10

    if @st='Ä' set @x=6

    if @st='Â' set @x=1

    if @st='Á' set @x=1

    if @st='Å' set @x=1

    if @st='Ã' set @x=1

 

    RETURN(isnull(@x,0))

end

 

Function number : 5

Input:verse

Ouput:return GV of verse

 

 

 

CREATE        function retGV(@st nvarchar(2000))

returns float

as

begin

    declare @x int

    declare @len int

    declare @s int

    declare @g int

    declare @we nvarchar(50)

 

    set @s=0

    set @len=len(@st)

   

WHILE (@len <> 0)

BEGIN

   set @we=substring(@st,@len,1)

   set @g=dbo.retGvforone(@we)

   set @s=@s+@g

   set @len=@len-1

END

set @x=@s

    RETURN(isnull(@x,0))

end

Function number : 6

Input:one Arabic letter

Ouput:return GV of one letter

 

CREATE         function retGVforone(@st nvarchar(50))

returns int

as

begin

    declare  @x int

    set  @x=0

    if @st='Ç' set @x=1

    if @st='È' set @x=2

    if @st='Ì' set @x=3

    if @st='Ï' set @x=4

    if @st='å' set @x=5

    if @st='æ' set @x=6

    if @st='Ò' set @x=7

    if @st='Í' set @x=8

    if @st='Ø' set @x=9

    if @st='í' set @x=10

    if @st='ß' set @x=20

    if @st='á' set @x=30

    if @st='ã' set @x=40

    if @st='ä' set @x=50

    if @st='Ó' set @x=60

    if @st='Ú' set @x=70

    if @st='Ý' set @x=80

    if @st='Õ' set @x=90

    if @st='Þ' set @x=100

    if @st='Ñ' set @x=200

    if @st='Ô' set @x=300

    if @st='Ê' set @x=400

    if @st='Ë' set @x=500

    if @st='Î' set @x=600

    if @st='Ð' set @x=700

    if @st='Ö' set @x=800

    if @st='Ù' set @x=900

    if @st='Û' set @x=1000

    if @st='Æ' set @x=10

    if @st='Ä' set @x=6

    if @st='Â' set @x=1

    if @st='Á' set @x=1

    if @st='Å' set @x=1

    if @st='Ã' set @x=1

 

    RETURN(isnull(@x,0))

end

 

Function number : 7

Input:Arabic verse

Ouput:return GV of initial letter of verse

 

create         function retIGV(@st nvarchar(2000))

returns float

as

begin

    declare @x int

    declare @len int

    declare @s int

    declare @g int

    declare @we nvarchar(50)

 

    set @s=0

    set @len=len(@st)

   

WHILE (@len <> 0)

BEGIN

   set @we=substring(@st,@len,1)

   set @g=dbo.retiGvforone(@we)

   set @s=@s+@g

   set @len=@len-1

END

set @x=@s

    RETURN(isnull(@x,0))

end

 

Function number : 8

Input:one Arabic letter

Ouput:return GV of one initial letter

 

create        function retIGVforone(@st nvarchar(50))

returns int

as

begin

    declare  @x int

    set  @x=0

 

    if @st='Ç' set @x=1

    if @st='å' set @x=5

    if @st='Í' set @x=8

    if @st='Ø' set @x=9

    if @st='í' set @x=10

    if @st='ß' set @x=20

    if @st='á' set @x=30

    if @st='ã' set @x=40

    if @st='ä' set @x=50

    if @st='Ó' set @x=60

    if @st='Ú' set @x=70

    if @st='Õ' set @x=90

    if @st='Þ' set @x=100

    if @st='Ñ' set @x=200

    if @st='Æ' set @x=10

    if @st='Â' set @x=1

    if @st='Å' set @x=1

    if @st='Ã' set @x=1

 

    RETURN(isnull(@x,0))

end

 

Function number : 9

Input:Arabic verse

Ouput:return initial letter of verse

 

CREATE    function retILetter(@st nvarchar(2000))

returns nvarchar(254)

as

begin

    declare @x nvarchar(254)

    declare @len int

    declare @s nvarchar(254)

    declare @g int

    declare @we nvarchar(50)

 

    set @s=''

    set @len=len(@st)

   

WHILE (@len <> 0)

BEGIN

    set @we=substring(@st,@len,1)

    if @we in('Ç' ,'å' ,'Í' ,'Ø' ,'í' ,'ß' ,'á' ,'ã' ,'ä' ,'Ó' ,'Ú' ,'Õ' ,'Þ' ,'Ñ' ,'Æ' ,'Â' ,'Å' ,'Ã')

    begin

      if charindex(@we,@s)=0 set @s=@s+' '+@we

    end

    set @len=@len-1

END

set @x=@s

    RETURN(isnull(@x,''))

end

 

Function number : 10

Input:Arabic verse

Ouput:return count of initial letter in verse

 

CREATE    function retILettercnt(@st nvarchar(2000))

returns float

as

begin

    declare @x float

    declare @x2 nvarchar(254)

    set @x2=dbo.retIletter(@st)

    set @x2=replace(@x2,' ','')

    set @x2=ltrim(rtrim((@x2)))

    set @x=len(@x2)

    RETURN(isnull(@x,0))

end

 

Function number : 11

Input: Arabic verse

Ouput:return key letters of verse

 

 

 

CREATE   function retKeyLetter(@st nvarchar(2000))

returns nvarchar(254)

as

begin

    declare @x nvarchar(254)

    declare @len int

    declare @s nvarchar(254)

    declare @g int

    declare @we nvarchar(50)

 

    set @s=''

    set @len=len(@st)

   

WHILE (@len <> 0)

BEGIN

    set @we=substring(@st,@len,1)

                                                       

    if @we in('Ç' ,'å' ,'Í' ,'Ø' ,'í' ,'ß' ,'á' ,'ã' ,'ä' ,'Ó' ,'Ú' ,'Õ' ,'Þ' ,'Ñ' ,'Æ' ,'Â' ,'Å' ,'Ã','È','Ï','æ','Ê','Ð','Ö','Û')

    begin

      if charindex(@we,@s)=0 set @s=@s+' '+@we

    end

    set @len=@len-1

END

set @x=@s

    RETURN(isnull(@x,''))

end

 

Function number : 12

Input:Arabic verse

Ouput:return count of key letter in verse

 

 

 

create     function retKeyLettercnt(@st nvarchar(2000))

returns float

as

begin

    declare @x float

    declare @x2 nvarchar(254)

    set @x2=dbo.retKeyletter(@st)

    set @x2=replace(@x2,' ','')

    set @x2=ltrim(rtrim((@x2)))

    set @x=len(@x2)

    RETURN(isnull(@x,0))

end

 

Function number : 13

Input: Arabic verse

Ouput:return all letters of verse

 

CREATE    function retLetter(@st nvarchar(2000))

returns nvarchar(254)

as

begin

    declare @x nvarchar(254)

    declare @len int

    declare @s nvarchar(254)

    declare @g int

    declare @we nvarchar(50)

 

    set @s=''

    set @len=len(@st)

   

WHILE (@len <> 0)

BEGIN

    set @we=substring(@st,@len,1)

    if @we in('Ç' ,'å' ,'Í' ,'Ø' ,'í' ,'ß' ,'á' ,'ã' ,'ä' ,'Ó' ,'Ú' ,'Õ' ,'Þ' ,'Ñ' ,'Æ' ,'Â' ,'Å' ,'Ã' ,'Ç','È','Ì','Ï','å','æ','Ò','Í','Ø','í' ,'ß','á','ã','ä','Ó','Ú','Ý','Õ','Þ' ,'Ñ' ,'Ô' ,'Ê' ,'Ë' ,'Î' ,'Ð' ,'Ö' ,'Ù' ,'Û','Æ' ,'Ä','Â' ,'Á','Å','Ã' )

    begin

      if charindex(@we,@s)=0 set @s=@s+' '+@we

    end

    set @len=@len-1

END

set @x=@s

    RETURN(isnull(@x,''))

end

 

Function number : 14

Input:Arabic verse

Ouput:return count of letter in verse

 

 

CREATE    function retLettercnt(@st nvarchar(2000))

returns float

as

begin

    declare @x float

    declare @x2 nvarchar(254)

    set @x2=dbo.retletter(@st)

    set @x2=replace(@x2,' ','')

    set @x2=ltrim(rtrim((@x2)))

    set @x=len(@x2)

    RETURN(isnull(@x,0))

end

 

Function number : 15

Input: Arabic verse

Ouput:return TGV of verse

 

CREATE          function retTGV(@st nvarchar(2000))

returns float

as

begin

    declare @x int

    declare @len int

    declare @s int

    declare @g int

    declare @we nvarchar(50)

 

    set @s=0

    set @len=len(@st)

   

WHILE (@len <> 0)

BEGIN

   set @we=substring(@st,@len,1)

   set @g=dbo.retTGvforone(@we)

   set @s=@s+@g

   set @len=@len-1

END

set @x=@s

    RETURN(isnull(@x,0))

end

 

Function number : 16

Input:Arabic letter

Ouput:return TGV of one letter

 

CREATE       function retTGVforone(@st nvarchar(50))

returns int

as

begin

    declare  @x int

    set  @x=0

    if @st='Ç' set @x=3

    if @st='È' set @x=6

    if @st='Ì' set @x=11

    if @st='Ï' set @x=16

    if @st='å' set @x=36

    if @st='æ' set @x=39

    if @st='Ò' set @x=25

    if @st='Í' set @x=22

    if @st='Ø' set @x=34

    if @st='í' set @x=48

    if @st='ß' set @x=53

    if @st='á' set @x=65

    if @st='ã' set @x=77

    if @st='ä' set @x=89

    if @st='Ó' set @x=87

    if @st='Ú' set @x=104

    if @st='Ý' set @x=117

    if @st='Õ' set @x=122

    if @st='Þ' set @x=140

    if @st='Ñ' set @x=230

    if @st='Ô' set @x=334

    if @st='Ê' set @x=425

    if @st='Ë' set @x=527

    if @st='Î' set @x=631

    if @st='Ð' set @x=734

    if @st='Ö' set @x=841

    if @st='Ù' set @x=944

    if @st='Û' set @x=1047

    if @st='Æ' set @x=10

    if @st='Ä' set @x=6

    if @st='Â' set @x=1

    if @st='Á' set @x=1

    if @st='Å' set @x=1

    if @st='Ã' set @x=1

 

    RETURN(isnull(@x,0))

end

 

Function number : 17

Input:one Arabic letter

Ouput:return GV of one allah letter

 

 

CREATE        function retallahGVforone(@st nvarchar(50))

returns int

as

begin

    declare  @x int

    set  @x=0

 

    if @st='Ç' set @x=1

    if @st='å' set @x=5

    if @st='á' set @x=30

    if @st='Â' set @x=1

    if @st='Å' set @x=1

    if @st='Ã' set @x=1

    RETURN(isnull(@x,0))

end

 

Function number : 18

Input:Arabic verse

Ouput:return allah letter of verse

 

CREATE     function retallahLetter(@st nvarchar(2000))

returns nvarchar(254)

as

begin

    declare @x nvarchar(254)

    declare @len int

    declare @s nvarchar(254)

    declare @g int

    declare @we nvarchar(50)

 

    set @s=''

    set @len=len(@st)

   

WHILE (@len <> 0)

BEGIN

    set @we=substring(@st,@len,1)

    if @we in('Ç' ,'á' ,'å' , 'Â' ,'Å' ,'Ã')

    begin

      if charindex(@we,@s)=0 set @s=@s+' '+@we

    end

    set @len=@len-1

END

set @x=@s

    RETURN(isnull(@x,''))

end

 

Function number : 19

Input:Arabic verse

Ouput:return count of Allah letter

 

 

create function retallahLettercnt(@st nvarchar(2000))

returns float

as

begin

    declare @x float

    declare @x2 nvarchar(254)

    set @x2=dbo.retallahletter(@st)

    set @x2=replace(@x2,' ','')

    set @x2=ltrim(rtrim((@x2)))

    set @x=len(@x2)

    RETURN(isnull(@x,0))

end

 

 

Function number : 20

Input:Arabic verse

Ouput:return count of allah letter

 

create     function retallahcount(@st nvarchar(2000))

returns float

as

begin

    declare @x int

    declare @len int

    declare @s int

    declare @g int

    declare @we nvarchar(50)

 

    set @s=0

    set @len=len(@st)

   

WHILE (@len <> 0)

BEGIN

   set @we=substring(@st,@len,1)

   set @g=dbo.retallahGvforone(@we)

   if @g<>0 set @s=@s+1

   set @len=@len-1

END

set @x=@s

    RETURN(isnull(@x,0))

end

 

Function number : 21

Input:Arabic verse

Ouput:return count of letter in verse

 

CREATE    function retcount(@st nvarchar(2000))

returns float

as

begin

    declare @x int

    declare @len int

    declare @s int

    declare @g int

    declare @we nvarchar(50)

 

    set @s=0

    set @len=len(@st)

   

WHILE (@len <> 0)

BEGIN

   set @we=substring(@st,@len,1)

   set @g=dbo.retGvforone(@we)

   if @g<>0 set @s=@s+1

   set @len=@len-1

END

set @x=@s

    RETURN(isnull(@x,0))

end

 

Function number : 22

Input:index of verse

Ouput:return first letter of verse

 

CREATE    function retfirstletter(@indx float)

returns nvarchar(50)

as

begin

    declare @x nvarchar(500)

    set @x=(select fl from a666 where indx=@indx)

    RETURN(isnull(@x,''))

end

 

Function number : 23

Input:arabic verse

Ouput:return count of initial letter

 

 

CREATE     function reticount(@st nvarchar(2000))

returns float

as

begin

    declare @x int

    declare @len int

    declare @s int

    declare @g int

    declare @we nvarchar(50)

 

    set @s=0

    set @len=len(@st)

   

WHILE (@len <> 0)

BEGIN

   set @we=substring(@st,@len,1)

   set @g=dbo.retiGvforone(@we)

   if @g<>0 set @s=@s+1

   set @len=@len-1

END

set @x=@s

    RETURN(isnull(@x,0))

end

 

Function number : 24

Input:index of verse

Ouput:return index of next verse

 

CREATE  function retnextindx(@indx float)

returns nvarchar(50)

as

begin

    declare @next float

    set @next=(select verseno from a666 where @indx+1=indx)

    if @next=0 set @next=@indx+2

    if @next<>0 set @next=@indx+1

    RETURN(isnull(@next,0))

end

 

Function number : 25

Input:arabic verse

Ouput:return Those initial letter that doesn't exists in verse

 

CREATE    function retnonILetter(@st nvarchar(2000))

returns nvarchar(254)

as

begin

    declare @x nvarchar(254)

    declare @len int

    declare @s nvarchar(254)

    declare @s2 nvarchar(254)

    declare @g int

    declare @we nvarchar(50)

 

    set @s=''

    set @len=len(@st)

   

WHILE (@len <> 0)

BEGIN

    set @we=substring(@st,@len,1)

    if @we in('Ç' ,'å' ,'Í' ,'Ø' ,'í' ,'ß' ,'á' ,'ã' ,'ä' ,'Ó' ,'Ú' ,'Õ' ,'Þ' ,'Ñ' ,'Æ' ,'Â' ,'Å' ,'Ã')

    begin

      if charindex(@we,@s)=0 set @s=@s+''+@we

    end

    set @len=@len-1

END

    set @s2=''

    set @x='ÇáãÕÑßåíÚØÓÍÞä'

    set @len=len(@s)

WHILE (@len <> 0)

BEGIN

    set @we=substring(@s,@len,1)

    set @x=replace (@x,@we,'')

    set @len=@len-1

END

    RETURN(isnull(@x,''))

end

 

Function number : 26

Input:Sura number

Ouput:return number of verses in that suras

 

create        function retnoverse(@surano float)

returns float

as

begin

    declare @x int

    set @x=(select max(verseno) from a666 where surano=@surano)

    RETURN(isnull(@x,0))

end

 

Function number : 27

Input:number

Ouput:return 0 if is prime and return 1 if isn't prime

 

 

CREATE function retprime(@num float)

returns float

as

begin

    declare @x float

    declare @i float

 

    set @i=@num-1

   

WHILE (@i <> 1)

BEGIN

   if (@num/@i)=ceiling(@num/@i)

   begin

     goto end1

   end

   set @i=@i-1

END

goto end2

end1:

    RETURN(0)

end2:

    RETURN(1)

 

end

 

Function number : 28

Input:index of verse

Ouput:return sum of it's digit for example for 21:88 is 2+1+8+8=19

 

create       function retsumdigit(@id nvarchar(50))

returns float

as

begin

    declare @x int

    declare @len int

    declare @s int

    declare @g int

    declare @we nvarchar(50)

 

    set @s=0

    set @id=ltrim(rtrim(replace(@id,':','')))

    set @len=len(@id)

   

WHILE (@len <> 0)

BEGIN

   set @we=substring(@id,@len,1)

   set @g=CONVERT(int, @we)

   set @s=@s+@g

   set @len=@len-1

END

set @x=@s

    RETURN(isnull(@x,0))

end

 

Function number : 29

Input:index of verse

Ouput:return Arabic verse

 

CREATE         function retverse(@indx float)

returns nvarchar(1000)

as

begin

    declare @we nvarchar(1000)

    set @we=(select top 1 verse from a666 where indx=@indx )

    RETURN(isnull(@we,''))

end

 

Free Web Hosting