B_Process 表
id,ShipID, Ca
1 H1001 33
2 H1002 44
如果 ca 字段 不包括a 就更新 变成33a,a是我程序过去的变量。
用SQL 实现,包有a就还是 本身字段还是33(ID 1为例)
update B_Process set Ca+'a' where ??? 能用 SQL ’用条件' 实现 就是那个a 在里面 就拼接字符, 33a 下次再传变量 b 就是 33ab 再下次 又a 就是 33ab...
id,ShipID, Ca
1 H1001 33
2 H1002 44
如果 ca 字段 不包括a 就更新 变成33a,a是我程序过去的变量。
用SQL 实现,包有a就还是 本身字段还是33(ID 1为例)
update B_Process set Ca+'a' where ??? 能用 SQL ’用条件' 实现 就是那个a 在里面 就拼接字符, 33a 下次再传变量 b 就是 33ab 再下次 又a 就是 33ab...
解决方案 »
- 建了索引之后count查询速度怎么还是>1秒?
- 求修改条SQL语句,谢谢-就这么多分了,呜呜
- 客户端程序通过"连接串"连接到A数据库,能否以这个连接串操作B数据库呢?(是否可以运行存贮过程,在过程中访问B数据库呢?)
- 如何对总分进行 “排名”
- 请问这种功能的更新语句怎样写?
- sqlserver存储过程的纠结问题
- 没有则插入,有则更新
- sql备份问题
- 我想在SQL Server7上建两个库名不同,但是其它都相同的库,该怎么作呢?
- 有关SQL Server中的用户默认数据库
- sql server两个表的删除问题
- 虚拟机(winserver2003系统)上装了Deamon tools,Sqlserver2000,为什么每次开机时都会出现开始装Sqlserver2000的界
update tb
set ca = ca + (case when charindex('a',ca) > 0 then '' else 'a' end)
-- 'a' 可以换为变量。update tb
set ca = ca + 'a'
where charindex('a',ca) > 0
写错。
-- 'a' 可以换为变量。update tb
set ca = ca + 'a'
where charindex('a',ca) = 0
update B_Process set Cat=Cat+'a' where charindex('a',Cat)=0
set @char='a'
update B_Process set Ca=Ca+@char where charindex(@char,Ca)=0
update B_Process set Cat=substring(Cat,charindex('a',Cat),len('a')) where charindex('a',Cat)=0