dbo.clientes_usuarios

Description

Properties

Name Value
File Collation
File Group
Filestream File Group
Is Partitioned

False

Partitioned Column
Partition Scheme
File Groups
Filestream Partition Scheme
Filestream File Groups
Heap

True

Full Text Catalog
Full Text
Compression NONE
Row Count (~) 3506
Created 10/1/2007 3:29:33 PM
Last Modified 11/29/2024 7:25:04 PM

Columns

28
Key Name Data Type Length Precision Scale Not Null Identity Rule Default Computed Persisted Description
activo tinyint 1 3 0

False

False

False

created datetime 8 23 3

False

False

False

cliente int 4 10 0

True

False

False

user_id int 4 10 0

True

False

False

last_login datetime 8 23 3

False

False

False

global_view tinyint 1 3 0

False

False

False

enviar_copia_aprobados tinyint 1 3 0

False

False

False

gdl_global_view tinyint 1 3 0

False

False

False

ingreso_solicitudes tinyint 1 3 0

False

False

False

gdl_ingreso_legajos tinyint 1 3 0

False

False

False

modificar_seguimientos tinyint 1 3 0

False

False

False

gdl_modificar_legajos tinyint 1 3 0

False

False

False

acceso_dashboard tinyint 1 3 0

False

False

False

consulta_reportes tinyint 1 3 0

False

False

False

gdl_consulta tinyint 1 3 0

False

False

False

iv_ingresar_busqueda tinyint 1 3 0

False

False

False

iv_consultar_busqueda tinyint 1 3 0

False

False

False

iv_consultar_cuenta tinyint 1 3 0

False

False

False

led_control_acceso tinyint 1 3 0

False

False

False

led_control_contratistas tinyint 1 3 0

False

False

False

led_control_doc tinyint 1 3 0

False

False

False

id_producto int 4 10 0

False

False

False

led_autoriza_exc_acceso tinyint 1 3 0

False

False

False

lista_tipo_legajo varchar 100 0 0

False

False

False

cliente3 int 4 10 0

False

False

False

led_dashboard bit 1 1 0

False

(1)

False

False

led_panel bit 1 1 0

False

(1)

False

False

admin_user bit 1 1 0

True

(0)

False

False

Indexes

1
Key Name Columns Unique Type Description
PK__clientes_usuario__00551192 cliente, user_id

True

Triggers

2
Name ANSI Nulls ON Quoted Identifier ON On Not For Replication Description
tI_clientes_usuarios

True

True

AFTER INSERT

False

tU_clientes_usuarios

True

True

AFTER UPDATE

False

Foreign Keys

2
Name Columns Description
FK__clientes___clien__5629CD9C cliente
FK__clientes___user___4408691A user_id

SQL Script

Copy
CREATE TABLE dbo.clientes_usuarios (
  activo tinyint NULL,
  created datetime NULL,
  cliente int NOT NULL,
  user_id int NOT NULL,
  last_login datetime NULL,
  global_view tinyint NULL,
  enviar_copia_aprobados tinyint NULL,
  gdl_global_view tinyint NULL,
  ingreso_solicitudes tinyint NULL,
  gdl_ingreso_legajos tinyint NULL,
  modificar_seguimientos tinyint NULL,
  gdl_modificar_legajos tinyint NULL,
  acceso_dashboard tinyint NULL,
  consulta_reportes tinyint NULL,
  gdl_consulta tinyint NULL,
  iv_ingresar_busqueda tinyint NULL,
  iv_consultar_busqueda tinyint NULL,
  iv_consultar_cuenta tinyint NULL,
  led_control_acceso tinyint NULL,
  led_control_contratistas tinyint NULL,
  led_control_doc tinyint NULL,
  id_producto int NULL,
  led_autoriza_exc_acceso tinyint NULL,
  lista_tipo_legajo varchar(100) NULL,
  cliente3 int NULL,
  led_dashboard bit NULL DEFAULT (1),
  led_panel bit NULL DEFAULT (1),
  admin_user bit NOT NULL DEFAULT (0),
  PRIMARY KEY NONCLUSTERED (cliente, user_id) WITH (FILLFACTOR = 90)
)
ON [PRIMARY]
GO

SET QUOTED_IDENTIFIER, ANSI_NULLS ON
GO
CREATE OR ALTER trigger dbo.tI_clientes_usuarios on dbo.clientes_usuarios for INSERT as
/* ERwin Builtin Mon Oct 01 10:32:44 2007 */
/* INSERT trigger on clientes_usuarios */
begin
  declare  @numrows int,
           @nullcnt int,
           @validcnt int,
           @errno   int,
           @errmsg  varchar(255)

  select @numrows = @@rowcount
  /* ERwin Builtin Mon Oct 01 10:32:44 2007 */
  /* users R/280 clientes_usuarios ON CHILD INSERT RESTRICT */
  /* ERWIN_RELATION:PARENT_OWNER="", PARENT_TABLE="users"
      CHILD_OWNER="", CHILD_TABLE="clientes_usuarios"
      P2C_VERB_PHRASE="R/280", C2P_VERB_PHRASE="", 
      FK_CONSTRAINT="R_280", FK_COLUMNS="user_id" */

  if
    /* %ChildFK(" or",update) */
    update(user_id)
  begin
    select @nullcnt = 0
    select @validcnt = count(*)
      from inserted,users
        where
          /* %JoinFKPK(inserted,users) */
          inserted.user_id = users.user_id
    /* %NotnullFK(inserted," is null","select @nullcnt = count(*) from inserted where"," and") */
    
    if @validcnt + @nullcnt != @numrows
    begin
      select @errno  = 30002,
             @errmsg = 'Cannot INSERT clientes_usuarios because users does not exist.'
      goto error
    end
  end

  /* ERwin Builtin Mon Oct 01 10:32:44 2007 */
  /* clientes R/279 clientes_usuarios ON CHILD INSERT RESTRICT */
  /* ERWIN_RELATION:PARENT_OWNER="", PARENT_TABLE="clientes"
      CHILD_OWNER="", CHILD_TABLE="clientes_usuarios"
      P2C_VERB_PHRASE="R/279", C2P_VERB_PHRASE="", 
      FK_CONSTRAINT="R_279", FK_COLUMNS="cliente" */

  if
    /* %ChildFK(" or",update) */
    update(cliente)
  begin
    select @nullcnt = 0
    select @validcnt = count(*)
      from inserted,clientes
        where
          /* %JoinFKPK(inserted,clientes) */
          inserted.cliente = clientes.cliente
    /* %NotnullFK(inserted," is null","select @nullcnt = count(*) from inserted where"," and") */
    
    if @validcnt + @nullcnt != @numrows
    begin
      select @errno  = 30002,
             @errmsg = 'Cannot INSERT clientes_usuarios because clientes does not exist.'
      goto error
    end
  end


  /* ERwin Builtin Mon Oct 01 10:32:44 2007 */
  return
error:
    raiserror (@errmsg,@errno,1) 
    rollback transaction
end

GO
CREATE OR ALTER trigger dbo.tU_clientes_usuarios on dbo.clientes_usuarios for UPDATE as
/* ERwin Builtin Mon Oct 01 10:32:44 2007 */
/* UPDATE trigger on clientes_usuarios */
begin
  declare  @numrows int,
           @nullcnt int,
           @validcnt int,
           @inscliente int, 
           @insuser_id int,
           @errno   int,
           @errmsg  varchar(255)

  select @numrows = @@rowcount
  /* ERwin Builtin Mon Oct 01 10:32:44 2007 */
  /* users R/280 clientes_usuarios ON CHILD UPDATE RESTRICT */
  /* ERWIN_RELATION:PARENT_OWNER="", PARENT_TABLE="users"
      CHILD_OWNER="", CHILD_TABLE="clientes_usuarios"
      P2C_VERB_PHRASE="R/280", C2P_VERB_PHRASE="", 
      FK_CONSTRAINT="R_280", FK_COLUMNS="user_id" */

  if
    /* %ChildFK(" or",update) */
    update(user_id)
  begin
    select @nullcnt = 0
    select @validcnt = count(*)
      from inserted,users
        where
          /* %JoinFKPK(inserted,users) */
          inserted.user_id = users.user_id
    /* %NotnullFK(inserted," is null","select @nullcnt = count(*) from inserted where"," and") */
    
    if @validcnt + @nullcnt != @numrows
    begin
      select @errno  = 30007,
             @errmsg = 'Cannot UPDATE clientes_usuarios because users does not exist.'
      goto error
    end
  end

  /* ERwin Builtin Mon Oct 01 10:32:44 2007 */
  /* clientes R/279 clientes_usuarios ON CHILD UPDATE RESTRICT */
  /* ERWIN_RELATION:PARENT_OWNER="", PARENT_TABLE="clientes"
      CHILD_OWNER="", CHILD_TABLE="clientes_usuarios"
      P2C_VERB_PHRASE="R/279", C2P_VERB_PHRASE="", 
      FK_CONSTRAINT="R_279", FK_COLUMNS="cliente" */

  if
    /* %ChildFK(" or",update) */
    update(cliente)
  begin
    select @nullcnt = 0
    select @validcnt = count(*)
      from inserted,clientes
        where
          /* %JoinFKPK(inserted,clientes) */
          inserted.cliente = clientes.cliente
    /* %NotnullFK(inserted," is null","select @nullcnt = count(*) from inserted where"," and") */
    
    if @validcnt + @nullcnt != @numrows
    begin
      select @errno  = 30007,
             @errmsg = 'Cannot UPDATE clientes_usuarios because clientes does not exist.'
      goto error
    end
  end


  /* ERwin Builtin Mon Oct 01 10:32:44 2007 */
  return
error:
    raiserror (@errmsg,@errno,1) 
    rollback transaction
end

GO

ALTER TABLE dbo.clientes_usuarios WITH NOCHECK
  ADD CONSTRAINT FK__clientes___clien__5629CD9C FOREIGN KEY (cliente) REFERENCES dbo.clientes (cliente)
GO

ALTER TABLE dbo.clientes_usuarios WITH NOCHECK
  ADD FOREIGN KEY (user_id) REFERENCES dbo.users (user_id)
GO

Depends On

3