Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Create Procedure [dbo].[sp_i_programa_semanal] (@BarNom varchar(50),
- @Fecha datetime,
- @h1 numeric (10, 4),
- @h2 numeric (10, 4),
- @h3 numeric (10, 4),
- @h4 numeric (10, 4),
- @h5 numeric (10, 4),
- @h6 numeric (10, 4),
- @h7 numeric (10, 4),
- @h8 numeric (10, 4),
- @h9 numeric (10, 4),
- @h10 numeric (10, 4),
- @h11 numeric (10, 4),
- @h12 numeric (10, 4),
- @h13 numeric (10, 4),
- @h14 numeric (10, 4),
- @h15 numeric (10, 4),
- @h16 numeric (10, 4),
- @h17 numeric (10, 4),
- @h18 numeric (10, 4),
- @h19 numeric (10, 4),
- @h20 numeric (10, 4),
- @h21 numeric (10, 4),
- @h22 numeric (10, 4),
- @h23 numeric (10, 4),
- @h24 numeric (10, 4))
- As
- Begin
- Set nocount on
- Declare @codigo_barra int
- Declare @count_reg int
- --select * from tb_programa_semanal
- --sp_help tb_programa_semanal
- select @codigo_barra = codigo_barra
- from tb_barra
- where descripcion_barra = @BarNom
- select @count_reg = count(*)
- from tb_programa_semanal
- where codigo_barra = @codigo_barra
- and Fecha = @Fecha
- if (@count_reg = 0)
- Begin
- insert into tb_programa_semanal (Codigo_barra,Fecha,FP_h1,FP_h2,FP_h3,FP_h4,FP_h5,FP_h6,
- FP_h7,FP_h8,FP_h9,FP_h10,FP_h11,FP_h12,FP_h13,FP_h14,FP_h15,
- FP_h16,FP_h17,FP_h18,FP_h19,FP_h20,FP_h21,FP_h22,FP_h23,FP_h24)
- values (@codigo_barra,@Fecha,@h1,@h2,@h3,@h4,@h5,@h6,@h7,@h8,@h9,@h10,@h11,@h12,@h13,@h14,
- @h15,@h16,@h17,@h18,@h19,@h20,@h21,@h22,@h23,@h24)
- End --fin if (@count_reg = 0)
- Else
- Begin
- update tb_programa_semanal
- set FP_h1 = @h1,
- FP_h2 = @h2,
- FP_h3 = @h3,
- FP_h4 = @h4,
- FP_h5 = @h5,
- FP_h6 = @h6,
- FP_h7 = @h7,
- FP_h8 = @h8,
- FP_h9 = @h9,
- FP_h10 = @h10,
- FP_h11 = @h11,
- FP_h12 = @h12,
- FP_h13 = @h13,
- FP_h14 = @h14,
- FP_h15 = @h15,
- FP_h16 = @h16,
- FP_h17 = @h17,
- FP_h18 = @h18,
- FP_h19 = @h19,
- FP_h20 = @h20,
- FP_h21 = @h21,
- FP_h22 = @h22,
- FP_h23 = @h23,
- FP_h24 = @h24
- where codigo_barra = @codigo_barra
- and Fecha = @Fecha
- End --fin else
Add Comment
Please, Sign In to add comment