sqlserver (生成错误消息并启动会话的错误处理)


ALTER PROCEDURE [U]

@billno varchar(30),
@unit int,
@accfactduantu decimal(18,2)

AS

SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED

IF EXISTS(SELECT 1 FROM b_tyd WHERE unit=@unit AND state>0)

BEGIN

RAISERROR('本单已发车,不能再关联运单了!',16,1)  
    ROLLBACK TRANSACTION tx
    RETURN 0;

END

IF EXISTS(SELECT 1 FROM will_tpl WHERE unit=@unit)

BEGIN

RAISERROR('本单已关联了运单 ,不能再关联运单了!',16,1)  
    ROLLBACK TRANSACTION tx
    RETURN 0;

END

insert into will_tpl(billno,unit,accfactduantu) values(@billno,@unit,@accfactduantu)

UPDATE b_tyd set accfactduantu = @accfactduantu WHERE unit = @unit

Here is an example of AppleScript: tell application "Foo" beep end tell

你可能感兴趣的:(sqlserver (生成错误消息并启动会话的错误处理))