<pre><code>
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
</pre></code>
Here is an example of AppleScript: tell application "Foo" beep end tell