帮忙看下Sybase数据库游标为什么会报这个错

帮忙看下Sybase数据库游标为什么会报这个错,第1张

declare test_address cursor

for

select address from test

你声明的游标值不唯一;换成下面的语句试试!

declare test_address cursor

for

select distinct address from test

你好,目前目前大型的数据库都采用oracle,中小型的用sqlServer,建议用sqlserver或者mysql。

sybase与sqlsrver的内在区别就是:

1.Sybase没有用户自定义函数

2.判断fetch成功的全局变量是@@SQLstatus,而不是@@fetch_status。

3.没有set,赋值与查询通用select。

4.没有top,返回N行要使用set rowcount N / set rowcount 0

5.raiserror 22009 " "-->raiserror( ' ',16,1)

6.游标一定要在过程中使用,不能单独在查询中使用。

7.销毁游标要加cursor关键字.如:deallocate cursor cur_tmp

8.没有bigint类型。

9.create table #t(id numeric(12,0) identity not null),不支持int型,且不能设置起始值和步进值。

10.不能alter一个存储过程,要先drop掉再create。

11.没有len函数,使用char_length或datalength等效。

12.通过sysindexes中的doampg列可返回某表的行数,rowcnt(doampg) 。

13.convert函数没有120格式(yyyy-mm-dd hh:mm:ss),需要使用select convert(char(4),datepart(year,getdate()))+ '- '+right( '0 '+convert(varchar(2),datepart(month,getdate())),2)+ '- '+right( '0 '+convert(varchar(2),datepart(day,getdate())),2)+ ' '+convert(char(10),getdate(),8)

14.charindex不能从被查找字符串中按指定位置查找某字符串。

15.不能使用rtrim函数将数值型转为字符型。

16.没有cast函数,数值型到字符型转移使用select convert(varchar(10),123)

17.没有replace函数。

18.没有left函数,只有right函数。

19.不支持在字段上加[]。

20.select语句中不支持变量累加,例如:select @SQL=@SQL+colname from tablename

21.在过程及视图中系统会自动将select * 变为select 列1,列2...

22.varchar最大支持16384个字节(SQLServer中是8000) 。

23.Sybase不支持表变量。

24.Sybase不支持instead of触发器。

25.Sybase没有调度(注:定时执行某个 *** 作) 。


欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/sjk/10773592.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-11
下一篇 2023-05-11

发表评论

登录后才能评论

评论列表(0条)

保存