
08-09-2008, 14:21
|
|
|
|
חבר מתאריך: 25.06.08
הודעות: 6
|
|
|
sp transaction התיעצות
ככה אני מנסהליצור טרנזקציה פשוטה שתמנע אפשרות לקבלת הודעת שגיאה כל שהיא
כאשר אני מריץ לצורך בדיקה אני בכוונה מריץ כתב במקום מס' סידורי
(על מנת לקבל נתונים למשתנה ERROR) בכוונתי לקבל אתההודעה
The statement has been terminated. וכך לוודא כי הטרנזקציה תפסה את השגיאה
בפועל אני מקבל הודעת שגיאה בלבד של SQL באדום...
ההרצה המלאה….
declare @run int
exec Updata_price_c_discount 'string not P_Sn''
select'bla bla',@run
הפרוצדורה.......
alterproc Updata_price_c_discount
@P_Sn N_code
DECLARE @err int
begintransaction
select @err =@@error
update Prices
set Price = price * 0.75
where Serial_number =@P_Sn
IF @err <> 0
rollbacktransaction
return
else
committransaction
חשוב לצין שחפרתי כבר במדריכים יש כאן משהו בסיסי שאני מפספס
|