如何更新特定列查询无法正常工作 [英] how to update particular column query not working

查看:56
本文介绍了如何更新特定列查询无法正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在一个专栏(名称:hadith_eng_book)中,我有unicode和英文文本。

意外的unicode文本已复制到Column(hadith_eng_book)。



现在我想用英文文本替换所有unicode文本。

看这里

hadith_eng_book 栏目

值是

苏南伊本Majah

苏南伊本Majah

苏南伊本Majah

苏南伊本Majah
سننابنماجہ这是我不想要的unicode,我想在这里像上面的Sunan Ibn Majah文字

سننابنماجہ

سننابنماجہ



问题很简单

我使用此查询但是当我执行它时。告诉我0行影响



In a column(name :hadith_eng_book) I have unicode and English Text.
Accidentally unicode text have copied to Column(hadith_eng_book).

Now I want to replace all unicode text with english text.
look at here
hadith_eng_book column
values are
Sunan Ibn Majah
Sunan Ibn Majah
Sunan Ibn Majah
Sunan Ibn Majah
سنن ابن ماجہ this is unicode i dont want, I want Sunan Ibn Majah text here like above
سنن ابن ماجہ
سنن ابن ماجہ

question is simple
I use this query but when I execute it. show me 0 rows effected

update [SSDB].[dbo].[Hadiths_old]
 set hadith_eng_book ='Sunan Ibn Majah'
 where hadith_eng_book= 'سنن ابن ماجہ';



i想要与Sunan Ibn Majah取代سننابنماجہ。



现在如何更新?


i want to replace سنن ابن ماجہ with Sunan Ibn Majah.

now how to update ?

推荐答案

首先,请阅读我对该问题的评论。



尝试使用:

First of all, please, read my comment to the question.

Try to use:
DECLARE @NewText NVARCHAR(30)
SET @NewText= N'Sunan Ibn Majah'

DECLARE @OldText NVARCHAR(30)
SET @OldText = N'سنن ابن ماجہ'

update [SSDB].[dbo].[Hadiths_old]
 set hadith_eng_book =@NewText
 where hadith_eng_book= @OldText







MSDN TechNet写道:
MSDN TechNet wrote:

许多代码示例前缀Unicode字符串字母 N 的常量。 如果没有 N 前缀,则字符串将转换为数据库的默认代码页。此默认代码页可能无法识别某些字符。

Many code examples prefix Unicode character string constants with the letter N. Without the N prefix, the string is converted to the default code page of the database. This default code page may not recognize certain characters.





有关更多信息,请参阅:Transact-SQL语法约定(Transact-SQL) [ ^ ]


你应该使用一个简单的程序从sql中更新它br $>


第一个proccess字符串并将其转换为良好格式然后写入或更新到文件或sql
you should use a simple programm to update it from out of sql

first proccess string and convert it to good format then write or update to file or sql


这篇关于如何更新特定列查询无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