當前位置:首頁 » 編程語言 » 批量修改sql
擴展閱讀
webinf下怎麼引入js 2023-08-31 21:54:13
堡壘機怎麼打開web 2023-08-31 21:54:11

批量修改sql

發布時間: 2022-01-23 09:52:50

sql 語句 批量修改

update表名
setC_METHOD_NAME=lower(substring(REPLACE(C_METHOD_NAME,'process',''),1,1))+
substring(REPLACE(C_METHOD_NAME,'process',''),2,len(REPLACE(C_METHOD_NAME,'process','')))
--REPLACE(C_METHOD_NAME,'process','')用空值取代process
--lower改小寫
--lower(substring(REPLACE(C_METHOD_NAME,'process',''),1,1))把取代後字元串的第一個字母改小寫
--再加上後面的字元串

② sql 批量修改數據

--測試數據如下:
SQL>
create
table
temp(a
number,b
varchar2(1),c
varchar2(1));
Table
created
SQL>
insert
into
temp
values(1,'a','a');
1
row
inserted
SQL>
insert
into
temp
values(1,'','');
1
row
inserted
SQL>
insert
into
temp
values(1,'','');
1
row
inserted
SQL>
insert
into
temp
values(2,'e','3');
1
row
inserted
SQL>
insert
into
temp
values(2,'','');
1
row
inserted
SQL>
insert
into
temp
values(2,'','');
1
row
inserted
SQL>
select
*
from
temp;
A
B
C
----------
-
-
1
a
a
1
1
2
e
3
2
2
6
rows
selected
SQL>
SQL>
update
temp
t1
2
set
(b,c)=(select
b,c
from
temp
t2
where
t2.a=t1.a
and
t2.b
is
not
null
and
t2.c
is
not
null)
3
where
t1.b
is
null
and
4
t1.c
is
null;
4
rows
updated
SQL>
select
*
from
temp;
A
B
C
----------
-
-
1
a
a
1
a
a
1
a
a
2
e
3
2
e
3
2
e
3
6
rows
selected

③ 在SQL中,如何批量修改數據

update 表 set 欄位=要加的文字+欄位 where 條件
比如 我要在ceshi表的test_name 前加文字:人世間
update ceshi set test_name='人世間'+ test_name where test_id<20
在查詢分析器運行通過

④ SQL 怎麼批量修改數據表內容

先去空白再替換。如果那個空白是空格就好辦,用函數rtrim,ltrim去空格,如果不是空格
你把sql里的數據粘貼到記事本里,然後再sql的查詢分析器里輸入
select ascii(' 那個空白字元')得到這個空白的ascii碼,接著
update表名 set 欄位名=replace(欄位名,char(剛才得到ascii碼),'')
把空白都去掉之後用你那個語句就可以了。
還有一種本辦法,就是把所有的空白的可能都寫一次,比如 回車是char(13),換行是char(10)等等你就update表名 set 欄位名=replace(欄位名,char(10),'') ,
把所有可能都替換了,就那幾種是空白,情況也不是很多

⑤ Sql批量查詢並修改

update tablename set specialName = replace(specialName,'頻道','xx') where specialName like '%頻道';

⑥ sql 批量修改數據

使用update 更新修改資料庫數據,更改的結果集是多條數據則為批量修改。
語法格式如:
update 表格 set 列 = 更改值 where 篩選條件
例:
update table set a=1 --將table 中所以a列的值改為 1
update table set a=1 where b=2 --將table 中列b=2的記錄中a列的值改為 1

⑦ 關於sql語句如何批量修改數據。

update A表
set 學生年紀 = 『4』
where 學生號 between 1 and 5
or 學生號 between 7 and 11;

純手打,求給分

⑧ SQL批量修改求語句

UPDATE article SET lastchapterid=(SELECT max(chapterid) FROM chapter WHERE articlename=article.articlename)

⑨ sql server sql語句批量修改 如圖

把要修改的圖書的 ID 和 數量 全部提交到後台, 存放在數組里,然後遍歷數組,實現對每條數據的修改

⑩ SQL批量修改欄位

如果「ID」「status」在同一個表裡的話:
update 表A set status='000' where ID in (111,222,123,233,……)

如果「ID」「status」在不在同一個表裡的話,那麼應該2個表之間通過某個欄位關聯的
update 表B set status='000' from 表A,表B where 表A.關聯欄位=表B.關聯欄位 and 表A.ID in (111,222,123,233,……)