CREATE FUNCTION dbo.fun_orgname(@id int)RETURNS varchar(8000)AS BEGIN DECLARE @str varchar(8000) SET @str = '' select @str = @str + ',' +r.NAME from PRINCIPAL_ORG t left join ORG r on t.ORG_ID=r.ID where t.PRINCIPAL_ID=@id RETURN STUF…
SQL Server 1创建触发器 GO BEGIN IF (object_id('WMY', 'tr') is not null) DROP trigger WMY END; GO CREATE TRIGGER WMY ON Student Instead of INSERT AS BEGIN INSERT INTO Student (number,name) VALUES (1205,'角色2'); END; --Begin 与end相当于{},是一个语句块,可有可无此处为演示所用 --ON…
SQL Server.Oracle.MySQL和Vertica数据库常用函数对比 Vertica数据库是HP公司新收购的用于BI方面的数据库. 1. 绝对值 S:select abs(-1) value O:select abs(-1) value from dual M:select abs(-1) value from dual V:select abs(-1) 2. 向上取整 S:select ceiling(-1.001) value O:select ceil(-1.001) valu…
1.数据类型不同. sql server 的数据类型 int ,smallint ,char,varchar,nchar,nvarchar,ntext,datetime,smalldatetime,money,decima, float,bit oracle 的数据类型:number(p,s),char,varchar2,Date,LOB 注意:insert into table_name values('1','张三','男',date'2012-3-5'…