Microsoft SQL Server与Sybase内在区别

  Microsoft SQL Server与Sybase的内在区别:

  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没有调度(注:定时执行某个操作) 。

相关日志

Leave a Reply