c# - Check if text column is unique before import -


i have sql database 1 of columns varchar value. value unique, it's not decided me 3rd party application supplies data, it's length undefined , mixture of numbers , letters. should add it's not declared unique in database knowledge can't varchar type?

each week run import of data csv file, however, way know how check if i'm importing unique value loop through each row in database , compare each line in csv file check if corresponding value unique.

obviously inefficient , going worse on time database gets bigger.

i've tried checking google no avail, i'm looking wrong thing though.

any pointers appreciated.

  • application written in c#

look @ running merge command on sql instead of insert, allow explicitly guide action taken on duplicate.

note if unique field indexed unique, searching value o(log(n)) , not o(n). means overall performance inserting n values o(nlog(n)) , not o(nn). n gets large, substantial performance improvement.


Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -