dbo.carga_usuarios_productos

Description

Properties

Name Value
ANSI Nulls ON

True

Quoted Identifier ON

True

Encrypted

False

Execute As
Assembly

SQL Script

Copy
SET QUOTED_IDENTIFIER, ANSI_NULLS ON
GO

CREATE OR ALTER PROCEDURE dbo.carga_usuarios_productos
AS
BEGIN
    SET NOCOUNT ON;

 update usuarios_productos_2
 set user_id = (select user_id from users where users.cli_codigo = cliente and users.username = login)

 update usuarios_productos_2 set cliente = (select cliente from clientes where cli_codigo = usuarios_productos_2.cliente)
 where exists (select * from clientes where cli_codigo = usuarios_productos_2.cliente)

 insert into usuarios_productos
 select * from usuarios_productos_2 where user_id is not null

 delete from usuarios_productos_2 where user_id is not null

END 

GO

Used By

No items found