SlideShare une entreprise Scribd logo
1  sur  3
USE [pventa]
GO
/****** Object: Table [dbo].[users]
Script Date: 09/08/2011 17:27:43 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[users](
[user_login] [nvarchar](50) NOT NULL,
[user_password] [nvarchar](250) NULL,
[nombre] [nvarchar](150) NULL,
[activo] [bit] NOT NULL,
[ventas] [bit] NOT NULL,
[reportes] [bit] NOT NULL,
[administrar] [bit] NOT NULL,
[fecha_registro] [datetime] NOT NULL,
CONSTRAINT [PK_users] PRIMARY KEY CLUSTERED
(
[user_login] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF,
ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object: Table [dbo].[unidad_medida]
Script Date: 09/08/2011 17:27:43
******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[unidad_medida](
[id_unidad_medida] [smallint] NOT NULL,
[unidad_medida] [nvarchar](150) NULL,
CONSTRAINT [PK_unidad_medida] PRIMARY KEY CLUSTERED
(
[id_unidad_medida] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF,
ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object: Table [dbo].[productos]
Script Date: 09/08/2011 17:27:43
******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[productos](
[id_producto] [nvarchar](50) NOT NULL,
[producto] [nvarchar](250) NULL,
[id_unidad_medida] [smallint] NULL,
[p_compra] [float] NULL,
[p_venta] [float] NULL,
[existencia] [float] NULL,
CONSTRAINT [PK_productos] PRIMARY KEY CLUSTERED
(
[id_producto] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF,
ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object: Table [dbo].[venta]
Script Date: 09/08/2011 17:27:43 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[venta](
[id_venta] [int] IDENTITY(1,1) NOT NULL,
[fecha_registro] [datetime] NOT NULL,
[user_login] [nvarchar](50) NOT NULL,
CONSTRAINT [PK_venta] PRIMARY KEY CLUSTERED
(
[id_venta] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF,
ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object: Table [dbo].[venta_detalle_tmp]
Script Date: 09/08/2011
17:27:43 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[venta_detalle_tmp](
[id_venta_detalle_tmp] [int] IDENTITY(1,1) NOT NULL,
[id_producto] [nvarchar](50) NOT NULL,
[cantidad] [float] NOT NULL,
[user_login] [nvarchar](50) NOT NULL,
[p_venta] [float] NOT NULL,
CONSTRAINT [PK_venta_detalle_tmp] PRIMARY KEY CLUSTERED
(
[id_venta_detalle_tmp] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF,
ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object: Table [dbo].[venta_detalle]
Script Date: 09/08/2011 17:27:43
******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[venta_detalle](
[id_venta_detalle] [int] IDENTITY(1,1) NOT NULL,
[id_venta] [int] NOT NULL,
[id_producto] [nvarchar](50) NOT NULL,
[cantidad] [float] NOT NULL,
[p_venta] [float] NOT NULL,
CONSTRAINT [PK_venta_detalle] PRIMARY KEY CLUSTERED
(
[id_venta_detalle] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF,
ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object: Default [DF_users_fecha_registro]
Script Date: 09/08/2011
17:27:43 ******/
ALTER TABLE [dbo].[users] ADD CONSTRAINT [DF_users_fecha_registro] DEFAULT
(getdate()) FOR [fecha_registro]
GO
/****** Object: Default [DF_venta_fecha_registro]
Script Date: 09/08/2011
17:27:43 ******/
ALTER TABLE [dbo].[venta] ADD CONSTRAINT [DF_venta_fecha_registro] DEFAULT
(getdate()) FOR [fecha_registro]
GO
/****** Object: ForeignKey [FK_productos_unidad_medida]
Script Date:
09/08/2011 17:27:43 ******/
ALTER TABLE [dbo].[productos] WITH CHECK ADD CONSTRAINT
[FK_productos_unidad_medida] FOREIGN KEY([id_unidad_medida])
REFERENCES [dbo].[unidad_medida] ([id_unidad_medida])
GO
ALTER TABLE [dbo].[productos] CHECK CONSTRAINT [FK_productos_unidad_medida]
GO
/****** Object: ForeignKey [FK_venta_users]
Script Date: 09/08/2011 17:27:43
******/
ALTER TABLE [dbo].[venta] WITH CHECK ADD CONSTRAINT [FK_venta_users] FOREIGN
KEY([user_login])
REFERENCES [dbo].[users] ([user_login])
GO
ALTER TABLE [dbo].[venta] CHECK CONSTRAINT [FK_venta_users]
GO
/****** Object: ForeignKey [FK_venta_detalle_productos]
Script Date:
09/08/2011 17:27:43 ******/
ALTER TABLE [dbo].[venta_detalle] WITH CHECK ADD CONSTRAINT
[FK_venta_detalle_productos] FOREIGN KEY([id_producto])
REFERENCES [dbo].[productos] ([id_producto])
GO
ALTER TABLE [dbo].[venta_detalle] CHECK CONSTRAINT [FK_venta_detalle_productos]
GO
/****** Object: ForeignKey [FK_venta_detalle_venta]
Script Date: 09/08/2011
17:27:43 ******/
ALTER TABLE [dbo].[venta_detalle] WITH CHECK ADD CONSTRAINT
[FK_venta_detalle_venta] FOREIGN KEY([id_venta])
REFERENCES [dbo].[venta] ([id_venta])
GO
ALTER TABLE [dbo].[venta_detalle] CHECK CONSTRAINT [FK_venta_detalle_venta]
GO
/****** Object: ForeignKey [FK_venta_detalle_tmp_productos]
Script Date:
09/08/2011 17:27:43 ******/
ALTER TABLE [dbo].[venta_detalle_tmp] WITH CHECK ADD CONSTRAINT
[FK_venta_detalle_tmp_productos] FOREIGN KEY([id_producto])
REFERENCES [dbo].[productos] ([id_producto])
GO
ALTER TABLE [dbo].[venta_detalle_tmp] CHECK CONSTRAINT
[FK_venta_detalle_tmp_productos]
GO
/****** Object: ForeignKey [FK_venta_detalle_tmp_users]
Script Date:
09/08/2011 17:27:43 ******/
ALTER TABLE [dbo].[venta_detalle_tmp] WITH CHECK ADD CONSTRAINT
[FK_venta_detalle_tmp_users] FOREIGN KEY([user_login])
REFERENCES [dbo].[users] ([user_login])
GO
ALTER TABLE [dbo].[venta_detalle_tmp] CHECK CONSTRAINT
[FK_venta_detalle_tmp_users]
GO

