i cant import a database from sql server to phpmyadmin , error 1064 , plz heeelp : consulta SQL: Documentación
USE [master] GO CREATE DATABASE [sistema de ventas] ON PRIMARY ( NAME = N'sistema de ventas', FILENAME = N'C:\MSSQL10.SQLEXPRESS56\MSSQL\DATA\sistema de ventas.mdf' , SIZE = 3072KB , MAXSIZE = UNLIMITED, FILEGROWTH = 1024KB ) LOG ON ( NAME = N'sistema de ventas_log', FILENAME = N'C:\MSSQL10.SQLEXPRESS56\MSSQL\DATA\sistema de ventas_log.ldf' , SIZE = 1024KB , MAXSIZE = 2048GB , FILEGROWTH = 10%) GO ALTER DATABASE [sistema de ventas] SET COMPATIBILITY_LEVEL = 100 GO IF (1 = FULLTEXTSERVICEPROPERTY('IsFullTextInstalled')) begin EXEC [sistema de ventas].[dbo].[sp_fulltext_database] @action = 'enable' end GO ALTER DATABASE [sistema de ventas] SET ANSI_NULL_DEFAULT OFF GO ALTER DATABASE [sistema de ventas] SET ANSI_NULLS OFF GO ALTER DATABASE [sistema de ventas] SET ANSI_PADDING OFF GO ALTER DATABASE [sistema de ventas] SET ANSI_WARNINGS OFF GO ALTER DATABASE [sistema de ventas] SET ARITHABORT OFF GO ALTER DATABASE [sistema de ventas] SET AUTO_CLOSE OFF GO ALTER DATABASE [sistema de ventas] SET AUTO_SHRINK OFF GO ALTER DATABASE [sistema de ventas] SET AUTO_UPDATE_STATISTICS ON GO ALTER DATABASE [sistema de ventas] SET CURSOR_CLOSE_ON_COMMIT OFF GO ALTER DATABASE [sistema de ventas] SET CURSOR_DEFAULT GLOBAL GO ALTER DATABASE [sistema de ventas] SET CONCAT_NULL_YIELDS_NULL OFF GO ALTER DATABASE [sistema de ventas] SET NUMERIC_ROUNDABORT OFF GO ALTER DATABASE [sistema de ventas] SET QUOTED_IDENTIFIER OFF GO ALTER DATABASE [sistema de ventas] SET RECURSIVE_TRIGGERS OFF GO ALTER DATABASE [sistema de ventas] SET DISABLE_BROKER GO ALTER DATABASE [sistema de ventas] SET AUTO_UPDATE_STATISTICS_ASYNC OFF GO ALTER DATABASE [sistema de ventas] SET DATE_CORRELATION_OPTIMIZATION OFF GO ALTER DATABASE [sistema de ventas] SET TRUSTWORTHY OFF GO ALTER DATABASE [sistema de ventas] SET ALLOW_SNAPSHOT_ISOLATION OFF GO ALTER DATABASE [sistema de ventas] SET PARAMETERIZATION SIMPLE GO ALTER DATABASE [sistema de ventas] SET READ_COMMITTED_SNAPSHOT OFF GO ALTER DATABASE [sistema de ventas] SET HONOR_BROKER_PRIORITY OFF GO ALTER DATABASE [sistema de ventas] SET RECOVERY SIMPLE GO ALTER DATABASE [sistema de ventas] SET MULTI_USER GO ALTER DATABASE [sistema de ventas] SET PAGE_VERIFY CHECKSUM GO ALTER DATABASE [sistema de ventas] SET DB_CHAINING OFF GO USE [sistema de ventas] GO /****** Object: Table [dbo].[articulo] Script Date: 25/12/2018 7:52:44 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_PADDING ON GO CREATE TABLE [dbo].[articulo]( [idarticulo] [int] IDENTITY(1,1) NOT NULL, [codigo] [varchar](50) NOT NULL, [nombre] [varchar](50) NOT NULL, [descripcion] [varchar](3000) NOT NULL, [proveedor] [varchar](50) NOT NULL, [idcategoria] [int] NOT NULL, [idpresentacion] [int] NOT NULL, CONSTRAINT [PK_artc] PRIMARY KEY CLUSTERED ( [idarticulo] 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 SET ANSI_PADDING OFF GO /****** Object: Table [dbo].[categoria] Script Date: 25/12/2018 7:52:44 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_PADDING ON GO CREATE TABLE [dbo].[categoria]( [idcategoria] [int] IDENTITY(1,1) NOT NULL, [nombre] [varchar](50) NOT NULL, [descripcion] [varchar](50) NOT NULL, CONSTRAINT [PK_categori] PRIMARY KEY CLUSTERED ( [idcategoria] 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 SET ANSI_PADDING OFF GO /****** Object: Table [dbo].[detalle_venta] Script Date: 25/12/2018 7:52:44 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE TABLE [dbo].[detalle_venta]( [iddetalle_venta] [int] IDENTITY(1,1) NOT NULL, [idventa] [int] NOT NULL, [iddetalle_ingreso] [int] NOT NULL, [cantidad] [int] NOT NULL, [precio_venta] [money] NOT NULL, [descuento] [money] NOT NULL, CONSTRAINT [PK_detalle_vent] PRIMARY KEY CLUSTERED ( [iddetalle_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].[detalleingreso] Script Date: 25/12/2018 7:52:44 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE TABLE [dbo].[detalleingreso]( [iddetalle_ingreso] [int] IDENTITY(1,1) NOT NULL, [idingreso] [int] NOT NULL, [idarticulo] [int] NOT NULL, [precio_compra] [money] NOT NULL, [precio_venta] [money] NOT NULL, [stockinicial] [int] NOT NULL, [stockactual] [int] NOT NULL, CONSTRAINT [PK_detalleingre] PRIMARY KEY CLUSTERED ( [iddetalle_ingreso] 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].[ingreso] Script Date: 25/12/2018 7:52:44 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_PADDING ON GO CREATE TABLE [dbo].[ingreso]( [idingreso] [int] IDENTITY(1,1) NOT NULL, [idtrabajador] [int] NOT NULL, [tipo_comprobante] [varchar](50) NOT NULL, [serie] [varchar](50) NOT NULL, [correlativo] [varchar](50) NOT NULL, [igv] [varchar](50) NOT NULL, [fecha] [date] NOT NULL, [estado] [varchar](7) NULL, CONSTRAINT [PK_ingresooo] PRIMARY KEY CLUSTERED ( [idingreso] 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 SET ANSI_PADDING OFF GO /****** Object: Table [dbo].[presentacion] Script Date: 25/12/2018 7:52:44 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_PADDING ON GO CREATE TABLE [dbo].[presentacion]( [idpresentacion] [int] IDENTITY(1,1) NOT NULL, [nombre] [varchar](50) NOT NULL, [descripcion] [varchar](50) NOT NULL, CONSTRAINT [PK_Table_1] PRIMARY KEY CLUSTERED ( [idpresentacion] 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 SET ANSI_PADDING OFF GO /****** Object: Table [dbo].[Table_2] Script Date: 25/12/2018 7:52:44 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_PADDING ON GO CREATE TABLE [dbo].[Table_2]( [idcliente] [int] IDENTITY(1,1) NOT NULL, [nombre] [varchar](50) NOT NULL, [apellido] [varchar](50) NOT NULL, [sexo] [varchar](50) NOT NULL, [fecha_nacimiento] [date] NOT NULL, [numdocumento] [varchar](50) NOT NULL, [direccion] [varchar](50) NULL, [telefono] [varchar](50) NULL, [email] [varchar](50) NULL, CONSTRAINT [PK_Table_22] PRIMARY KEY CLUSTERED ( [idcliente] 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 SET ANSI_PADDING OFF GO /****** Object: Table [dbo].[trabajador] Script Date: 25/12/2018 7:52:44 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_PADDING ON GO CREATE TABLE [dbo].[trabajador]( [idtrabajador] [int] IDENTITY(1,1) NOT NULL, [nombre] [varchar](50) NULL, [apellido] [varchar](50) NULL, [sexo] [varchar](50) NULL, [fecha_nac] [date] NULL, [num_documento] [varchar](50) NULL, [direccion] [varchar](150) NULL, [telefono] [varchar](50) NULL, [email] [varchar](50) NULL, [acceso] [varchar](50) NOT NULL, [usuario] [varchar](50) NOT NULL, [password] [varchar](50) NOT NULL, CONSTRAINT [PK_trabajad] PRIMARY KEY CLUSTERED ( [idtrabajador] 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 SET ANSI_PADDING OFF GO /****** Object: Table [dbo].[venta] Script Date: 25/12/2018 7:52:44 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_PADDING ON GO CREATE TABLE [dbo].[venta]( [idventa] [int] IDENTITY(1,1) NOT NULL, [idcliente] [int] NOT NULL, [idtrabajador] [int] NOT NULL, [fecha] [date] NOT NULL, [serie] [varchar](50) NOT NULL, [correlativo] [varchar](50) NOT NULL, [tipo_comprobante] [varchar](50) NOT NULL, [igv] [decimal](4, 2) NOT NULL, CONSTRAINT [PK_venta] PRIMARY KEY CLUSTERED ( [idventa] 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 SET ANSI_PADDING OFF GO   SET IDENTITY_INSERT [dbo].[venta] OFF ALTER TABLE [dbo].[articulo] WITH CHECK ADD CONSTRAINT [FK_artc_categori] FOREIGN KEY([idcategoria]) REFERENCES [dbo].[categoria] ([idcategoria]) GO ALTER TABLE [dbo].[articulo] CHECK CONSTRAINT [FK_artc_categori] GO ALTER TABLE [dbo].[articulo] WITH CHECK ADD CONSTRAINT [FK_articulo_presentacion] FOREIGN KEY([idpresentacion]) REFERENCES [dbo].[presentacion] ([idpresentacion]) GO ALTER TABLE [dbo].[articulo] CHECK CONSTRAINT [FK_articulo_presentacion] GO ALTER TABLE [dbo].[detalle_venta] WITH CHECK ADD CONSTRAINT [FK_detalle_venta_detalleingreso] FOREIGN KEY([iddetalle_ingreso]) REFERENCES [dbo].[detalleingreso] ([iddetalle_ingreso]) GO ALTER TABLE [dbo].[detalle_venta] CHECK CONSTRAINT [FK_detalle_venta_detalleingreso] GO ALTER TABLE [dbo].[detalle_venta] WITH CHECK ADD CONSTRAINT [FK_detalle_venta_venta] FOREIGN KEY([idventa]) REFERENCES [dbo].[venta] ([idventa]) GO ALTER TABLE [dbo].[detalle_venta] CHECK CONSTRAINT [FK_detalle_venta_venta] GO ALTER TABLE [dbo].[detalleingreso] WITH CHECK ADD CONSTRAINT [FK_detalleingre_artc] FOREIGN KEY([idarticulo]) REFERENCES [dbo].[articulo] ([idarticulo]) GO ALTER TABLE [dbo].[detalleingreso] CHECK CONSTRAINT [FK_detalleingre_artc] GO ALTER TABLE [dbo].[detalleingreso] WITH CHECK ADD CONSTRAINT [FK_detalleingreso_ingreso] FOREIGN KEY([idingreso]) REFERENCES [dbo].[ingreso] ([idingreso]) GO ALTER TABLE [dbo].[detalleingreso] CHECK CONSTRAINT [FK_detalleingreso_ingreso] GO ALTER TABLE [dbo].[ingreso] WITH CHECK ADD CONSTRAINT [FK_ingreso_trabajador] FOREIGN KEY([idtrabajador]) REFERENCES [dbo].[trabajador] ([idtrabajador]) GO ALTER TABLE [dbo].[ingreso] CHECK CONSTRAINT [FK_ingreso_trabajador] GO ALTER TABLE [dbo].[venta] WITH CHECK ADD CONSTRAINT [FK_venta_Table_2] FOREIGN KEY([idcliente]) REFERENCES [dbo].[Table_2] ([idcliente]) GO ALTER TABLE [dbo].[venta] CHECK CONSTRAINT [FK_venta_Table_2] GO /****** Object: StoredProcedure [dbo].[mpsyp] Script Date: 25/12/2018 7:52:44 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO create proc [dbo].[mpsyp] @textobuscar int as select a.nombre as Articulo, di.stockactual ,d.precio_venta from detalle_venta d inner join detalleingreso di on d.iddetalle_ingreso=di.iddetalle_ingreso inner join articulo a on di.idarticulo=a.idarticulo inner join venta v on v.idventa = d.idventa where a.nombre=@textobuscar GO /****** Object: StoredProcedure [dbo].[spanular_ingreso] Script Date: 25/12/2018 7:52:44 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO --Procedimiento anular Ingreso create proc [dbo].[spanular_ingreso] @idingreso int as update ingreso set estado='ANULADO' where idingreso=@idingreso GO /****** Object: StoredProcedure [dbo].[spbuscar_articulo_nombre] Script Date: 25/12/2018 7:52:44 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO -- Procedimiento Buscar Artículo Nombre CREATE proc [dbo].[spbuscar_articulo_nombre] @textobuscar varchar(50) as SELECT articulo.idarticulo,articulo.codigo,articulo.nombre, articulo.descripcion,articulo.idcategoria, categoria.nombre AS Categoria, articulo.idpresentacion, presentacion.nombre AS Presentacion, articulo.proveedor FROM articulo INNER JOIN categoria ON dbo.articulo.idcategoria = dbo.categoria.idcategoria INNER JOIN presentacion ON articulo.idpresentacion = presentacion.idpresentacion where articulo.nombre like @textobuscar + '%' GO /****** Object: StoredProcedure [dbo].[spbuscar_categoria_nombre] Script Date: 25/12/2018 7:52:44 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO -- Procedimiento Buscar Categoría Nombre create proc [dbo].[spbuscar_categoria_nombre] @textobuscar varchar(50) as select * from categoria where nombre like @textobuscar + '%' GO /****** Object: StoredProcedure [dbo].[spbuscar_cliente_apellidos] Script Date: 25/12/2018 7:52:44 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO -- Procedimiento Buscar Cliente Apellidos CREATE proc [dbo].[spbuscar_cliente_apellidos] @textobuscar varchar(50) as SELECT * FROM Table_2 where apellido like @textobuscar + '%' GO /****** Object: StoredProcedure [dbo].[spbuscar_cliente_num_documento] Script Date: 25/12/2018 7:52:44 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO -- Procedimiento Buscar Cliente Num Documento CREATE proc [dbo].[spbuscar_cliente_num_documento] @textobuscar varchar(8) as SELECT * FROM Table_2 where numdocumento like @textobuscar + '%' GO /****** Object: StoredProcedure [dbo].[spbuscar_ingreso_fecha] Script Date: 25/12/2018 7:52:44 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE proc [dbo].[spbuscar_ingreso_fecha] -- Procedimiento Buscar ingreso por fecha @textobuscar varchar(50), @textobuscar2 varchar(50) as SELECT i.idingreso, (t.apellido +' '+ t.nombre) as Trabajador, i.fecha, i.tipo_comprobante, i.serie, i.correlativo, i.estado, sum(d.precio_compra* d.stockinicial) as Total,i.igv FROM detalleingreso d INNER JOIN ingreso i ON d.idingreso = i.idingreso INNER JOIN trabajador t ON i.idtrabajador = t.idtrabajador group by i.idingreso, t.apellido +' '+ t.nombre, i.fecha, i.tipo_comprobante, i.serie, i.correlativo, i.estado,i.igv having i.fecha>=@textobuscar and i.fecha<=@textobuscar2 GO /****** Object: StoredProcedure [dbo].[spbuscar_presentacion_nombre] Script Date: 25/12/2018 7:52:44 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO -- Procedimiento Buscar Presentación Nombre create proc [dbo].[spbuscar_presentacion_nombre] @textobuscar varchar(50) as select * from presentacion where nombre like @textobuscar + '%' GO /****** Object: StoredProcedure [dbo].[spbuscar_trabajador_apellidos] Script Date: 25/12/2018 7:52:44 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO -- Procedimiento Buscar Trabajador Apellidos create proc [dbo].[spbuscar_trabajador_apellidos] @textobuscar varchar(50) as SELECT * FROM trabajador where apellido like @textobuscar + '%' GO /****** Object: StoredProcedure [dbo].[spbuscar_trabajador_num_documento] Script Date: 25/12/2018 7:52:44 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO -- Procedimiento Buscar Trababajador Num Documento create proc [dbo].[spbuscar_trabajador_num_documento] @textobuscar varchar(8) as SELECT * FROM trabajador where num_documento like @textobuscar + '%' GO /****** Object: StoredProcedure [dbo].[spbuscar_venta_fecha] Script Date: 25/12/2018 7:52:44 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO -- Procedimiento Buscar venta por fecha CREATE proc [dbo].[spbuscar_venta_fecha] @textobuscar varchar(50), @textobuscar2 varchar(50) as SELECT v.idventa, (t.apellido +' '+ t.nombre) as Trabajador, (c.apellido + ' ' + c.nombre) as Cliente, v.fecha, v.tipo_comprobante, v.serie, v.correlativo,v.igv, sum((d.precio_venta* d.cantidad)-d.descuento) as Total FROM detalle_venta d INNER JOIN venta v ON d.idventa = v.idventa INNER JOIN Table_2 c ON v.idcliente = c.idcliente INNER JOIN trabajador t ON v.idtrabajador = t.idtrabajador group by v.idventa, t.apellido +' '+ t.nombre, c.apellido+' '+c.nombre, v.fecha, v.tipo_comprobante, v.serie, v.correlativo , v.igv having v.fecha>=@textobuscar and v.fecha<=@textobuscar2 GO /****** Object: StoredProcedure [dbo].[spbuscararticulo_venta_codigo] Script Date: 25/12/2018 7:52:44 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO --Mostrar Artículos para la venta por Código CREATE proc [dbo].[spbuscararticulo_venta_codigo] @textobuscar varchar(50) as select a.Idarticulo,a.Codigo,a.Nombre,c.nombre as Categoria, p.nombre as Presentacion,d.stockactual,d.precio_compra, d.precio_venta from articulo a inner join categoria c on a.idcategoria=c.idcategoria inner join presentacion p on a.idpresentacion = p.idpresentacion inner join detalleingreso d on a.idarticulo=d.idarticulo inner join ingreso i on i.idingreso=d.idingreso where a.codigo=@textobuscar and d.stockactual>0 and i.estado<>'ANULADO' GO /****** Object: StoredProcedure [dbo].[spbuscararticulo_venta_nombre] Script Date: 25/12/2018 7:52:44 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO --Mostrar Artículos para la venta por nombre CREATE proc [dbo].[spbuscararticulo_venta_nombre] @textobuscar varchar(50) as select d.iddetalle_ingreso,a.Codigo,a.Nombre,c.nombre as Categoria, p.nombre as Presentacion,d.stockactual,d.precio_compra, d.precio_venta from articulo a inner join categoria c on a.idcategoria=c.idcategoria inner join presentacion p on a.idpresentacion = p.idpresentacion inner join detalleingreso d on a.idarticulo=d.idarticulo inner join ingreso i on i.idingreso=d.idingreso where a.nombre like @textobuscar + '%' and d.stockactual>0 and i.estado<>'ANULADO' GO /****** Object: StoredProcedure [dbo].[spdisminuir_stock] Script Date: 25/12/2018 7:52:44 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO --Procedimiento almacenado para disminuir stock CREATE proc [dbo].[spdisminuir_stock] @iddetalle_ingreso int, @cantidad int as update detalleingreso set stockactual=stockactual-@cantidad where iddetalle_ingreso=@iddetalle_ingreso GO /****** Object: StoredProcedure [dbo].[speditar_articulo] Script Date: 25/12/2018 7:52:44 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO -- Procedimiento Editar Artículo CREATE proc [dbo].[speditar_articulo] @idarticulo int output, @codigo varchar(50), @nombre varchar(50), @descripcion varchar(1024), @prov varchar(150), @idcategoria int , @idpresentacion int as update articulo set codigo=@codigo,nombre=@nombre, descripcion=@descripcion,proveedor=@prov, idcategoria=@idcategoria, idpresentacion=@idpresentacion where idarticulo=@idarticulo GO /****** Object: StoredProcedure [dbo].[speditar_categoria] Script Date: 25/12/2018 7:52:44 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO -- Procedimiento Editar Categoría CREATE proc [dbo].[speditar_categoria] @idcategoria int , @nombre varchar(50), @descripcion varchar(256) as update categoria set nombre=@nombre, descripcion=@descripcion where idcategoria=@idcategoria GO /****** Object: StoredProcedure [dbo].[speditar_cliente] Script Date: 25/12/2018 7:52:44 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO -- Procedimiento Editar Cliente CREATE proc [dbo].[speditar_cliente] @idcliente int, @nombre varchar(20), @apellidos varchar(40), @sexo varchar(1), @fecha_nacimiento date, @num_documento varchar(8), @direccion varchar(100), @telefono varchar(10), @email varchar(50) as update Table_2 set nombre=@nombre,apellido=@apellidos,sexo=@sexo, fecha_nacimiento=@fecha_nacimiento, numdocumento=@num_documento, direccion=@direccion,telefono=@telefono,email=@email where idcliente=@idcliente GO /****** Object: StoredProcedure [dbo].[speditar_presentacion] Script Date: 25/12/2018 7:52:44 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO -- Procedimiento Editar Presentación create proc [dbo].[speditar_presentacion] @idpresentacion int, @nombre varchar(50), @descripcion varchar(256) as update presentacion set nombre=@nombre, descripcion=@descripcion where idpresentacion=@idpresentacion GO /****** Object: StoredProcedure [dbo].[speditar_trabajador] Script Date: 25/12/2018 7:52:44 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO -- Procedimiento Editar Trabajador CREATE proc [dbo].[speditar_trabajador] @idtrabajador int, @nombre varchar(20), @apellidos varchar(40), @sexo varchar(1), @fecha_nacimiento date, @num_documento varchar(8), @direccion varchar(100), @telefono varchar(10), @email varchar(50), @acceso varchar (20), @usuario varchar (20), @password varchar(20) as update trabajador set nombre=@nombre,apellido=@apellidos,sexo=@sexo, fecha_nac=@fecha_nacimiento, num_documento=@num_documento, direccion=@direccion,telefono=@telefono,email=@email, acceso=@acceso,usuario=@usuario,password=@password where idtrabajador=@idtrabajador GO /****** Object: StoredProcedure [dbo].[speliminar_articulo] Script Date: 25/12/2018 7:52:44 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO -- Procedimiento Eliminar Artículo create proc [dbo].[speliminar_articulo] @idarticulo int as delete from articulo where idarticulo=@idarticulo GO /****** Object: StoredProcedure [dbo].[speliminar_categoria] Script Date: 25/12/2018 7:52:44 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO -- Procedimiento Eliminar Categoría create proc [dbo].[speliminar_categoria] @idcategoria int as delete from categoria where idcategoria=@idcategoria GO /****** Object: StoredProcedure [dbo].[speliminar_cliente] Script Date: 25/12/2018 7:52:44 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO -- Procedimiento Eliminar Cliente CREATE proc [dbo].[speliminar_cliente] @idcliente int as delete from Table_2 where idcliente=@idcliente GO /****** Object: StoredProcedure [dbo].[speliminar_presentacion] Script Date: 25/12/2018 7:52:44 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO -- Procedimiento Eliminar Presentación create proc [dbo].[speliminar_presentacion] @idpresentacion int as delete from presentacion where idpresentacion=@idpresentacion GO /****** Object: StoredProcedure [dbo].[speliminar_trabajador] Script Date: 25/12/2018 7:52:44 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO -- Procedimiento Eliminar Trabajador create proc [dbo].[speliminar_trabajador] @idtrabajador int as delete from trabajador where idtrabajador=@idtrabajador GO /****** Object: StoredProcedure [dbo].[speliminar_venta] Script Date: 25/12/2018 7:52:44 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO --Procedimiento eliminar venta create proc [dbo].[speliminar_venta] @idventa int as delete from venta where idventa=@idventa GO /****** Object: StoredProcedure [dbo].[spinsertar_articulo] Script Date: 25/12/2018 7:52:44 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE proc [dbo].[spinsertar_articulo] @idarticulo int output, @codigo varchar(50), @nombre varchar(50), @descripcion varchar(1024), @prov varchar(150), @idcategoria int, @idpresentacion int as insert into articulo(codigo,nombre,descripcion,proveedor,idcategoria,idpresentacion) values ( @codigo,@nombre,@descripcion,@prov,@idcategoria,@idpresentacion) GO /****** Object: StoredProcedure [dbo].[spinsertar_categoria] Script Date: 25/12/2018 7:52:44 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE proc [dbo].[spinsertar_categoria] @idcategoria int output, @nombre varchar(50), @descripcion varchar(256) as insert into categoria (nombre,descripcion) values (@nombre,@descripcion) GO /****** Object: StoredProcedure [dbo].[spinsertar_cliente] Script Date: 25/12/2018 7:52:44 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO  /****** Object: StoredProcedure [dbo].[spinsertar_detalle_ingreso] Script Date: 25/12/2018 7:52:44 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO --Procedimiento Insertar detalles de los ingresos CREATE proc [dbo].[spinsertar_detalle_ingreso] @iddetalle_ingreso int output, @idingreso int, @idarticulo int, @precio_compra money, @precio_venta money, @stock_inicial int, @stock_actual int as insert into detalleingreso (idingreso,idarticulo,precio_compra, precio_venta,stockinicial,stockactual) values (@idingreso,@idarticulo,@precio_compra, @precio_venta,@stock_inicial,@stock_actual) GO /****** Object: StoredProcedure [dbo].[spinsertar_detalle_venta] Script Date: 25/12/2018 7:52:44 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO --Procedimiento Insertar detalles de las ventas create proc [dbo].[spinsertar_detalle_venta] @iddetalle_venta int output, @idventa int, @iddetalle_ingreso int, @cantidad int, @precio_venta money, @descuento money as insert into detalle_venta (idventa,iddetalle_ingreso,cantidad, precio_venta,descuento) values (@idventa,@iddetalle_ingreso,@cantidad, @precio_venta,@descuento) GO /****** Object: StoredProcedure [dbo].[spinsertar_ingreso] Script Date: 25/12/2018 7:52:44 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO -- Procedimiento Insertar ingreso CREATE proc [dbo].[spinsertar_ingreso] @idingreso int=null output, @idtrabajador int, @fecha date, @tipo_comprobante varchar(20), @serie varchar(4), @correlativo varchar(7), @igv decimal(4,2), @estado varchar(7) as insert into ingreso(idtrabajador,fecha,tipo_comprobante,serie,correlativo,igv,estado) values (@idtrabajador,@fecha,@tipo_comprobante,@serie,@correlativo,@igv,@estado) --Obteniendo el codigo autogenerado del ingreso SET @idingreso = @@IDENTITY GO /****** Object: StoredProcedure [dbo].[splogin] Script Date: 25/12/2018 7:52:44 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO /****** Object: StoredProcedure [dbo].[spmostrar_categoria] Script Date: 25/12/2018 7:52:44 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO --Procedimiento Mostrar create proc [dbo].[spmostrar_categoria] as select * from categoria order by idcategoria desc GO /****** Object: StoredProcedure [dbo].[spmostrar_cliente] Script Date: 25/12/2018 7:52:44 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO --Procedimiento Mostrar Cliente CREATE proc [dbo].[spmostrar_cliente] as SELECT top 100 * FROM Table_2 order by apellido asc GO /****** Object: StoredProcedure [dbo].[spmostrar_detalle_ingreso] Script Date: 25/12/2018 7:52:44 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO --mostrar detalle de los ingresos CREATE proc [dbo].[spmostrar_detalle_ingreso] @textobuscar int as select d.idarticulo,a.nombre as Articulo,d.precio_compra, d.precio_venta,d.stockinicial,d.stockactual,i.igv, (d.stockinicial*d.precio_compra) as Subtotal from detalleingreso d inner join articulo a on d.idarticulo=a.idarticulo inner join ingreso i on i.idingreso = d.idingreso where d.idingreso=@textobuscar GO /****** Object: StoredProcedure [dbo].[spmostrar_detalle_venta] Script Date: 25/12/2018 7:52:44 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO --mostrar detalle de las ventas CREATE proc [dbo].[spmostrar_detalle_venta] @textobuscar int as select d.iddetalle_ingreso,a.nombre as Articulo, d.cantidad,d.precio_venta,d.descuento, ((d.precio_venta*d.cantidad)-d.descuento) as Subtotal,v.igv from detalle_venta d inner join detalleingreso di on d.iddetalle_ingreso=di.iddetalle_ingreso inner join articulo a on di.idarticulo=a.idarticulo inner join venta v on v.idventa = d.idventa where d.idventa=@textobuscar GO /****** Object: StoredProcedure [dbo].[spmostrar_ingreso] Script Date: 25/12/2018 7:52:44 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE proc [dbo].[spmostrar_ingreso] as SELECT top 100 i.idingreso, (t.apellido +' '+ t.nombre) as Trabajador, i.fecha, i.tipo_comprobante, i.serie, i.correlativo,i.igv, i.estado, sum(d.precio_compra* d.stockinicial) as Total FROM detalleingreso d INNER JOIN ingreso i ON d.idingreso = i.idingreso INNER JOIN trabajador t ON i.idtrabajador = t.idtrabajador group by i.idingreso, t.apellido +' '+ t.nombre, i.fecha, i.tipo_comprobante, i.serie, i.correlativo, i.estado,i.igv order by i.idingreso desc GO /****** Object: StoredProcedure [dbo].[spmostrar_presentacion] Script Date: 25/12/2018 7:52:44 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO --Procedimiento Mostrar create proc [dbo].[spmostrar_presentacion] as select * from presentacion order by idpresentacion desc GO /****** Object: StoredProcedure [dbo].[spmostrar_trabajador] Script Date: 25/12/2018 7:52:44 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO --Procedimiento Mostrar Trabajador create proc [dbo].[spmostrar_trabajador] as SELECT * FROM trabajador order by apellido asc GO /****** Object: StoredProcedure [dbo].[spmostrar_venta] Script Date: 25/12/2018 7:52:44 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO --Procedimiento Mostrar Venta CREATE proc [dbo].[spmostrar_venta] as SELECT top 100 v.idventa, (t.apellido +' '+ t.nombre) as Trabajador, (c.apellido + ' ' + c.nombre) as cliente, v.fecha, v.tipo_comprobante, v.serie, v.correlativo,v.igv, sum((d.precio_venta* d.cantidad)-d.descuento) as Total FROM detalle_venta d INNER JOIN venta v ON d.idventa = v.idventa INNER JOIN table_2 c ON v.idcliente = c.idcliente INNER JOIN trabajador t ON v.idtrabajador = t.idtrabajador group by v.idventa, t.apellido +' '+ t.nombre, c.apellido+' '+c.nombre, v.fecha, v.tipo_comprobante, v.serie, v.correlativo,v.igv order by v.idventa desc GO /****** Object: StoredProcedure [dbo].[spreporte_venta] Script Date: 25/12/2018 7:52:44 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE proc [dbo].[spreporte_venta] @idventa int as SELECT v.idventa, (t.apellido +' '+ t.nombre) as Trabajador, (c.apellido + ' ' + c.nombre) as Table_2, c.direccion,c.telefono,c.numdocumento, v.fecha, v.tipo_comprobante, v.serie, v.correlativo, v.estado,a.nombre,v.igv, d.precio_venta,d.cantidad,d.descuento FROM detalle_venta d inner join detalleingreso di on d.iddetalle_ingreso=di.iddetalle_ingreso inner join articulo a on di.idarticulo=a.idarticulo INNER JOIN venta v ON d.idventa = v.idventa INNER JOIN Table_2 c ON v.idcliente = c.idcliente INNER JOIN trabajador t ON v.idtrabajador = t.idtrabajador where v.idventa=@idventa GO USE [master] GO ALTER DATABASE [sistema de ventas] SET READ_WRITE GO
MySQL ha dicho: Documentación
#1064 - Algo está equivocado en su sintax cerca '[master]
GO
CREATE DATABASE [sistema de ventas] ON  PRIMARY 
( NAME = N's' en la linea 1