numeros a letras sql server.txt

Download Numeros a Letras SQL Server.txt

If you can't read please download the document

Upload: chiemsee

Post on 28-Dec-2015

167 views

Category:

Documents


6 download

TRANSCRIPT

--CREATE FUNCTION NumeroEnLetra(@NumeroAProcesar as varchar(30)) create FUNCTION NumeroEnLetra(@NumeroAProcesar as varchar(30)) RETURNS varchar(500) ASBEGIN DECLARE @Numero bigintDECLARE @Decimal varchar(30)DECLARE @Texto varchar(500)DECLARE @EstiloMillares bitSELECT @Texto=''/* Obtenemos parte entera */IF patindex('%.%', @NumeroAProcesar)>0BEGINSELECT @Numero=LEFT(@NumeroAProcesar, patindex('%.%', @NumeroAProcesar)-1)ENDELSEBEGINSELECT @Numero=CONVERT(bigint, @NumeroAProcesar)ENDSELECT @EstiloMillares=CONVERT(bit,LEN(@Numero)-7)/* Proceso nmero negativos */IF @Numero1000000 AND @Numero