Contenu connexe

Tendances

Keyboard Access APIs
Keyboard Access APIsKeyboard Access APIs
Keyboard Access APIstoddkloots
 
Crash Course to SQL in PHP
Crash Course to SQL in PHPCrash Course to SQL in PHP
Crash Course to SQL in PHPwebhostingguy
 
Everything you always wanted to know about forms* *but were afraid to ask
Everything you always wanted to know about forms* *but were afraid to askEverything you always wanted to know about forms* *but were afraid to ask
Everything you always wanted to know about forms* *but were afraid to askAndrea Giuliano
 
Building Your First Widget
Building Your First WidgetBuilding Your First Widget
Building Your First WidgetChris Wilcoxson
 
Open Selector
Open SelectorOpen Selector
Open Selectorjjdelc
 
CreacióN Tablas En Oracle
CreacióN Tablas En OracleCreacióN Tablas En Oracle
CreacióN Tablas En Oracleesacre
 
Ruby-ying Javascript: Avoiding jQuery Spaghetti
Ruby-ying Javascript: Avoiding jQuery SpaghettiRuby-ying Javascript: Avoiding jQuery Spaghetti
Ruby-ying Javascript: Avoiding jQuery SpaghettiForrest Chang
 
Taller 3 camilo uribe2308542
Taller 3  camilo uribe2308542Taller 3  camilo uribe2308542
Taller 3 camilo uribe2308542Kmilo U
 
