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

CREATE TABLE [SMSRecord]
(
	[Sid] [int] IDENTITY(1,1) NOT NULL,
	[SPhone] [varchar](50) NULL,
	[SCode] [varchar](50) NULL,
	[STime] [datetime] NULL
)

GO

if exists (select * from dbo.sysobjects where id = object_id(N'[SMSServer]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [SMSServer]
GO
CREATE TABLE [SMSServer]
(
	[Sid] [int] IDENTITY(1,1) NOT NULL,
	[ServerName] [varchar](50) NULL,
	[ServerPwd] [varchar](50) NULL,
	[UpHost] [varchar](50) NULL,
	[UpPort] [int] NULL,
	[DownHost] [varchar](50) NULL,
	[DownPort] [int] NULL
) 

GO

if exists (select * from dbo.sysobjects where id = object_id(N'GetSMSRecord') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure GetSMSRecord
GO
CREATE PROCEDURE GetSMSRecord
(
	@sphone int,
	@stime int
)
AS
	--东莞局门户留言本短信验证码检测。根据手机号码查询每天已发送短信的条数
	select * from SMSRecord where SPhone=@sphone and STime > @stime
	
GO

if exists (select * from dbo.sysobjects where id = object_id(N'GetSMSServer') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure GetSMSServer
GO
CREATE PROCEDURE GetSMSServer
(
	@sid int
)
AS
	--东莞局门户的留言本玄武短信接口的服务信息查询
	select * from SMSServer where [Sid]=@sid
	
GO
