Ver Mensaje Individual
  #3 (permalink)  
Antiguo 23/03/2011, 15:10
Avatar de flaviovich
flaviovich
 
Fecha de Ingreso: agosto-2005
Ubicación: Lima, Peru
Mensajes: 2.951
Antigüedad: 18 años, 8 meses
Puntos: 39
Respuesta: store procedure

Bueno, esto es una adaptacion. Solo queda lo del la funcion delete.
Código SQL:
Ver original
  1. CREATE FUNCTION AzaleaI2of5(@I2of5number VARCHAR(50))
  2. RETURNS VARCHAR(50)
  3. AS
  4.  
  5. BEGIN
  6.  
  7. DECLARE @i INT,
  8. @temp VARCHAR(10),
  9. @temp2 VARCHAR(10)
  10. @chunk VARCHAR(50)
  11.  
  12. IF (Len(@I2of5number) &#37; 2) <> 0
  13.   SET @I2of5number = '0' + @I2of5number
  14.  
  15. SET @temp2 = @I2of5number
  16.  
  17. FOR @i = 1 TO Len(@I2of5number) / 2
  18. BEGIN
  19.     SET @chunk = @temp2
  20.     SET @chunk = DELETE(@chunk, 3, Len(@chunk))
  21.  
  22.     IF StrToInt(@chunk) < 90
  23.         SET @temp = @temp + Chr(StrToInt(@chunk) + 33)
  24.     ELSE
  25.         SET @temp = @temp + Chr(StrToInt(@chunk) + 71);
  26.  
  27.     SET @temp2 = DELETE(@temp2, 1, 2)
  28. END;
  29.  
  30. //ADD the START AND stop bars (ASCII 171 & ASCII 172)
  31.  
  32. RETURN Chr(171) + @temp + Chr(172)
  33.  
  34. END
__________________
No repitamos temas, usemos el Motor de busquedas
Plantea bien tu problema: Ayúdanos a ayudarte.