由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Database版 - 求助:sql server 2000, 这句话怎么写?
相关主题
初级问题,关于wildcard请教一个query in mysql
ADO & DAO &SQL...Help...求助:如何ColumName 作为变量放入query
correlated subquery问个问题
问一个关于SQL的问题这个query对么?
[转载] what's wrong with this PL/SQL转换成时间的格式 MS SQL
Access中如何update 100个fields让他们都乘以25%?embedded sql 问题
sql questionOracle新手请教一个问题
ask for helpOracle char AND varchar2 datatype question.
相关话题的讨论汇总
话题: charindex话题: where话题: stuff话题: email话题: char
进入Database版参与讨论
1 (共1页)
A***s
发帖数: 389
1
"UPDATE patient SET name = STUFF(name,CHARINDEX("'",name),1,"`") WHERE
CHARINDEX("'",name) <> 0"
就是找出name这项中的单引号换成反单引号,但这个单引号怎么也价不进去,我该怎么办
啊?谢谢
j*****o
发帖数: 320
2
是不是要\'丫。

【在 A***s 的大作中提到】
: "UPDATE patient SET name = STUFF(name,CHARINDEX("'",name),1,"`") WHERE
: CHARINDEX("'",name) <> 0"
: 就是找出name这项中的单引号换成反单引号,但这个单引号怎么也价不进去,我该怎么办
: 啊?谢谢

A***s
发帖数: 389
3
大哥,那是C

么办

【在 j*****o 的大作中提到】
: 是不是要\'丫。
v**m
发帖数: 242
4
try this one:
UPDATE member SET email = STUFF(email,CHARINDEX('''',email),1,char(96))WHERE
CHARINDEX('''',email) <> 0



【在 A***s 的大作中提到】
: "UPDATE patient SET name = STUFF(name,CHARINDEX("'",name),1,"`") WHERE
: CHARINDEX("'",name) <> 0"
: 就是找出name这项中的单引号换成反单引号,但这个单引号怎么也价不进去,我该怎么办
: 啊?谢谢

A***s
发帖数: 389
5
thx,just got the solution:
UPDATE member SET email = STUFF(email,CHARINDEX(char(39),email),1,'`')WHERE
CHARINDEX(char(39),email) <> 0



【在 v**m 的大作中提到】
: try this one:
: UPDATE member SET email = STUFF(email,CHARINDEX('''',email),1,char(96))WHERE
: CHARINDEX('''',email) <> 0
:
: 办

v**m
发帖数: 242
6
I am glad things work out finally. There are a few question, just curious.
First, how did u add the single quote to the database? I guess it should be
two single quote, that's why you need use char(39) to get it. Second, how can
you put '`' there? copy & paste? I would suggest you use char(96) or correct
char() number.

STUFF(email,CHARINDEX('''',email),1,char(96))WHERE


【在 A***s 的大作中提到】
: thx,just got the solution:
: UPDATE member SET email = STUFF(email,CHARINDEX(char(39),email),1,'`')WHERE
: CHARINDEX(char(39),email) <> 0
:
: 么

p*****e
发帖数: 58
7
In SQL the character ' is used as escape character (plays the same role as \
in C) and quotation mark (similar to " in VB). So all ' in a string should be
replaced by ''.
Example 1: select all the tableName records where companyName is "Sam's Food":
Select * from tableName where companyName = 'Sam''s food'
Example 2: select all recordes where companyName containing ':
Select * from tableName where companyName like '%''%'

can
STUFF(email,CHARINDEX(char(39),email),1,'`')WHERE


【在 v**m 的大作中提到】
: I am glad things work out finally. There are a few question, just curious.
: First, how did u add the single quote to the database? I guess it should be
: two single quote, that's why you need use char(39) to get it. Second, how can
: you put '`' there? copy & paste? I would suggest you use char(96) or correct
: char() number.
:
: STUFF(email,CHARINDEX('''',email),1,char(96))WHERE
: 怎

1 (共1页)
进入Database版参与讨论
相关主题
Oracle char AND varchar2 datatype question.[转载] what's wrong with this PL/SQL
猪一样的队友Access中如何update 100个fields让他们都乘以25%?
How to query a treesql question
mysql索引/优化的一个问题ask for help
初级问题,关于wildcard请教一个query in mysql
ADO & DAO &SQL...Help...求助:如何ColumName 作为变量放入query
correlated subquery问个问题
问一个关于SQL的问题这个query对么?
相关话题的讨论汇总
话题: charindex话题: where话题: stuff话题: email话题: char