USE [master]
GO
/****** Object:  Database [srgprs]    Script Date: 07/07/2010 00:12:41 ******/
IF NOT EXISTS (SELECT name FROM sys.databases WHERE name = N'srgprs')
BEGIN
	CREATE DATABASE [srgprs] 
END
GO
USE [srgprs]
GO
/****** Object:  Table [dbo].[Pendente]    Script Date: 07/07/2010 00:12:41 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Pendente]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[Pendente](
	[id] [bigint] IDENTITY(1,1) NOT NULL,
	[unitid] [varchar](50) NOT NULL,
	[command] [varchar](300) NULL,
 CONSTRAINT [PK_Pendente] PRIMARY KEY CLUSTERED 
(
	[id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
END
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[RotaHistorico]    Script Date: 07/07/2010 00:12:41 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[RotaHistorico]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[RotaHistorico](
	[ID] [int] IDENTITY(1,1) NOT NULL,
	[UnitID] [bigint] NOT NULL,
	[data] [datetime] NOT NULL,
	[latitude] [float] NOT NULL,
	[longitude] [float] NOT NULL,
	[velocidade] [int] NOT NULL,
	[rumo] [int] NOT NULL,
	[altitude] [float] NOT NULL,
	[satelites] [int] NOT NULL,
	[inputs] [int] NULL,
	[outputs] [int] NULL,
	[customInput_1] [int] NULL,
	[customInput_2] [int] NULL,
	[razaoSMSID] [int] NOT NULL,
 CONSTRAINT [PK_RotaHistorico] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
END
GO
/****** Object:  Table [dbo].[Rota]    Script Date: 07/07/2010 00:12:41 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Rota]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[Rota](
	[ID] [int] IDENTITY(1,1) NOT NULL,
	[UnitID] [bigint] NOT NULL,
	[data] [datetime] NOT NULL,
	[latitude] [float] NOT NULL,
	[longitude] [float] NOT NULL,
	[velocidade] [int] NOT NULL,
	[rumo] [int] NOT NULL,
	[altitude] [float] NOT NULL,
	[satelites] [int] NOT NULL,
	[inputs] [int] NULL,
	[outputs] [int] NULL,
	[customInput_1] [int] NULL,
	[customInput_2] [int] NULL,
	[razaoSMSID] [int] NOT NULL,
 CONSTRAINT [PK_Rota] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
END
GO
