sql server和asa 比较

本文介绍 SQL Server 中存储过程的创建方法及使用技巧,对比了不同语法风格的特点,并探讨了条件语句、多分支选择及事务处理等内容。
sql server
CREATE procedure dt_tt
as
declare @xx int
set @xx=-1
select @xx=id  from test where getdate() between kc and js
select @xx
GO
asa和上面相同功能的语句 
CREATE procedure dt_tt
begin
declare @xx int
set @xx=-1
select @xx=id  from test where getdate() between kc and js
select @xx
end

没有记录查询到
sql server 结果  -1
asa                null

**后来经重新测试 asa返回结果也是-1


返回记录集来说:
sql server :
select 语句
select 赋值语句除外
asa
select
如果用 select @xx=id 这将返回记录集   @xx列



有些sql  里的条件语句可能用在 if 语句中
is null is not null  xx in ()

sql server 中没有多分支语句,sql 语句中可以用case
asa 有多分支语句

事务处理:(自动开始事务)
asa transcount =0 sql transcount=1

sql server 赋值语句
select @id=id  from table
asa 
select id into @id from table
select @id=id from table ( 也支持)   //有时在触发器中不好用不知道为什么换成上面的就行了

在watcom-sql标准中,要使用分号,if 语句要在end if 后面加';'号
并且赋值语句为   
select colname into @var from table
为transact-sql
select @var=colname from table

不要加分号
注意支持的语句格式如
w_sql if end if;
transact-sql if begin end


 
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值