Professional Documents
Culture Documents
go
create table clientes(
id int,
nombre varchar (50),
telefono int,
apellido varchar (50),
correo varchar (50),
primary key (id))
go
select*from clientes
go
create proc sp_registrar
@id int,
@nom varchar(50),
@tel int,
@ape varchar (50),
@cor varchar (50)
as begin
insert into clientes values (@id,@nom,@tel,@ape,@cor)
end
go
create proc sp_mostrar
as begin
select*from clientes
end
go
create proc sp_buscar
@id int
as begin
select*from clientes where id=@id
end
@cod int
as begin
select*from produtos where codigo=@cod
end
create proc Codigos
as begin
declare @nfactura char (5)
set @nfactura = (select MAX(nfactura)from dbo.facturar)
set @nfactura = 'C' +
RIGHT('000'+LTRIM(RIGHT(ISNULL(@nfactura,'000'),4)+1),4)
select @nfactura as nfactura
end