JQuery In Rails
JQuery In RailsJQuery In Rails
JQuery In RailsLouie Zhao
 
Oracle forms 10 j – dynamic color customization 2udfoh community paper-colo...
Oracle forms 10 j – dynamic color customization  2udfoh  community paper-colo...Oracle forms 10 j – dynamic color customization  2udfoh  community paper-colo...
Oracle forms 10 j – dynamic color customization 2udfoh community paper-colo...FITSFSd
 
WordPress 3.1 at DC PHP
WordPress 3.1 at DC PHPWordPress 3.1 at DC PHP
WordPress 3.1 at DC PHPandrewnacin
 

Tendances (20)

PhoneGap: Local Storage
PhoneGap: Local StoragePhoneGap: Local Storage
PhoneGap: Local Storage
 
10. view one record
10. view one record10. view one record
10. view one record
 
11. delete record
11. delete record11. delete record
11. delete record
 
Keyboard Access APIs
Keyboard Access APIsKeyboard Access APIs
Keyboard Access APIs
 
Crash Course to SQL in PHP
Crash Course to SQL in PHPCrash Course to SQL in PHP
Crash Course to SQL in PHP
 
Everything you always wanted to know about forms* *but were afraid to ask
Everything you always wanted to know about forms* *but were afraid to askEverything you always wanted to know about forms* *but were afraid to ask
Everything you always wanted to know about forms* *but were afraid to ask
 
Leveraging Symfony2 Forms
Leveraging Symfony2 FormsLeveraging Symfony2 Forms
Leveraging Symfony2 Forms
 
Building Your First Widget
Building Your First WidgetBuilding Your First Widget
Building Your First Widget
 
Open Selector
Open SelectorOpen Selector
Open Selector
 
CreacióN Tablas En Oracle
CreacióN Tablas En OracleCreacióN Tablas En Oracle
CreacióN Tablas En Oracle
 
12. edit record
12. edit record12. edit record
12. edit record
 
My sql
My sqlMy sql
My sql
 
Ruby-ying Javascript: Avoiding jQuery Spaghetti
Ruby-ying Javascript: Avoiding jQuery SpaghettiRuby-ying Javascript: Avoiding jQuery Spaghetti
Ruby-ying Javascript: Avoiding jQuery Spaghetti
 
Ensayo
EnsayoEnsayo
Ensayo
 
Jquery
JqueryJquery
Jquery
 
Taller 3 camilo uribe2308542
Taller 3  camilo uribe2308542Taller 3  camilo uribe2308542
Taller 3 camilo uribe2308542
 
JQuery In Rails
JQuery In RailsJQuery In Rails
JQuery In Rails
 
Oracle forms 10 j – dynamic color customization 2udfoh community paper-colo...
Oracle forms 10 j – dynamic color customization  2udfoh  community paper-colo...Oracle forms 10 j – dynamic color customization  2udfoh  community paper-colo...
Oracle forms 10 j – dynamic color customization 2udfoh community paper-colo...
 
Taller4
Taller4Taller4
Taller4
 
WordPress 3.1 at DC PHP
WordPress 3.1 at DC PHPWordPress 3.1 at DC PHP
WordPress 3.1 at DC PHP
 

En vedette

Access Governance
Access GovernanceAccess Governance
Access GovernanceFSP GmbH
 
Final Project (Security Analysis Class)
Final Project (Security Analysis Class)Final Project (Security Analysis Class)
Final Project (Security Analysis Class)Ekaterina Kosheleva
 
Les chateaux de la france
Les chateaux de la franceLes chateaux de la france
Les chateaux de la francesrahasel
 
Tramites en comercio exterior y normas origen tlc usa
Tramites en comercio exterior y normas origen tlc usaTramites en comercio exterior y normas origen tlc usa
Tramites en comercio exterior y normas origen tlc usaSantiago Lopez
 
