tblAuction
[SPOILER2]
/****** Object: Table [dbo].[tblAuction] Script Date: 11/03/2012 14:31:15 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[tblAuction](
[dwId] [char](7) NOT NULL,
[idPlayer] [char](7) NOT NULL,
[nItemNum] [int] NOT NULL,
[szItem] [varchar](1024) NOT NULL,
[nPriceCash] [int] NULL,
[nPricePerin] [int] NULL,
[nPricePenya] [int] NULL,
[szTimeEnd] [char](15) NOT NULL,
[bDirectBuy] [int] NULL,
[idOffer] [char](7) NULL,
[szDesc] [varchar](128) NULL,
[bExtend] [int] NULL,
[bMail] [int] NULL
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
Alles anzeigen
[/SPOILER2]
uspSaveAuction
[SPOILER2]
USE [CHARACTER_01_DBF]
GO
/****** Object: StoredProcedure [dbo].[uspSaveAuction] Script Date: 11/03/2012 14:29:25 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER proc [dbo].[uspSaveAuction]
@dwId CHAR(7),
@szItem VARCHAR(1024) = '$',
@nItemNum int,
@idPlayer CHAR(7),
@nPriceCash int,
@nPricePerin int,
@nPricePenya int,
@szTimeEnd CHAR(15),
@bDirectBuy int,
@bExtend int,
@bMail int,
@idOffer CHAR(7),
@szDesc VARCHAR(128) = '$'
AS
set nocount on
BEGIN
IF EXISTS ( SELECT * FROM tblAuction WHERE idPlayer=@idPlayer AND dwId=@dwId )
BEGIN
UPDATE tblAuction
SET
dwId = @dwId,
szItem = @szItem,
nItemNum = @nItemNum,
idPlayer = @idPlayer,
nPriceCash = @nPriceCash,
nPricePerin = @nPricePerin,
nPricePenya = @nPricePenya,
szTimeEnd = @szTimeEnd,
bDirectBuy = @bDirectBuy,
bExtend = @bExtend,
bMail = @bMail,
idOffer = @idOffer,
szDesc = @szDesc
WHERE idPlayer = @idPlayer AND dwId = @dwId
RETURN
END
ELSE BEGIN
IF EXISTS (SELECT * FROM tblAuction )
SELECT @dwId = RIGHT('0000000' + CONVERT(VARCHAR(7),MAX(dwId)+1),7)
FROM tblAuction
ELSE BEGIN
SELECT @dwId = '0000001'
END
INSERT INTO tblAuction(dwId, szItem,nItemNum,idPlayer,nPriceCash,nPricePerin,nPricePenya,szTimeEnd,bDirectBuy,bExtend,bMail,idOffer,szDesc)
VALUES(@dwId,@szItem, @nItemNum, @idPlayer, @nPriceCash, @nPricePerin, @nPricePenya, @szTimeEnd, @bDirectBuy,@bExtend,@bMail, @idOffer, @szDesc )
SELECT dwId FROM tblAuction WHERE dwId = @dwId
RETURN
END
END
Alles anzeigen
[/SPOILER2]