0

I have a field in a table where I store multiple tags separated with comma for example

tag1, tag2, tag3,tag4

I need to replace a single comma with ، for Persian version so that tags will look like

tag1، tag2، tag3،tag4،

I have over three thousand records in the database and tags are stored with either ، or , but I want all of them to be separated with ،.

How can I find and replace all , with ، using SQL.

I am using SQL Server as my database.

Let us say table structure is

Table BLOG

BLOG Table fields

ID int
Title nVarchar(300)
Description nVarchar(500)
Details nVarchar(max)
Date DateTime
Tags nVarchar(300)
Image varchar(60)
CategoryID int
Updated DateTime
Created DateTime
Published Boolean
Jonathan Leffler
  • 730,956
  • 141
  • 904
  • 1,278
Learning
  • 19,469
  • 39
  • 180
  • 373
  • 1
    Read [Is storing a delimited list in a database column really that bad?](http://stackoverflow.com/questions/3653462/is-storing-a-delimited-list-in-a-database-column-really-that-bad), where you will see a lot of reasons why the answer to this question is **Absolutly yes!** – Zohar Peled Jul 04 '16 at 05:58
  • In my case the use is simple i don't need primary key or unique values in this field. it is used for simple search functionality of block. – Learning Jul 04 '16 at 06:23

1 Answers1

1

Have you tried using REPLACE():

Update BLOG
SET Tags = REPLACE(Tags, N',', N'،')

Find and replace with Unicode character(s)

SharK
  • 2,155
  • 1
  • 20
  • 28
Tim Biegeleisen
  • 502,043
  • 27
  • 286
  • 360