Virtualize with Confidence
Virtualize with ConfidenceVirtualize with Confidence
Virtualize with ConfidenceNetWize
 
Cisco UCS (Unified Computing System)
Cisco UCS (Unified Computing System)Cisco UCS (Unified Computing System)
Cisco UCS (Unified Computing System)NetWize
 
Business-Critical Backup: Preparing for a Disaster
Business-Critical Backup: Preparing for a DisasterBusiness-Critical Backup: Preparing for a Disaster
Business-Critical Backup: Preparing for a DisasterNetWize
 
Sintesis informativa 19 nov 2015
Sintesis informativa 19 nov 2015Sintesis informativa 19 nov 2015
Sintesis informativa 19 nov 2015megaradioexpress
 
Higiene y Seguridad Laboral
Higiene y Seguridad LaboralHigiene y Seguridad Laboral
Higiene y Seguridad LaboralB3lleza Online
 
Location call sheet 5 tk ah ma jg
Location call sheet 5 tk ah ma jgLocation call sheet 5 tk ah ma jg
Location call sheet 5 tk ah ma jgpalomavidal13
 
Ingurune bigarren gaia asier amable
Ingurune bigarren gaia asier amableIngurune bigarren gaia asier amable
Ingurune bigarren gaia asier amabletxutxumutxukat6b04
 

En vedette (16)

Conferència canvi climàtic.ppt
Conferència canvi climàtic.pptConferència canvi climàtic.ppt
Conferència canvi climàtic.ppt
 
Access Governance
Access GovernanceAccess Governance
Access Governance
 
Nutrizino funtzinoa
Nutrizino funtzinoaNutrizino funtzinoa
Nutrizino funtzinoa
 
GSR Earth Day Presentation
GSR Earth Day PresentationGSR Earth Day Presentation
GSR Earth Day Presentation
 
Final Project (Security Analysis Class)
Final Project (Security Analysis Class)Final Project (Security Analysis Class)
Final Project (Security Analysis Class)
 
Les chateaux de la france
Les chateaux de la franceLes chateaux de la france
Les chateaux de la france
 
Tramites en comercio exterior y normas origen tlc usa
Tramites en comercio exterior y normas origen tlc usaTramites en comercio exterior y normas origen tlc usa
Tramites en comercio exterior y normas origen tlc usa
 
GSR Newsletter Issue No. 6 - September 2013
GSR Newsletter Issue No. 6 - September 2013GSR Newsletter Issue No. 6 - September 2013
GSR Newsletter Issue No. 6 - September 2013
 
Virtualize with Confidence
Virtualize with ConfidenceVirtualize with Confidence
Virtualize with Confidence
 
Cisco UCS (Unified Computing System)
Cisco UCS (Unified Computing System)Cisco UCS (Unified Computing System)
Cisco UCS (Unified Computing System)
 
Business-Critical Backup: Preparing for a Disaster
Business-Critical Backup: Preparing for a DisasterBusiness-Critical Backup: Preparing for a Disaster
Business-Critical Backup: Preparing for a Disaster
 
Sintesis informativa 19 nov 2015
Sintesis informativa 19 nov 2015Sintesis informativa 19 nov 2015
Sintesis informativa 19 nov 2015
 
Higiene y Seguridad Laboral
Higiene y Seguridad LaboralHigiene y Seguridad Laboral
Higiene y Seguridad Laboral
 
Location call sheet 5 tk ah ma jg
Location call sheet 5 tk ah ma jgLocation call sheet 5 tk ah ma jg
Location call sheet 5 tk ah ma jg
 
WP4C, caracteristicas
WP4C, caracteristicasWP4C, caracteristicas
WP4C, caracteristicas
 
Ingurune bigarren gaia asier amable
Ingurune bigarren gaia asier amableIngurune bigarren gaia asier amable
Ingurune bigarren gaia asier amable
 

Similaire à Bd venta.sql

