if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[客户余额表]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[客户余额表]
GO

CREATE TABLE [dbo].[客户余额表] (
	[id] [int] IDENTITY (1, 1) NOT NULL ,
	[eid] [int] NOT NULL ,
	[充值] [decimal](18, 2) NULL ,
	[消费] [decimal](18, 2) NULL ,
	[余额] [decimal](18, 2) NULL ,
	[可用余额] [decimal](18, 2) NULL ,
	[充值状态] [bit] NULL ,
	[日期] [datetime] NULL 
) ON [PRIMARY]
GO

ALTER TABLE [dbo].[客户余额表] WITH NOCHECK ADD 
	CONSTRAINT [DF_客户余额表_充值] DEFAULT (0) FOR [充值],
	CONSTRAINT [DF_客户余额表_消费] DEFAULT (0) FOR [消费],
	CONSTRAINT [DF_客户余额表_余额] DEFAULT (0) FOR [余额],
	CONSTRAINT [DF_客户余额表_可用余额] DEFAULT (0) FOR [可用余额],
	CONSTRAINT [DF_客户余额表_充值状态] DEFAULT (0) FOR [充值状态],
	CONSTRAINT [DF_客户余额表_日期] DEFAULT (getdate()) FOR [日期],
	CONSTRAINT [PK_客户余额表] PRIMARY KEY  CLUSTERED 
	(
		[id]
	)  ON [PRIMARY] 
GO

