关于一个存储过程,菜鸟请求帮助!100分随拿
CREATE PROCEDURE NEW_CHAR
@account varchar(20) ,
@index smallint ,
@id varchar(20) ,
@STR smallint ,
@CON smallint ,
@DEX smallint ,
@VOL smallint ,
@WIS smallint ,
@Skin int ,
@Hair int ,
@Gender smallint ,
@Class tinyint ,
@Face varbinary(10) ,
@Skill varbinary(100) ,
@Item varbinary(1500) ,
@Psi varbinary(100) ,
@Abnormal varbinary(4) ,
@QuickItem varbinary(10) ,
@HP smallint ,
@PP smallint ,
@SP smallint
AS
DECLARE
@BankID varchar(20) ,
@charMaxNum smallint ,
@AccountBankID varchar(20)
SET @charMaxNum = 0 ,@id=@id+ '[A] '
BEGIN TRAN
INSERT INTO GAMEUSER
(
strUserID, sSTR, sCON, sDEX, sVOL, sWIS, iSkin, iHair, sGender, strFace,
sMaxHP, sHP, sMaxPP, sPP, sMaxSP, sSP, byClass, strSkill, strItem, strPsi,
strAbnormal, strQuickItem, sBasicSTR, sBasicCON, sBasicDEX, sBasicVOL, sBasicWIS
)
VALUES
(
@id , -- strUserID
@STR , -- sSTR
@CON , -- sCON
@DEX , -- sDEX
@VOL , -- sVOL
@WIS , -- sWIS
@Skin , -- iSkin
@Hair , -- iHair
@Gender , -- sGender
@Face , -- strFace
@HP , -- sMaxHP
@HP , -- sHP = sMaxHP
@PP , -- sMaxPP
@PP , -- sPP = sMaxPP
@SP , -- sMaxSP
@SP , -- sSP = sMaxSP
@Class , -- byClass
@Skill , -- strSkill
@Item , -- strItem
@Psi , -- strPsi
@Abnormal , -- strAbnormal
@QuickItem , -- strQuickItem
@STR , -- sSTR ??? ????.
@CON , -- sCON
@DEX , -- sDEX
@VOL , -- sVOL
@WIS -- sWIS
)
IF (@index = 0)
BEGIN
UPDATE CHARS SET strChar01 = @id, sCharNum = sCharNum + 1 WHERE strAccount = @account
END
IF (@index = 1)
BEGIN
UPDATE CHARS SET strChar02 = @id, sCharNum = sCharNum + 1 WHERE strAccount = @account
END
IF (@index = 2)
BEGIN
UPDATE CHARS SET strChar03 = @id, sCharNum = sCharNum + 1 WHERE strAccount = @account
END
SELECT @charMaxNum = sCharNum FROM CHARS WHERE strAccount = @account
INSERT INTO USER_BANK(strAccount)