Ver Mensaje Individual
  #2 (permalink)  
Antiguo 03/04/2012, 14:01
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: No repetir dato en carga con BULK

Código SQL:
Ver original
  1. INSERT INTO tabla
  2.   (campos)
  3.  
  4. SELECT * FROM(
  5. SELECT
  6.     SELECT campos, ROW_NUMBER() OVER partition(BY campo no repetido ORDER BY campo no repetido) AS rn
  7.       FROM  OPENROWSET(BULK  ''D:\folder\filename."'',--File that are procesed
  8.       FORMATFILE='test.Xml',--Format file, that file contains the info of the columns that are used in the fill of the table       
  9.       FIRSTROW = 2 --Row where the info start
  10.       ) as t1
  11. ) t2 where rn=1

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