Now,There are two questions in your minds .First,Why did he
want to write the article in english ?.Secondly,what was the reason 🙂
First of all,thank you foreign visitors (especially Russian people) to visit
my blog even though there are so pages that teaching about usage and management of sql server. This article is completely wrote to show my indebtedness. So,I am going to continue to write in turkish,probably you
will not want me to write in english any more :).
In this writing,I will be talking about how we extract the phrases that mistakenly inserted from saved data to table in database. However,Those phrases must be unique pattern,like barcode or passport number or any ID number who belongs anything or etc.
For example ; “Putin HJK-123456784”,
Now,we are preparing for the scenario the script as you see in the first picture. In the script,we created a filter to select unwanted the phrases in the column.
Then,We insert selected rows into a new #temp table. The reason we do that is likely to remove less rows data from table which contains such as 1000 rows data.
In the third steps,We are taking index number by using Charindex function. After we did ;
In this script,If IDNIndex and INNIndex is not equal to zero,firstly there will be saved to alias the data between IDNIndex and third parameter by using the substring function. Then secondly,If the column contains alias,this part is changed with space character by using replace function. Thirdly,Data is saved a new table.
Above picture,you can see the final table has six columns. The first table just has two columns,id and amiradi.
This part is completely optional. We performed a new table contains id and new amiradi columns.
We update #tmpG1 table according to #gecis table. So,we reached our goal in this article.