Ver Mensaje Individual
  #29 (permalink)  
Antiguo 06/09/2012, 12:08
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, 8 meses
Puntos: 774
Respuesta: Incrementar un campo desde un trigger

probe con esto y si me sale, tienes mas campos en tu query?

Código SQL:
Ver original
  1. DROP TABLE #t1
  2. CREATE TABLE #t1 (campo1 VARCHAR(10), campo2 datetime)
  3. INSERT INTO #t1 VALUES ('1',getdate())
  4. INSERT INTO #t1 VALUES ('1',getdate())
  5. INSERT INTO #t1 VALUES ('1',getdate())
  6. INSERT INTO #t1 VALUES ('2',getdate())
  7. INSERT INTO #t1 VALUES ('1',getdate())
  8. INSERT INTO #t1 VALUES ('2',getdate())
  9. INSERT INTO #t1 VALUES ('1',getdate())
  10. INSERT INTO #t1 VALUES ('1',getdate())
  11. INSERT INTO #t1 VALUES ('1',getdate())
  12. INSERT INTO #t1 VALUES ('3',getdate())
  13. INSERT INTO #t1 VALUES ('3',getdate())
  14. INSERT INTO #t1 VALUES ('1',getdate())
  15. INSERT INTO #t1 VALUES ('2',getdate())
  16. GO
  17.  
  18. SELECT ROW_NUMBER() OVER (partition BY campo1 ORDER BY campo1) AS id, campo1,campo2 FROM #t1
  19.  
  20. 1   1   2012-09-06 12:27:09.197
  21. 2   1   2012-09-06 12:27:09.197
  22. 3   1   2012-09-06 12:27:09.200
  23. 4   1   2012-09-06 12:27:09.200
  24. 5   1   2012-09-06 12:27:09.200
  25. 6   1   2012-09-06 12:27:09.203
  26. 7   1   2012-09-06 12:27:09.200
  27. 8   1   2012-09-06 12:27:09.203
  28. 1   2   2012-09-06 12:27:09.203
  29. 2   2   2012-09-06 12:27:09.200
  30. 3   2   2012-09-06 12:27:09.200
  31. 1   3   2012-09-06 12:27:09.203
  32. 2   3   2012-09-06 12:27:09.203

podrias poner el codigo que estas usando y los datos tal cual te los regresa tu proceso??
saludos!
__________________
What does an execution plan say to t-sql query? Go f**k yourself, if you are not happy with me