SQL Server 2008 Express : find similar records in a table -


here first question sql server 2008 express database, containing articles, quantities, prices , on. unfortunately when loaded data first time loaded articles making following mistake:

i created 2 records (almost) every article similar different character.

here's example:

  • tuto510088.9x3
  • tuto510088,9x3

the different character , , .. there way select these articles delete ones comma , leaving others?

please note position of different character not fixed, on 3rd right, or in middle

you can using self join:

delete t2 tablename t1 join      tablename t2 on replace(t1.article,'.','')=replace(t2.article,',','') t2.article '%,%' 

demo in sql fiddle

you can check records going deleted replacing delete t2 select t2.*


Comments

Popular posts from this blog

python - jinja2: TemplateSyntaxError: expected token ',', got 'string' -

Qt4: how to send QString inside a struct via QSharedMemory -

node.js - NodeJS remote terminal to Dropbear OpenWRT-Server -