Ver Mensaje Individual
  #2 (permalink)  
Antiguo 13/03/2014, 16:00
Avatar de Libras
Libras
Colaborador
 
Fecha de Ingreso: agosto-2006
Ubicación: En la hermosa perla de occidente
Mensajes: 7.412
Antigüedad: 17 años, 9 meses
Puntos: 774
Respuesta: Ordenamiento Ascendente de codigo

quizas esto te sirva:

Código SQL:
Ver original
  1. CREATE TABLE #temp
  2. (
  3. valor VARCHAR(20)
  4. )
  5.  
  6.  
  7. INSERT INTO #temp VALUES ('4')
  8. INSERT INTO #temp VALUES ('2')
  9. INSERT INTO #temp VALUES ('3')
  10. INSERT INTO #temp VALUES ('1')
  11. INSERT INTO #temp VALUES ('A1')
  12. INSERT INTO #temp VALUES ('A2')
  13. INSERT INTO #temp VALUES ('5')
  14. INSERT INTO #temp VALUES ('6')
  15. INSERT INTO #temp VALUES ('A3')
  16. INSERT INTO #temp VALUES ('B1')
  17. INSERT INTO #temp VALUES ('7')
  18.  
  19. SELECT CONVERT(VARCHAR(20),campo) FROM(
  20. SELECT CASE WHEN isnumeric(valor)=1 THEN CONVERT(INT,valor) END campo FROM #temp
  21. ) AS t1 WHERE campo IS NOT NULL
  22. UNION
  23. SELECT * FROM(
  24. SELECT CASE WHEN isnumeric(valor)=0 THEN valor END campo FROM #temp
  25. ) AS t1 WHERE campo IS NOT NULL

saludos!
__________________
What does an execution plan say to t-sql query? Go f**k yourself, if you are not happy with me