插入也记日志的TABLEX COL1 COL2 COL3 COL4 在COL1和COL2上有个复合索引,如果想依据COL1和COL2来更新COL3,应该没有问题吧:)update TABLEX set col3=... where col1=... and col2=... or update TABLEX set col3=... where col1=... or update TABLEX set col3=... where col1>... and col2<... or update TABLEX set col3=... where col1 like 'a%' and col2=... 当然没问题 但 update TABLEX set col3=... where col2=... or update TABLEX set col3=... where col1 like '%a' and col2=... 都有问题update TABLEX set col3=TABLEY.col3 from TABLEX,TABLEY where TABLEX.col1=TABLEY.col1 and TABLEX.col2=TABLEY.col2 如果TABLEY数据多也需要索引
Update语句要比Insert慢很多! update在MSSQLSERVER的实际操作是:DELETE然后INSERT,有没有什么办法让MS SQL SERVER不写日志!? ALTER DATABASE DN_NAME SET RECOVERY SIMPLE
UPDATE是要先定位,而如果表的主键很长或索引建的很复杂的话,是很耗时的,而INSERT不存在这方面的消耗。
COL1 COL2 COL3 COL4
在COL1和COL2上有个复合索引,如果想依据COL1和COL2来更新COL3,应该
COL1 COL2 COL3 COL4
在COL1和COL2上有个复合索引,如果想依据COL1和COL2来更新COL3,应该没有问题吧:)
SQL SERVER中插入不记入日志的是什么命令?
COL1 COL2 COL3 COL4
在COL1和COL2上有个复合索引,如果想依据COL1和COL2来更新COL3,应该没有问题吧:)update TABLEX
set col3=...
where col1=... and col2=...
or
update TABLEX
set col3=...
where col1=...
or
update TABLEX
set col3=...
where col1>... and col2<...
or
update TABLEX
set col3=...
where col1 like 'a%' and col2=...
当然没问题
但
update TABLEX
set col3=...
where col2=...
or
update TABLEX
set col3=...
where col1 like '%a' and col2=...
都有问题update TABLEX
set col3=TABLEY.col3
from TABLEX,TABLEY
where TABLEX.col1=TABLEY.col1 and TABLEX.col2=TABLEY.col2
如果TABLEY数据多也需要索引
update在MSSQLSERVER的实际操作是:DELETE然后INSERT,有没有什么办法让MS SQL SERVER不写日志!?
ALTER DATABASE DN_NAME SET RECOVERY SIMPLE