搜索
 找回密码
 加入

COUPON_EVENT 存储及表格

ctgwglzc 2009-9-22 18:06:10 1295
  1. /****** Object:  Table [dbo].[COUPON_EVENT]    Script Date: 08/29/2009 05:21:42 ******/
  2. SET ANSI_NULLS ON
  3. GO

  4. SET QUOTED_IDENTIFIER ON
  5. GO

  6. SET ANSI_PADDING ON
  7. GO

  8. CREATE TABLE [dbo].[COUPON_EVENT](
  9. [AccountID] [char](21) NOT NULL,
  10. [CharID] [char](21) NOT NULL,
  11. [CouponID] [char](20) NOT NULL,
  12. [ItemID] [int] NOT NULL,
  13. [ItemCount] [int] NOT NULL,
  14. [RegisterTime] [smalldatetime] NOT NULL,
  15. CONSTRAINT [PK_COUPON_EVENT] PRIMARY KEY CLUSTERED
  16. (
  17. [CouponID] ASC
  18. )WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
  19. ) ON [PRIMARY]

  20. GO

  21. SET ANSI_PADDING ON
  22. GO

  23. ALTER TABLE [dbo].[COUPON_EVENT] ADD  CONSTRAINT [DF_COUPON_EVENT_RegisterTime]  DEFAULT (getdate()) FOR [RegisterTime]
  24. GO
复制代码

4 回复

ctgwglzc
2009-9-22 01:55:58
楼主
点击查看详情
  1. /****** Object:  Table [dbo].[COUPON_SERIAL_LIST]    Script Date: 08/29/2009 05:22:28 ******/
  2. SET ANSI_NULLS ON
  3. GO

  4. SET QUOTED_IDENTIFIER ON
  5. GO

  6. SET ANSI_PADDING ON
  7. GO

  8. CREATE TABLE [dbo].[COUPON_SERIAL_LIST](
  9. [nIndex] [int] NOT NULL,
  10. [strSerialNum] [char](16) NOT NULL,
  11. [nItemNum] [int] NOT NULL,
  12. [sItemCount] [smallint] NOT NULL
  13. ) ON [PRIMARY]

  14. GO

  15. SET ANSI_PADDING ON
  16. GO
复制代码
ctgwglzc
2009-9-22 01:56:17
楼主
  1. CREATE PROCEDURE [dbo].[CHECK_COUPON_EVENT]
  2. @strAccountID  char(21),
  3. @strCouponID  char(21),
  4. @nRet  smallint OUTPUT

  5. AS

  6. DECLARE @Row tinyint

  7. SELECT @Row = COUNT(AccountID) FROM COUPON_EVENT WHERE CouponID = @strCouponID OR  AccountID = @strAccountID

  8. IF @Row = 0
  9. BEGIN
  10.   SET @nRet =  0
  11.   RETURN
  12. END

  13. SET @nRet =  1
复制代码
  1. CREATE PROCEDURE [dbo].[UPDATE_COUPON_EVENT]
  2. @strAccountID  char(21),
  3. @strCharID char(21),
  4. @strCouponID char(20),
  5. @nItemID  int,
  6. @nItemCount  int

  7. AS

  8. BEGIN TRAN  
  9. INSERT INTO COUPON_EVENT (AccountID, CharID, CouponID, ItemID, ItemCount )
  10. VALUES  (@strAccountID, @strCharID, @strCouponID, @nItemID, @nItemCount )

  11. COMMIT TRAN
复制代码
yangwx
2009-9-22 12:42:26
本帖最后由 yangwx 于 2009-9-22 12:50 编辑

都是干啥用滴?????代码似乎不全。
ctgwglzc
2009-9-22 18:06:10
楼主
公服的COUPON活动
高级模式
游客