易截截图软件、单文件、免安装、纯绿色、仅160KB

SQLSERVER外连接符

表A
tmpA:
id     name
00     名字A
01     名字B
02     名字C
03     名字D
04     名字E
tmpB:
id     class
02     班级A
06     班级B
在Microsft SQL SERVER Management Studio 中执行这个语句  select tmpA.id, tmpB.class from tmpA,tmpB where tmpB.id=*tmpA.id;就会报这个错【消息 4147,级别 15,状态 1,第 2 行
此查询使用的不是 ANSI 外部联接运算符("*=" 或 "=*")。若要不进行修改即运行此查询,请使用存储过程 sp_dbcmptlevel 将当前数据库的兼容级别设置为 80 或更低。极力建议使用 ANSI 外部联接运算符(LEFT OUTER JOIN、RIGHT OUTER JOIN)重写此查询。在将来的 SQL Server 版本中,即使在向后兼容模式下,也不支持非 ANSI 联接运算符。】
而从java里调用执行,就可以正常执行。 '不明白为什么?'
<SQLSERVER外连接符为'*',而ORACLE为'+'>
select tmpA.id, tmpB.class from tmpA,tmpB where tmpB.id=*tmpA.id;
语句等价于 select tmpA.id, tmpB.class from tmpA LEFT JOIN tmpB on tmpB.id=tmpA.id
输出结果:
id     class
00     NULL
01     NULL
02     班级A
03     NULL
04     NULL
//////////////
select tmpA.id, tmpB.class from tmpA RIGHT JOIN tmpB on tmpB.id=tmpA.id
输出结果:
id        class
02      班级A
NULL  班级B
//////////////
select tmpA.id, tmpB.class from tmpA FULL JOIN tmpB on tmpB.id=tmpA.id
输出结果:
id         class
00       NULL
01       NULL
02       班级A
03       NULL
04       NULL
NULL   班级B


相关文档:

SQLSERVER附加错误代码823的处理


sqlserver附加数据库错误823的解决方案2008-10-13 15:06sqlserver附加数据库错误823的解决方案一、SQL-Server附加数据库时失败。
1、异常情况:服务器在正常运行的情况下突然断电,导致数据库文件损坏,具体表现是:数据库名后面有“(置疑)”字样。
2、异常分析:关于823错误的 SQL-SERVER 中的帮助:
=== ......

SQLServer 表查询中的 合并查询 合集 差集 交集

use tempdb
go
if (object_id ('t1' ) is not null ) drop table t1
if (object_id ('t2' ) is not null ) drop table t2
go
create table t1 (a int )
insert into t1 select 1 union select 2 union select 3
create table t2 (a int )
insert into t2 select 3 union select 4 union select 5
go
sele ......

sqlserver和oracle常用函数对比

sqlserver和oracle常用函数对比
数学函数
  1.绝对值
  S:select abs(-1) value
  O:select abs(-1) value from dual
  2.取整(大)
  S:select ceiling(-1.001) value
  O:select ceil(-1.001) value from dual
  3.取整(小)
  S:select floor(-1.001) value
  O:select floor(-1.0 ......

sqlserver中批量修改对象所有者

以超级管理员登录系统,然后执行以下脚本就可以批量修改对象所有者。
sp_configure 'allow updates','1'
go
reconfigure with override
go
update sysobjects set uid=1 where uid<>1
go
sp_configure 'allow updates','0'
go
reconfigure with override ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号