dbo.clientes

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 Clientes
Full Text PK__clientes__7E6CC920
Compression NONE
Row Count (~) 15104
Created 11/9/2017 6:11:10 PM
Last Modified 11/30/2024 5:55:14 PM

Columns

64
Key Name Data Type Length Precision Scale Not Null Identity Rule Default Computed Persisted Description
cliente int 4 10 0

True

False

False

nombre_cliente varchar 200 0 0

False

False

False

country_code varchar 2 0 0

False

False

False

identificador varchar 10 0 0

False

False

False

numero varchar 50 0 0

False

False

False

domicilio_legal varchar 200 0 0

False

False

False

telefonos varchar 100 0 0

False

False

False

cuit varchar 50 0 0

False

False

False

website varchar 100 0 0

False

False

False

contacto varchar 50 0 0

False

False

False

email varchar 100 0 0

False

False

False

estado_cliente varchar 1 0 0

False

False

False

cliente_desde smalldatetime 4 16 0

False

False

False

lista_creditos tinyint 1 3 0

False

False

False

tolerancia_creditos smallint 2 5 0

False

False

False

domicilio_pagos varchar 100 0 0

False

False

False

localidad_pagos varchar 50 0 0

False

False

False

cp_pagos varchar 100 0 0

False

False

False

provincia_pagos varchar 30 0 0

False

False

False

contacto_pagos varchar 50 0 0

False

False

False

telefono_pagos varchar 30 0 0

False

False

False

email_pagos varchar 100 0 0

False

False

False

comentarios text 0 0

False

False

False

created datetime 8 23 3

False

(getdate())

False

False

created_by int 4 10 0

False

False

False

modified datetime 8 23 3

False

False

False

modified_by int 4 10 0

False

False

False

enviar_mail_informe tinyint 1 3 0

False

False

False

acceso_informes varchar 1 0 0

False

False

False

acceso_gdl tinyint 1 3 0

False

False

False

texto_documentacion text 0 0

False

False

False

nombre_alternativo varchar 200 0 0

False

False

False

contacto_comercial int 4 10 0

False

False

False

contacto_tecnico int 4 10 0

False

False

False

acceso_iv tinyint 1 3 0

False

False

False

ACCESO_LED tinyint 1 3 0

False

(0)

False

False

ACCESO_ci tinyint 1 3 0

False

(0)

False

False

led_bcc_email_cliente tinyint 1 3 0

False

False

False

led_bcc_email_custom tinyint 1 3 0

False

False

False

led_email_custom varchar 100 0 0

False

False

False

loc_codigo int 4 10 0

False

False

False

prv_codigo varchar 1 0 0

False

False

False

pai_codigo int 4 10 0

False

False

False

cli_resiva tinyint 1 3 0

False

False

False

cli_codigo int 4 10 0

False

False

False

ram_codigo int 4 10 0

False

False

False

sra_codigo int 4 10 0

False

False

False

ven_codigo smallint 2 5 0

False

False

False

e_mail_factura varchar 200 0 0

False

False

False

contacto_2 varchar 50 0 0

False

False

False

led_email_rechazo_contr tinyint 1 3 0

False

False

False

comprador_nombre varchar 100 0 0

False

False

False

comprador_cargo varchar 100 0 0

False

False

False

comprador_telefonos varchar 100 0 0

False

False

False

comprador_email varchar 100 0 0

False

False

False

led_notificaciones_contr tinyint 1 3 0

False

(0)

False

False

iv_notificar_admin tinyint 1 3 0

True

(0)

False

False

ID int 4 10 0

True

2147267528 - 1

False

False

id_padron int 4 10 0

False

False

False

contacto_1 varchar 50 0 0

False

False

False

te_1 varchar 50 0 0

False

False

False

email_1 varchar 100 0 0

False

False

False

te_2 varchar 50 0 0

False

False

False

email_2 varchar 100 0 0

False

False

False

Indexes

6
Key Name Columns Unique Type Description
idx_clientes_cuit_ram_codigo cuit

False

idx_clientes_ram_codigo ram_codigo

False

