sql脚本 [英] sql script

查看:77
本文介绍了sql脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何更改文本字符串中的字符。我有一堆数字

,其中包含一个小写的l,我需要将它们设为大写L.

示例; 99l5555需要99L5555。

How can I change a character in a string of text. I have a bunch number
that have a lower case l in them and I need to make them an uppercase L.
Example; 99l5555 needs to be 99L5555.

推荐答案

Brian(b.********@eaglecrusher.com)写道:
Brian (b.********@eaglecrusher.com) writes:

如何更改文本字符串中的字符。我有一堆数字

,其中包含一个小写的l,我需要将它们设为大写L.

示例; 99l5555需要99L5555。
How can I change a character in a string of text. I have a bunch number
that have a lower case l in them and I need to make them an uppercase L.
Example; 99l5555 needs to be 99L5555.



UPDATE tbl

SET col = replace(col,''l'',''L'')


或者如果还有其他小写也应该是大写的:


UPDATE tbl SET col = upper(col)


-

Erland Sommarskog,SQL Server MVP, es****@sommarskog.se


SQL Server 2005联机丛书
http://www.microsoft.com/technet/pro...ads/books.mspx

联机丛书SQL版服务器2000在
http://www.microsoft .com / sql / prodinf ... ons / books.mspx

UPDATE tbl
SET col = replace(col, ''l'', ''L'')

Or if there other lowercase as well that should be uppercase:

UPDATE tbl SET col = upper(col)

--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx


我一定做错了,这是我的错误。


消息547,级别16,状态0,行3

UPDATE语句冲突d带有REFERENCE约束

" FK_GL_TrnsLne_IMA"。冲突发生在数据库EAGLE,表格

dbo.GL_TrnsLne,列''GLL_ItmID''。

该声明已被终止。


" Brian" < b。******** @ eaglecrusher.com写信息

news:46 ********************* ** @ roadrunner.com ...
I must be doing something wrong, this is my error.

Msg 547, Level 16, State 0, Line 3
The UPDATE statement conflicted with the REFERENCE constraint
"FK_GL_TrnsLne_IMA". The conflict occurred in database "EAGLE", table
"dbo.GL_TrnsLne", column ''GLL_ItmID''.
The statement has been terminated.

"Brian" <b.********@eaglecrusher.comwrote in message
news:46***********************@roadrunner.com...

如何更改文本字符串中的字符。我有一堆数字

,其中包含一个小写的l,我需要将它们设为大写L.

示例; 99l5555需要是99L5555。
How can I change a character in a string of text. I have a bunch number
that have a lower case l in them and I need to make them an uppercase L.
Example; 99l5555 needs to be 99L5555.



在你的第二个例子中,在这种情况下,单词upper指的是L。

好​​像那只用L替换那一列中的所有内容?

对不起,我是一个新手,并且试图保持谨慎。


Erland Sommarskog < es **** @ sommarskog.sewrote in message

news:Xn ********************** @ 127.0.0.1 ...
In your second example, is the word upper referring to a L in this case.
Seems like that would just replace everything in that column with an L?
Sorry, Im kind of a newby and trying to be cautious.

"Erland Sommarskog" <es****@sommarskog.sewrote in message
news:Xn**********************@127.0.0.1...

Brian(b.********@eaglecrusher.com)写道:
Brian (b.********@eaglecrusher.com) writes:

>如何更改文本字符串中的字符。我有一堆数字
其中有一个小写的l我需要让它们成为大写字母L.
示例; 99l5555需要99L5555。
>How can I change a character in a string of text. I have a bunch number
that have a lower case l in them and I need to make them an uppercase L.
Example; 99l5555 needs to be 99L5555.



UPDATE tbl

SET col = replace(col,''l'',''L'')


或者如果还有其他小写也应该是大写的:


UPDATE tbl SET col = upper(col)


-

Erland Sommarskog,SQL Server MVP, es****@sommarskog.se


SQL Server 2005联机丛书
http://www.microsoft.com/technet/pro...ads/books.mspx

联机丛书SQL版服务器2000在
http://www.microsoft .com / sql / prodinf ... ons / books.mspx



这篇关于sql脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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