0

Suppose that I have one column in SQL from a simple SELECT statement.

How can I modify the text of particular row entries without overwriting the data?

I am looking at indenting some particular entries for a table I am creating in VS (e.g. every entry that is called 'Name' will be changed to ' Name'). So I want to modify my SQL query to change some particular fields to be indented when they are called.

Thanks in advance!

4

2 に答える 2

1

MySQL の場合、replaceを使用できます

SELECT REPLACE(field, 'Name', ' Name')

Oracleの場合、翻訳できます

SELECT TRANSLATE(...). 

CASEステートメントを介して、MySQL と T-SQL の両方でこれを行うこともできます。

于 2012-07-19T00:19:24.570 に答える
0

mysqlで...

UPDATE TABLE_NAME SET NAME = CONCAT(' ', NAME) WHERE ...
于 2012-07-19T00:21:42.083 に答える