Implementation Specifications
Implementation SpecificationsImplementation Specifications
Implementation SpecificationsUnmon Mukherjee
 
Writeable ct es_pgcon_may_2011
Writeable ct es_pgcon_may_2011Writeable ct es_pgcon_may_2011
Writeable ct es_pgcon_may_2011David Fetter
 
Database Development Replication Security Maintenance Report
Database Development Replication Security Maintenance ReportDatabase Development Replication Security Maintenance Report
Database Development Replication Security Maintenance Reportnyin27
 
Introducción rápida a SQL
Introducción rápida a SQLIntroducción rápida a SQL
Introducción rápida a SQLCarlos Hernando
 
A Tour to MySQL Commands
A Tour to MySQL CommandsA Tour to MySQL Commands
A Tour to MySQL CommandsHikmat Dhamee
 
When solid met angular components
When solid met angular componentsWhen solid met angular components
When solid met angular componentsShiri Haim
 
Kevin Bengtson Portfolio
Kevin Bengtson PortfolioKevin Bengtson Portfolio
Kevin Bengtson PortfolioKbengt521
 
Sql vs no sql diponkar paul-april 2020-Toronto PASS
Sql vs no sql   diponkar paul-april 2020-Toronto PASSSql vs no sql   diponkar paul-april 2020-Toronto PASS
Sql vs no sql diponkar paul-april 2020-Toronto PASSDiponkar Paul
 
David Kopal - Write better React with ReasonML - Codemotion Milan 2018
David Kopal - Write better React with ReasonML - Codemotion Milan 2018David Kopal - Write better React with ReasonML - Codemotion Milan 2018
David Kopal - Write better React with ReasonML - Codemotion Milan 2018Codemotion
 
Permissions script for SQL Permissions
Permissions script for SQL PermissionsPermissions script for SQL Permissions
Permissions script for SQL PermissionsTobias Koprowski
 
Database Implementation Final Document
Database Implementation Final DocumentDatabase Implementation Final Document
Database Implementation Final DocumentConor O'Callaghan
 
Simple Strategies for faster knowledge discovery in big data
Simple Strategies for faster knowledge discovery in big dataSimple Strategies for faster knowledge discovery in big data
Simple Strategies for faster knowledge discovery in big dataRitesh Agrawal
 
New Features of SQL Server 2016
New Features of SQL Server 2016New Features of SQL Server 2016
New Features of SQL Server 2016Mir Mahmood
 

Similaire à Bd venta.sql (20)

Database scripts
Database scriptsDatabase scripts
Database scripts
 
Implementation Specifications
Implementation SpecificationsImplementation Specifications
Implementation Specifications
 
Writeable ct es_pgcon_may_2011
Writeable ct es_pgcon_may_2011Writeable ct es_pgcon_may_2011
Writeable ct es_pgcon_may_2011
 
Database Development Replication Security Maintenance Report
Database Development Replication Security Maintenance ReportDatabase Development Replication Security Maintenance Report
Database Development Replication Security Maintenance Report
 
Writeable CTEs: The Next Big Thing
Writeable CTEs: The Next Big ThingWriteable CTEs: The Next Big Thing
Writeable CTEs: The Next Big Thing
 
Borrador del blog
Borrador del blogBorrador del blog
Borrador del blog
 
Uni2
Uni2Uni2
Uni2
 
Introducción rápida a SQL
Introducción rápida a SQLIntroducción rápida a SQL
Introducción rápida a SQL
 
A Tour to MySQL Commands
A Tour to MySQL CommandsA Tour to MySQL Commands
A Tour to MySQL Commands
 
When solid met angular components
When solid met angular componentsWhen solid met angular components
When solid met angular components
 
Chainable datasource
Chainable datasourceChainable datasource
Chainable datasource
 
Kevin Bengtson Portfolio
Kevin Bengtson PortfolioKevin Bengtson Portfolio
Kevin Bengtson Portfolio
 