idxClientesRamCodigo ram_codigo

False

idxImperiumClientes estado_cliente, ACCESO_LED

False

PK__clientes__7E6CC920 cliente

True

XIE1clientes nombre_cliente

False

Triggers

3
Name ANSI Nulls ON Quoted Identifier ON On Not For Replication Description
tD_clientes

True

True

AFTER DELETE

False

tI_clientes

True

True

AFTER INSERT

False

tU_clientes

True

True

AFTER UPDATE

False

Foreign Keys

1
Name Columns Description
FK__clientes__countr__5441852A country_code

SQL Script

Copy
CREATE TABLE dbo.clientes (
  cliente int NOT NULL,
  nombre_cliente varchar(200) NULL,
  country_code varchar(2) NULL,
  identificador varchar(10) NULL,
  numero varchar(50) NULL,
  domicilio_legal varchar(200) NULL,
  telefonos varchar(100) NULL,
  cuit varchar(50) NULL,
  website varchar(100) NULL,
  contacto varchar(50) NULL,
  email varchar(100) NULL,
  estado_cliente varchar(1) NULL,
  cliente_desde smalldatetime NULL,
  lista_creditos tinyint NULL,
  tolerancia_creditos smallint NULL,
  domicilio_pagos varchar(100) NULL,
  localidad_pagos varchar(50) NULL,
  cp_pagos varchar(100) NULL,
  provincia_pagos varchar(30) NULL,
  contacto_pagos varchar(50) NULL,
  telefono_pagos varchar(30) NULL,
  email_pagos varchar(100) NULL,
  comentarios text NULL,
  created datetime NULL CONSTRAINT DF_clientes_created DEFAULT (getdate()),
  created_by int NULL,
  modified datetime NULL,
  modified_by int NULL,
  enviar_mail_informe tinyint NULL,
  acceso_informes varchar(1) NULL,
  acceso_gdl tinyint NULL,
  texto_documentacion text NULL,
  nombre_alternativo varchar(200) NULL,
  contacto_comercial int NULL,
  contacto_tecnico int NULL,
  acceso_iv tinyint NULL,
  ACCESO_LED tinyint NULL CONSTRAINT DF__clientes__ACCESO__162258AF DEFAULT (0),
  ACCESO_ci tinyint NULL CONSTRAINT DF__clientes__ACCESO__17167CE8 DEFAULT (0),
  led_bcc_email_cliente tinyint NULL,
  led_bcc_email_custom tinyint NULL,
  led_email_custom varchar(100) NULL,
  loc_codigo int NULL,
  prv_codigo varchar(1) NULL,
  pai_codigo int NULL,
  cli_resiva tinyint NULL,
  cli_codigo int NULL,
  ram_codigo int NULL,
  sra_codigo int NULL,
  ven_codigo smallint NULL,
  e_mail_factura varchar(200) NULL,
  contacto_2 varchar(50) NULL,
  led_email_rechazo_contr tinyint NULL,
  comprador_nombre varchar(100) NULL,
  comprador_cargo varchar(100) NULL,
  comprador_telefonos varchar(100) NULL,
  comprador_email varchar(100) NULL,
  led_notificaciones_contr tinyint NULL CONSTRAINT DF__clientes__led_no__31CE67A8 DEFAULT (0),
  iv_notificar_admin tinyint NOT NULL DEFAULT (0),
  ID int IDENTITY (2147267528, 1),
  id_padron int NULL,
  contacto_1 varchar(50) NULL,
  te_1 varchar(50) NULL,
  email_1 varchar(100) NULL,
  te_2 varchar(50) NULL,
  email_2 varchar(100) NULL,
  CONSTRAINT PK__clientes__7E6CC920 PRIMARY KEY NONCLUSTERED (cliente) WITH (FILLFACTOR = 80)
)
ON [PRIMARY]
TEXTIMAGE_ON [PRIMARY]
GO

CREATE INDEX idx_clientes_cuit_ram_codigo
  ON dbo.clientes (cuit)
  INCLUDE (ram_codigo)
  WITH (FILLFACTOR = 80)
  ON [PRIMARY]
