Learning
Learning

Reputation: 20051

Replace comma with with different comma ، in database field

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

Upvotes: 0

Views: 218

Answers (1)

Tim Biegeleisen
Tim Biegeleisen

Reputation: 522752

Have you tried using REPLACE():

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

Find and replace with Unicode character(s)

Upvotes: 1

Related Questions