Sql vs no sql diponkar paul-april 2020-Toronto PASS
Sql vs no sql   diponkar paul-april 2020-Toronto PASSSql vs no sql   diponkar paul-april 2020-Toronto PASS
Sql vs no sql diponkar paul-april 2020-Toronto PASS
 
David Kopal - Write better React with ReasonML - Codemotion Milan 2018
David Kopal - Write better React with ReasonML - Codemotion Milan 2018David Kopal - Write better React with ReasonML - Codemotion Milan 2018
David Kopal - Write better React with ReasonML - Codemotion Milan 2018
 
Optimizando MySQL
Optimizando MySQLOptimizando MySQL
Optimizando MySQL
 
Permissions script for SQL Permissions
Permissions script for SQL PermissionsPermissions script for SQL Permissions
Permissions script for SQL Permissions
 
Database Implementation Final Document
Database Implementation Final DocumentDatabase Implementation Final Document
Database Implementation Final Document
 
Simple Strategies for faster knowledge discovery in big data
Simple Strategies for faster knowledge discovery in big dataSimple Strategies for faster knowledge discovery in big data
Simple Strategies for faster knowledge discovery in big data
 
New Features of SQL Server 2016
New Features of SQL Server 2016New Features of SQL Server 2016
New Features of SQL Server 2016
 
Access 04
Access 04Access 04
Access 04
 

