中国开发网: 论坛: 程序员情感CBD: 贴子 451980
空山新雨
一流的存储过程代码...真TM NB, NB大了
/*______________________________________________________________________________*/
/* */
CREATE PROCEDURE dbo.upd_underlying
/* */
/* Input : */
/* ======= */
/* */
@id_udl int,
@ric varchar(50) = null,
@name varchar(255) = null,
@id_type int = null,
@id_sector int = null,
@id_country int = null,
@isin varchar(15) = null,
@mds varchar(15) = null,
@id_stock_exchange int = null,
@id_market int = null,
@id_udl_out int out,
@type varchar(50) = null,
@country varchar(50) = null,
@id_place int,
@login varchar(25),
@password varchar(25)
/* */
/* Return : */
/* ======== */
/* 0 si OK */
/*______________________________________________________________________________*/
AS
BEGIN

DECLARE @localerr int

IF @login IS NULL OR @password IS NULL
BEGIN
RAISERROR ('this action require an authentification ! : %d', 16, 1, 55551)
RETURN 55551
END

IF NOT EXISTS(SELECT(1) FROM LOGIN WHERE login=@login and password=@password)
BEGIN
RAISERROR ('Login or password is/are not correct(s)! : %d', 16, 1, 55551)
RETURN 55551
END

IF NOT EXISTS(SELECT(1) FROM LOGIN WHERE login=@login AND id_place=@id_place)
BEGIN
RAISERROR ('You are not allowed to update underlyings on this place! : %d', 16, 1, 55551)
RETURN 55551
END

IF NOT EXISTS(SELECT(1) FROM LOGIN WHERE login=@login AND id_role=2)
BEGIN
RAISERROR ('You are not allowed to update underyings : %d', 16, 1, 55551)
RETURN 55551
END

相关信息:


欢迎光临本社区,您还没有登录,不能发贴子。请在 这里登录