GO

CREATE INDEX idx_clientes_ram_codigo
  ON dbo.clientes (ram_codigo)
  INCLUDE (cuit)
  WITH (FILLFACTOR = 80)
  ON [PRIMARY]
GO

CREATE INDEX idxClientesRamCodigo
  ON dbo.clientes (ram_codigo)
  INCLUDE (cli_codigo)
  WITH (FILLFACTOR = 80)
  ON [PRIMARY]
GO

CREATE INDEX idxImperiumClientes
  ON dbo.clientes (estado_cliente, ACCESO_LED)
  INCLUDE (cliente, nombre_cliente)
  WITH (FILLFACTOR = 80)
  ON [PRIMARY]
GO

CREATE INDEX XIE1clientes
  ON dbo.clientes (nombre_cliente)
  WITH (FILLFACTOR = 80)
  ON [PRIMARY]
GO

SET QUOTED_IDENTIFIER, ANSI_NULLS ON
GO
CREATE OR ALTER trigger dbo.tD_clientes on dbo.clientes for DELETE as
/* ERwin Builtin Mon Oct 01 10:32:44 2007 */
/* DELETE trigger on clientes */
begin
  declare  @errno   int,
           @errmsg  varchar(255)
    /* ERwin Builtin Mon Oct 01 10:32:44 2007 */
    /* clientes R/279 clientes_usuarios ON PARENT DELETE 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 exists (
      select * from deleted,clientes_usuarios
      where
        /*  %JoinFKPK(clientes_usuarios,deleted," = "," and") */
        clientes_usuarios.cliente = deleted.cliente
    )
    begin
      select @errno  = 30001,
             @errmsg = 'Cannot DELETE clientes because clientes_usuarios exists.'
      goto error
    end

    /* ERwin Builtin Mon Oct 01 10:32:44 2007 */
    /* clientes R/263 tipos_informe ON PARENT DELETE SET NULL */
    /* ERWIN_RELATION:PARENT_OWNER="", PARENT_TABLE="clientes"
        CHILD_OWNER="", CHILD_TABLE="tipos_informe"
        P2C_VERB_PHRASE="R/263", C2P_VERB_PHRASE="", 
        FK_CONSTRAINT="R_263", FK_COLUMNS="cliente" */

    update tipos_informe
      set
        /* %SetFK(tipos_informe,NULL) */
        tipos_informe.cliente = NULL
      from tipos_informe,deleted
      where
        /* %JoinFKPK(tipos_informe,deleted," = "," and") */
        tipos_informe.cliente = deleted.cliente

    /* ERwin Builtin Mon Oct 01 10:32:44 2007 */
    /* clientes R/254 contratos ON PARENT DELETE SET NULL */
    /* ERWIN_RELATION:PARENT_OWNER="", PARENT_TABLE="clientes"
        CHILD_OWNER="", CHILD_TABLE="contratos"
        P2C_VERB_PHRASE="R/254", C2P_VERB_PHRASE="", 
        FK_CONSTRAINT="R_254", FK_COLUMNS="cliente" */

    update contratos
      set
        /* %SetFK(contratos,NULL) */
        contratos.cliente = NULL
      from contratos,deleted
      where
        /* %JoinFKPK(contratos,deleted," = "," and") */
        contratos.cliente = deleted.cliente

    /* ERwin Builtin Mon Oct 01 10:32:44 2007 */
    /* clientes R/251 grupos_clientes ON PARENT DELETE RESTRICT */
    /* ERWIN_RELATION:PARENT_OWNER="", PARENT_TABLE="clientes"
        CHILD_OWNER="", CHILD_TABLE="grupos_clientes"
        P2C_VERB_PHRASE="R/251", C2P_VERB_PHRASE="", 
        FK_CONSTRAINT="R_251", FK_COLUMNS="cliente" */

    if exists (
      select * from deleted,grupos_clientes
      where
        /*  %JoinFKPK(grupos_clientes,deleted," = "," and") */
        grupos_clientes.cliente = deleted.cliente
    )
    begin
      select @errno  = 30001,
             @errmsg = 'Cannot DELETE clientes because grupos_clientes exists.'
      goto error
    end

    /* ERwin Builtin Mon Oct 01 10:32:44 2007 */
    /* clientes R/232 informes ON PARENT DELETE SET NULL */
    /* ERWIN_RELATION:PARENT_OWNER="", PARENT_TABLE="clientes"
        CHILD_OWNER="", CHILD_TABLE="informes"
        P2C_VERB_PHRASE="R/232", C2P_VERB_PHRASE="", 
        FK_CONSTRAINT="R_232", FK_COLUMNS="cliente" */

    update informes
      set
        /* %SetFK(informes,NULL) */
        informes.cliente = NULL
      from informes,deleted
      where
        /* %JoinFKPK(informes,deleted," = "," and") */
        informes.cliente = deleted.cliente


    /* ERwin Builtin Mon Oct 01 10:32:44 2007 */
    return
error:
    raiserror (@errmsg,@errno,1) 
    rollback transaction
end
GO
CREATE OR ALTER trigger dbo.tI_clientes on dbo.clientes for INSERT as
/* ERwin Builtin Mon Oct 01 10:32:44 2007 */
/* INSERT trigger on clientes */
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 */
  /* country R/228 clientes ON CHILD INSERT SET NULL */
  /* ERWIN_RELATION:PARENT_OWNER="", PARENT_TABLE="country"
      CHILD_OWNER="", CHILD_TABLE="clientes"
      P2C_VERB_PHRASE="R/228", C2P_VERB_PHRASE="", 
      FK_CONSTRAINT="R_228", FK_COLUMNS="country_code" */

  if
    /* %ChildFK(" or",update) */
    update(country_code)
  begin
    update clientes
      set
        /* %SetFK(clientes,NULL) */
        clientes.country_code = NULL
      from clientes,inserted
      where
        /* %JoinPKPK(clientes,inserted," = "," and") */
  clientes.cliente = inserted.cliente and
   
        not exists (
          select * from country
          where
            /* %JoinFKPK(inserted,country," = "," and") */
            inserted.country_code = country.country_code
        )
  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 on dbo.clientes for UPDATE as
/* ERwin Builtin Mon Oct 01 10:32:44 2007 */
/* UPDATE trigger on clientes */
begin
  declare  @numrows int,
           @nullcnt int,
           @validcnt int,
           @inscliente int,
           @errno   int,
           @errmsg  varchar(255)

  select @numrows = @@rowcount
  /* ERwin Builtin Mon Oct 01 10:32:44 2007 */
  /* clientes R/279 clientes_usuarios ON PARENT 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
    /* %ParentPK(" or",update) */
    update(cliente)
  begin
    if exists (
      select * from deleted,clientes_usuarios
      where
        /*  %JoinFKPK(clientes_usuarios,deleted," = "," and") */
        clientes_usuarios.cliente = deleted.cliente
    )
    begin
      select @errno  = 30005,
             @errmsg = 'Cannot UPDATE clientes because clientes_usuarios exists.'
      goto error
    end
  end

  /* ERwin Builtin Mon Oct 01 10:32:44 2007 */
  /* clientes R/263 tipos_informe ON PARENT UPDATE SET NULL */
  /* ERWIN_RELATION:PARENT_OWNER="", PARENT_TABLE="clientes"
      CHILD_OWNER="", CHILD_TABLE="tipos_informe"
      P2C_VERB_PHRASE="R/263", C2P_VERB_PHRASE="", 
      FK_CONSTRAINT="R_263", FK_COLUMNS="cliente" */

  if
    /* %ParentPK(" or",update) */
    update(cliente)
  begin
    update tipos_informe
      set
        /* %SetFK(tipos_informe,NULL) */
        tipos_informe.cliente = NULL
      from tipos_informe,deleted
      where
        /* %JoinFKPK(tipos_informe,deleted," = "," and") */
        tipos_informe.cliente = deleted.cliente
  end

  /* ERwin Builtin Mon Oct 01 10:32:44 2007 */
  /* clientes R/254 contratos ON PARENT UPDATE SET NULL */
  /* ERWIN_RELATION:PARENT_OWNER="", PARENT_TABLE="clientes"
      CHILD_OWNER="", CHILD_TABLE="contratos"
      P2C_VERB_PHRASE="R/254", C2P_VERB_PHRASE="", 
      FK_CONSTRAINT="R_254", FK_COLUMNS="cliente" */

  if
    /* %ParentPK(" or",update) */
    update(cliente)
  begin
    update contratos
      set
        /* %SetFK(contratos,NULL) */
        contratos.cliente = NULL
      from contratos,deleted
      where
        /* %JoinFKPK(contratos,deleted," = "," and") */
        contratos.cliente = deleted.cliente
  end

  /* ERwin Builtin Mon Oct 01 10:32:44 2007 */
  /* clientes R/251 grupos_clientes ON PARENT UPDATE RESTRICT */
  /* ERWIN_RELATION:PARENT_OWNER="", PARENT_TABLE="clientes"
      CHILD_OWNER="", CHILD_TABLE="grupos_clientes"
      P2C_VERB_PHRASE="R/251", C2P_VERB_PHRASE="", 
      FK_CONSTRAINT="R_251", FK_COLUMNS="cliente" */

  if
    /* %ParentPK(" or",update) */
    update(cliente)
  begin
    if exists (
      select * from deleted,grupos_clientes
      where
        /*  %JoinFKPK(grupos_clientes,deleted," = "," and") */
        grupos_clientes.cliente = deleted.cliente
    )
    begin
      select @errno  = 30005,
             @errmsg = 'Cannot UPDATE clientes because grupos_clientes exists.'
      goto error
    end
  end

  /* ERwin Builtin Mon Oct 01 10:32:44 2007 */
  /* clientes R/232 informes ON PARENT UPDATE SET NULL */
  /* ERWIN_RELATION:PARENT_OWNER="", PARENT_TABLE="clientes"
      CHILD_OWNER="", CHILD_TABLE="informes"
      P2C_VERB_PHRASE="R/232", C2P_VERB_PHRASE="", 
      FK_CONSTRAINT="R_232", FK_COLUMNS="cliente" */

  if
    /* %ParentPK(" or",update) */
    update(cliente)
  begin
    update informes
      set
        /* %SetFK(informes,NULL) */
        informes.cliente = NULL
      from informes,deleted
      where
        /* %JoinFKPK(informes,deleted," = "," and") */
        informes.cliente = deleted.cliente
  end

  /* ERwin Builtin Mon Oct 01 10:32:44 2007 */
  /* country R/228 clientes ON CHILD UPDATE SET NULL */
  /* ERWIN_RELATION:PARENT_OWNER="", PARENT_TABLE="country"
      CHILD_OWNER="", CHILD_TABLE="clientes"
      P2C_VERB_PHRASE="R/228", C2P_VERB_PHRASE="", 
      FK_CONSTRAINT="R_228", FK_COLUMNS="country_code" */

  if
    /* %ChildFK(" or",update) */
    update(country_code)
  begin
    update clientes
      set
        /* %SetFK(clientes,NULL) */
        clientes.country_code = NULL
      from clientes,inserted
      where
        /* %JoinPKPK(clientes,inserted," = "," and") */
  clientes.cliente = inserted.cliente and
   
        not exists (
          select * from country
          where
            /* %JoinFKPK(inserted,country," = "," and") */
            inserted.country_code = country.country_code
        )
  end


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

ALTER TABLE dbo.clientes WITH NOCHECK
  ADD CONSTRAINT FK__clientes__countr__5441852A FOREIGN KEY (country_code) REFERENCES dbo.country (country_code)
GO

CREATE FULLTEXT INDEX
  ON dbo.clientes(nombre_cliente LANGUAGE 3082, cuit LANGUAGE 3082, nombre_alternativo LANGUAGE 3082)
  KEY INDEX PK__clientes__7E6CC920
  ON Clientes
  WITH CHANGE_TRACKING AUTO, STOPLIST SYSTEM
GO

Used By

388