Bd venta.sql

  • 1. USE [pventa] GO /****** Object: Table [dbo].[users] Script Date: 09/08/2011 17:27:43 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE TABLE [dbo].[users]( [user_login] [nvarchar](50) NOT NULL, [user_password] [nvarchar](250) NULL, [nombre] [nvarchar](150) NULL, [activo] [bit] NOT NULL, [ventas] [bit] NOT NULL, [reportes] [bit] NOT NULL, [administrar] [bit] NOT NULL, [fecha_registro] [datetime] NOT NULL, CONSTRAINT [PK_users] PRIMARY KEY CLUSTERED ( [user_login] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] GO /****** Object: Table [dbo].[unidad_medida] Script Date: 09/08/2011 17:27:43 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE TABLE [dbo].[unidad_medida]( [id_unidad_medida] [smallint] NOT NULL, [unidad_medida] [nvarchar](150) NULL, CONSTRAINT [PK_unidad_medida] PRIMARY KEY CLUSTERED ( [id_unidad_medida] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] GO /****** Object: Table [dbo].[productos] Script Date: 09/08/2011 17:27:43 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE TABLE [dbo].[productos]( [id_producto] [nvarchar](50) NOT NULL, [producto] [nvarchar](250) NULL, [id_unidad_medida] [smallint] NULL, [p_compra] [float] NULL, [p_venta] [float] NULL, [existencia] [float] NULL, CONSTRAINT [PK_productos] PRIMARY KEY CLUSTERED ( [id_producto] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] GO /****** Object: Table [dbo].[venta] Script Date: 09/08/2011 17:27:43 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO
  • 2. CREATE TABLE [dbo].[venta]( [id_venta] [int] IDENTITY(1,1) NOT NULL, [fecha_registro] [datetime] NOT NULL, [user_login] [nvarchar](50) NOT NULL, CONSTRAINT [PK_venta] PRIMARY KEY CLUSTERED ( [id_venta] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] GO /****** Object: Table [dbo].[venta_detalle_tmp] Script Date: 09/08/2011 17:27:43 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE TABLE [dbo].[venta_detalle_tmp]( [id_venta_detalle_tmp] [int] IDENTITY(1,1) NOT NULL, [id_producto] [nvarchar](50) NOT NULL, [cantidad] [float] NOT NULL, [user_login] [nvarchar](50) NOT NULL, [p_venta] [float] NOT NULL, CONSTRAINT [PK_venta_detalle_tmp] PRIMARY KEY CLUSTERED ( [id_venta_detalle_tmp] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] GO /****** Object: Table [dbo].[venta_detalle] Script Date: 09/08/2011 17:27:43 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE TABLE [dbo].[venta_detalle]( [id_venta_detalle] [int] IDENTITY(1,1) NOT NULL, [id_venta] [int] NOT NULL, [id_producto] [nvarchar](50) NOT NULL, [cantidad] [float] NOT NULL, [p_venta] [float] NOT NULL, CONSTRAINT [PK_venta_detalle] PRIMARY KEY CLUSTERED ( [id_venta_detalle] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] GO /****** Object: Default [DF_users_fecha_registro] Script Date: 09/08/2011 17:27:43 ******/ ALTER TABLE [dbo].[users] ADD CONSTRAINT [DF_users_fecha_registro] DEFAULT (getdate()) FOR [fecha_registro] GO /****** Object: Default [DF_venta_fecha_registro] Script Date: 09/08/2011 17:27:43 ******/ ALTER TABLE [dbo].[venta] ADD CONSTRAINT [DF_venta_fecha_registro] DEFAULT (getdate()) FOR [fecha_registro] GO /****** Object: ForeignKey [FK_productos_unidad_medida] Script Date: 09/08/2011 17:27:43 ******/ ALTER TABLE [dbo].[productos] WITH CHECK ADD CONSTRAINT [FK_productos_unidad_medida] FOREIGN KEY([id_unidad_medida]) REFERENCES [dbo].[unidad_medida] ([id_unidad_medida])
  • 3. GO ALTER TABLE [dbo].[productos] CHECK CONSTRAINT [FK_productos_unidad_medida] GO /****** Object: ForeignKey [FK_venta_users] Script Date: 09/08/2011 17:27:43 ******/ ALTER TABLE [dbo].[venta] WITH CHECK ADD CONSTRAINT [FK_venta_users] FOREIGN KEY([user_login]) REFERENCES [dbo].[users] ([user_login]) GO ALTER TABLE [dbo].[venta] CHECK CONSTRAINT [FK_venta_users] GO /****** Object: ForeignKey [FK_venta_detalle_productos] Script Date: 09/08/2011 17:27:43 ******/ ALTER TABLE [dbo].[venta_detalle] WITH CHECK ADD CONSTRAINT [FK_venta_detalle_productos] FOREIGN KEY([id_producto]) REFERENCES [dbo].[productos] ([id_producto]) GO ALTER TABLE [dbo].[venta_detalle] CHECK CONSTRAINT [FK_venta_detalle_productos] GO /****** Object: ForeignKey [FK_venta_detalle_venta] Script Date: 09/08/2011 17:27:43 ******/ ALTER TABLE [dbo].[venta_detalle] WITH CHECK ADD CONSTRAINT [FK_venta_detalle_venta] FOREIGN KEY([id_venta]) REFERENCES [dbo].[venta] ([id_venta]) GO ALTER TABLE [dbo].[venta_detalle] CHECK CONSTRAINT [FK_venta_detalle_venta] GO /****** Object: ForeignKey [FK_venta_detalle_tmp_productos] Script Date: 09/08/2011 17:27:43 ******/ ALTER TABLE [dbo].[venta_detalle_tmp] WITH CHECK ADD CONSTRAINT [FK_venta_detalle_tmp_productos] FOREIGN KEY([id_producto]) REFERENCES [dbo].[productos] ([id_producto]) GO ALTER TABLE [dbo].[venta_detalle_tmp] CHECK CONSTRAINT [FK_venta_detalle_tmp_productos] GO /****** Object: ForeignKey [FK_venta_detalle_tmp_users] Script Date: 09/08/2011 17:27:43 ******/ ALTER TABLE [dbo].[venta_detalle_tmp] WITH CHECK ADD CONSTRAINT [FK_venta_detalle_tmp_users] FOREIGN KEY([user_login]) REFERENCES [dbo].[users] ([user_login]) GO ALTER TABLE [dbo].[venta_detalle_tmp] CHECK CONSTRAINT [FK_venta_detalle_tmp_users] GO