Removing the unwanted part of the text contents in the column

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”,
“Medvedev BJK-98765423184”..

b1

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.

2.kısım_

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.

4.kısım

In the third steps,We are taking index number by using Charindex function. After we did ;


5.kısım

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.


6.kısım

Above picture,you can see the final table has six columns. The first table just has two columns,id and amiradi.


7.kısım

This part is completely optional. We performed  a new table contains id and new amiradi columns.

Finally ;

8.kısım

We update #tmpG1 table according to #gecis table.  So,we reached our goal in this article.

Bir Cevap Yazın

Aşağıya bilgilerinizi girin veya oturum açmak için bir simgeye tıklayın:

WordPress.com Logosu

WordPress.com hesabınızı kullanarak yorum yapıyorsunuz. Çıkış  Yap /  Değiştir )

Twitter resmi

Twitter hesabınızı kullanarak yorum yapıyorsunuz. Çıkış  Yap /  Değiştir )

Facebook fotoğrafı

Facebook hesabınızı kullanarak yorum yapıyorsunuz. Çıkış  Yap /  Değiştir )

Connecting to %s