求sql语句
将id号40-50的数据项目分别后移一个,
50->51
49->50
。。。
40->41
SQL code:
select *,id+1 as id2 form table
where id>40 and id<50
后移
帮顶
这样?
SQL code:
update table
set id = id + 1
where id>40 and id<50
SQL code:
update table
set id = id + 1
where id>=40 and id<=50
将id号40-50的数据项目分别后移一个
id name
update table
set name = (selct)
where id>=40 and id <=50
关键是覆盖问题
如果id为主键,就不能更改。
如果id不为主键,那么这个语句就对着呢。
如果是主键可以用临时表
我想插入一项
SQL code
Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighligh
相关问答:
我的Tblworkbill表的数据如下:
id workbillno ..................
1 1
2 6
3 a1
4 c2
5 2
6 aa
7 ......
我要得到一个字符串如:
sdfk|||sgts
sdfsfd|||rgreg
wrfw|||sefw
就是要得到|||后面的字符串,有什么函数吗?怎么用呢?谢谢!
SQL code:
select
right(col,len(col)-charindex('|||',col)-2)
f ......
场景如下:
客户把备份好的数据库,发给我,我在本机还原后,运行写好的存储过程,比较快,并且在实施那边运行同样比较快。但是当实施在客户那边运行的时候速度就非常的慢,时间超出了程序的时间限制。远程在客户那 ......
一、7|3|1,8|6|1,3|1|1,16|1|1,5|7|1,9|7|1
二、6|3|1,7|3|1,8|6|1,2|1|1,3|1|1,16|1|1,4|7|1,5|7|1,9|7|1,10|7|1,11|4|1,12|4|1,13|4|1,14|5|1,15|5|1,17|0|1
怎样查询 一 在 二 里面并输出记录集。
SQL code: ......