updating similar fields in sql server -


Is there a way to search for fields that have the same values ​​in SQL DB? For example, I have more than one lakh record tables where one column has URL values ​​and it is linked to a country column. Earlier I tried to match the URLs which are similar, where it is a zero value for the country as it was able to update using the following:

  UPDATE t1 SET t1 On T2 On T1 as sources of joining as source T1 from source .tountry = t2 source; Tl = t2.url;  

Then I changed the query to use such a word:

  UPDATE t1 SET t1.country = t2 from source to source As T1 JOIN Source T2 On T1 On T1.url = t2.url WHERE t1.url like t2.url;  

When I use the selection statement to find only the record where the URL is like I get the results but the update does not work. A better example is as follows:

All of these are the same domain URLs and I For everyone to avoid doing this manually, we want to update the country's column because it has to do around 200,000.

how about:

  update t1 SET t1.country = T2 source as source from t1 JOIN sources as t1.url on T2 t2.url  

See how you get when you run on your dataset Are ... it can make very bad matches.

At some point you may need to match on some exact matches based on the URL, but I do not know how to do this in a query like this. See this link for information:

Oh, and if all URLs are included

  WHERE left (t1.url, 16) = Left (t1.url, 16)  

This can be reduced by adding more and more to your execution time


Comments

Popular posts from this blog

Eclipse CDT variable colors in editor -

AJAX doesn't send POST query -

wpf - Custom Message Box Advice -