請教各位先進,資料表某些欄位允許空值(null),是否如下列預儲程序裡的參數段必須宣告 = NULL,若不,是否有其他注意之處。謝謝。(現在是參考原文書如此做,不知其詳)
/*設定多個區域變數,用來配合資料表格欄位所設定的區域變數,*/
/*同時設定符合對應的資料表欄位的資料型態與長度。*/
CREATE PROCEDURE co_Bank_Ins
@IsExist bit,
@BankNo varchar(03),
@BankNameChinese varchar(60),
@BankNameAbb varchar(30) = NULL,
@BankNameEnglish varchar(70) = NULL,
@BankClassify varchar(02),
@BusinessNo varchar(07) = NULL,
@www varchar(50) = NULL,
@email varchar(50) = NULL,
@BAN varchar(08) = NULL,
@Validiation varchar(08) = NULL,
@IsCross bit,
@Cross varchar(02) = NULL,
@SWIFT varchar(10) = NULL,
@TELEX varchar(10 )= NULL,
@GovCode varchar(10) = NULL,
@Remark text = NULL,
@DateCreated datetime = NULL,
@DateModified datetime = NULL
AS
BEGIN TRAN
INSERT tblBankAll
VALUES (
@IsExist,
@BankNo,
@BankNameChinese,
@BankNameAbb,
@BankNameEnglish,
@BankClassify,
@BusinessNo,
@www,
@email,
@BAN,
@Validiation,
@IsCross,
@Cross,
@SWIFT,
@TELEX,
@GovCode,
@Remark,
@DateCreated,
@DateModified)
COMMIT TRAN
IF @@ERROR <> 0
RETURN -1
ELSE
RETURN 0