November 10, 2008 at 12:03 am
I can able to add values in to table but the problem is i want to add distinct values to the table i.e the value should not be repeated ...
BULK
INSERT dummy2
FROM 'c:\bulk.txt'
WITH
(
FIELDTERMINATOR = '\t',
ROWTERMINATOR = '\t'
)
gururajan.k
November 10, 2008 at 12:07 am
gururajan (11/10/2008)
I can able to add values in to table but the problem is i want to add distinct values to the table i.e the value should not be repeated ...BULK
INSERT dummy2
FROM 'c:\bulk.txt'
WITH
(
FIELDTERMINATOR = '\t',
ROWTERMINATOR = '\t'
)
gururajan.k
write an insert trigger that will check for the duplicate value in the table
kshitij kumar
kshitij@krayknot.com
www.krayknot.com
November 10, 2008 at 12:45 am
I think doing the validation in the trigger and returning an error will cause the whole bulkinsert to fail. If this is the behaviour you want then its fine.
Any chance of checking the data before doing bulk insert.
"Keep Trying"
November 10, 2008 at 9:37 pm
You shouldn't ever bulk insert directly into the final table that already has rows in it. Bulk insert into a staging table first, check it for dupes, than then do an insert from that table into the final table while also checking for dupes. It'll be a lot faster than trying to do the same thing with a trigger.
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply