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 (~) | 235 |
| Created | 10/1/2007 3:29:34 PM |
| Last Modified | 11/29/2024 5:15:57 PM |
Columns
2Indexes
1Triggers
2| Name | ANSI Nulls ON | Quoted Identifier ON | On | Not For Replication | Description |
|---|---|---|---|---|---|
| tI_grupos_clientes | True |
True |
AFTER INSERT | False |
|
| tU_grupos_clientes | True |
True |
AFTER UPDATE | False |
Foreign Keys
2| Name | Columns | Description |
|---|---|---|
| FK__grupos_cl__clien__5EBF139D | cliente | |
| FK__grupos_cl__grupo__5FB337D6 | grupo |
SQL Script
Copy
CREATE TABLE dbo.grupos_clientes (
grupo smallint NOT NULL,
cliente int NOT NULL,
PRIMARY KEY NONCLUSTERED (grupo, cliente) WITH (FILLFACTOR = 90)
)
ON [PRIMARY]
GO
SET QUOTED_IDENTIFIER, ANSI_NULLS ON
GO
CREATE OR ALTER trigger dbo.tI_grupos_clientes on dbo.grupos_clientes for INSERT as
/* ERwin Builtin Mon Oct 01 10:32:44 2007 */
/* INSERT trigger on grupos_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 */
/* clientes R/251 grupos_clientes ON CHILD INSERT 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
/* %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 grupos_clientes because clientes does not exist.'
goto error
end
end
/* ERwin Builtin Mon Oct 01 10:32:44 2007 */
/* grupos R/250 grupos_clientes ON CHILD INSERT RESTRICT */
/* ERWIN_RELATION:PARENT_OWNER="", PARENT_TABLE="grupos"
CHILD_OWNER="", CHILD_TABLE="grupos_clientes"
P2C_VERB_PHRASE="R/250", C2P_VERB_PHRASE="",
FK_CONSTRAINT="R_250", FK_COLUMNS="grupo" */
if
/* %ChildFK(" or",update) */
update(grupo)
begin
select @nullcnt = 0
select @validcnt = count(*)
from inserted,grupos
where
/* %JoinFKPK(inserted,grupos) */
inserted.grupo = grupos.grupo
/* %NotnullFK(inserted," is null","select @nullcnt = count(*) from inserted where"," and") */
if @validcnt + @nullcnt != @numrows
begin
select @errno = 30002,
@errmsg = 'Cannot INSERT grupos_clientes because grupos 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_grupos_clientes on dbo.grupos_clientes for UPDATE as
/* ERwin Builtin Mon Oct 01 10:32:44 2007 */
/* UPDATE trigger on grupos_clientes */
begin
declare @numrows int,
@nullcnt int,
@validcnt int,
@insgrupo smallint,
@inscliente int,
@errno int,
@errmsg varchar(255)
select @numrows = @@rowcount
/* ERwin Builtin Mon Oct 01 10:32:44 2007 */
/* clientes R/251 grupos_clientes ON CHILD 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
/* %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 grupos_clientes because clientes does not exist.'
goto error
end
end
/* ERwin Builtin Mon Oct 01 10:32:44 2007 */
/* grupos R/250 grupos_clientes ON CHILD UPDATE RESTRICT */
/* ERWIN_RELATION:PARENT_OWNER="", PARENT_TABLE="grupos"
CHILD_OWNER="", CHILD_TABLE="grupos_clientes"
P2C_VERB_PHRASE="R/250", C2P_VERB_PHRASE="",
FK_CONSTRAINT="R_250", FK_COLUMNS="grupo" */
if
/* %ChildFK(" or",update) */
update(grupo)
begin
select @nullcnt = 0
select @validcnt = count(*)
from inserted,grupos
where
/* %JoinFKPK(inserted,grupos) */
inserted.grupo = grupos.grupo
/* %NotnullFK(inserted," is null","select @nullcnt = count(*) from inserted where"," and") */
if @validcnt + @nullcnt != @numrows
begin
select @errno = 30007,
@errmsg = 'Cannot UPDATE grupos_clientes because grupos 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.grupos_clientes WITH NOCHECK
ADD CONSTRAINT FK__grupos_cl__clien__5EBF139D FOREIGN KEY (cliente) REFERENCES dbo.clientes (cliente)
GO
ALTER TABLE dbo.grupos_clientes
ADD FOREIGN KEY (grupo) REFERENCES dbo.grupos (grupo)
GO
grupo smallint NOT NULL,
cliente int NOT NULL,
PRIMARY KEY NONCLUSTERED (grupo, cliente) WITH (FILLFACTOR = 90)
)
ON [PRIMARY]
GO
SET QUOTED_IDENTIFIER, ANSI_NULLS ON
GO
CREATE OR ALTER trigger dbo.tI_grupos_clientes on dbo.grupos_clientes for INSERT as
/* ERwin Builtin Mon Oct 01 10:32:44 2007 */
/* INSERT trigger on grupos_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 */
/* clientes R/251 grupos_clientes ON CHILD INSERT 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
/* %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 grupos_clientes because clientes does not exist.'
goto error
end
end
/* ERwin Builtin Mon Oct 01 10:32:44 2007 */
/* grupos R/250 grupos_clientes ON CHILD INSERT RESTRICT */
/* ERWIN_RELATION:PARENT_OWNER="", PARENT_TABLE="grupos"
CHILD_OWNER="", CHILD_TABLE="grupos_clientes"
P2C_VERB_PHRASE="R/250", C2P_VERB_PHRASE="",
FK_CONSTRAINT="R_250", FK_COLUMNS="grupo" */
if
/* %ChildFK(" or",update) */
update(grupo)
begin
select @nullcnt = 0
select @validcnt = count(*)
from inserted,grupos
where
/* %JoinFKPK(inserted,grupos) */
inserted.grupo = grupos.grupo
/* %NotnullFK(inserted," is null","select @nullcnt = count(*) from inserted where"," and") */
if @validcnt + @nullcnt != @numrows
begin
select @errno = 30002,
@errmsg = 'Cannot INSERT grupos_clientes because grupos 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_grupos_clientes on dbo.grupos_clientes for UPDATE as
/* ERwin Builtin Mon Oct 01 10:32:44 2007 */
/* UPDATE trigger on grupos_clientes */
begin
declare @numrows int,
@nullcnt int,
@validcnt int,
@insgrupo smallint,
@inscliente int,
@errno int,
@errmsg varchar(255)
select @numrows = @@rowcount
/* ERwin Builtin Mon Oct 01 10:32:44 2007 */
/* clientes R/251 grupos_clientes ON CHILD 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
/* %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 grupos_clientes because clientes does not exist.'
goto error
end
end
/* ERwin Builtin Mon Oct 01 10:32:44 2007 */
/* grupos R/250 grupos_clientes ON CHILD UPDATE RESTRICT */
/* ERWIN_RELATION:PARENT_OWNER="", PARENT_TABLE="grupos"
CHILD_OWNER="", CHILD_TABLE="grupos_clientes"
P2C_VERB_PHRASE="R/250", C2P_VERB_PHRASE="",
FK_CONSTRAINT="R_250", FK_COLUMNS="grupo" */
if
/* %ChildFK(" or",update) */
update(grupo)
begin
select @nullcnt = 0
select @validcnt = count(*)
from inserted,grupos
where
/* %JoinFKPK(inserted,grupos) */
inserted.grupo = grupos.grupo
/* %NotnullFK(inserted," is null","select @nullcnt = count(*) from inserted where"," and") */
if @validcnt + @nullcnt != @numrows
begin
select @errno = 30007,
@errmsg = 'Cannot UPDATE grupos_clientes because grupos 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.grupos_clientes WITH NOCHECK
ADD CONSTRAINT FK__grupos_cl__clien__5EBF139D FOREIGN KEY (cliente) REFERENCES dbo.clientes (cliente)
GO
ALTER TABLE dbo.grupos_clientes
ADD FOREIGN KEY (grupo) REFERENCES dbo.grupos (grupo)
GO
Depends On
2Used By
28- dbo.backend_contratos_consumos
- dbo.IV_panel_control
- dbo.IV_panel_control_2021
- dbo.IV_panel_control_22012021
- dbo.IV_panel_control_AGB
- dbo.IV_panel_control_new
- dbo.LN_Blue
- dbo.LN_Blue_23062023
- dbo.LN_Blue_AGB
- dbo.LN_Blue_MIS
- dbo.LN_Blue2
- dbo.LN_contrapartes_
- dbo.LN_contrapartes_sc
- dbo.LN_demo_
- dbo.LN_demo_19112021
- dbo.LN_demo_DEV
- dbo.LN_demo_mis
- dbo.LN_informes
- dbo.LN_informes_AGB
- dbo.LN_informes_MIS
- dbo.LN_panel_control
- dbo.LN_panel_control_17012024
- dbo.LN_panel_control_23042024
- dbo.LN_panel_control_MIS
- dbo.LN_panel_control_ORIGINAL
- dbo.LN_tipos_informe_familia
- dbo.clientes
- dbo.grupos