dbo.led_vehiculos_periodo

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 (~) 489789
Created 12/29/2015 4:57:47 PM
Last Modified 11/29/2024 7:25:04 PM

Columns

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

True

False

False

contratista int 4 10 0

False

False

False

tipo_alta tinyint 1 3 0

False

False

False

tipo_baja tinyint 1 3 0

False

False

False

periodo int 4 10 0

True

False

False

contratista_1 int 4 10 0

False

False

False

fecha_afectacion datetime 8 23 3

False

(getdate())

False

False

ratificado tinyint 1 3 0

False

(0)

False

False

ratificado_por int 4 10 0

False

False

False

fecha_ratificado datetime 8 23 3

False

False

False

Indexes

4
Key Name Columns Unique Type Description
idxFechaAfectacion fecha_afectacion

False

idxImperium_VehicAfectacion periodo, fecha_afectacion

False

idxNotif96HorasVehi periodo

False

XPKled_vehiculos_periodo vehiculo, periodo

True

Triggers

1
Name ANSI Nulls ON Quoted Identifier ON On Not For Replication Description
led_vehiculos_periodo_INS

True

True

AFTER INSERT

False

SQL Script

Copy
CREATE TABLE dbo.led_vehiculos_periodo (
  vehiculo int NOT NULL,
  contratista int NULL,
  tipo_alta tinyint NULL,
  tipo_baja tinyint NULL,
  periodo int NOT NULL,
  contratista_1 int NULL,
  fecha_afectacion datetime NULL DEFAULT (getdate()),
  ratificado tinyint NULL DEFAULT (0),
  ratificado_por int NULL,
  fecha_ratificado datetime NULL,
  CONSTRAINT XPKled_vehiculos_periodo PRIMARY KEY NONCLUSTERED (vehiculo, periodo) WITH (FILLFACTOR = 90)
)
ON [PRIMARY]
GO

CREATE INDEX idxFechaAfectacion
  ON dbo.led_vehiculos_periodo (fecha_afectacion)
  INCLUDE (vehiculo)
  WITH (FILLFACTOR = 80)
  ON [PRIMARY]
GO

CREATE INDEX idxImperium_VehicAfectacion
  ON dbo.led_vehiculos_periodo (periodo, fecha_afectacion)
  INCLUDE (vehiculo, contratista, contratista_1)
  WITH (FILLFACTOR = 80)
  ON [PRIMARY]
GO

CREATE INDEX idxNotif96HorasVehi
  ON dbo.led_vehiculos_periodo (periodo)
  INCLUDE (vehiculo)
  WITH (FILLFACTOR = 80)
  ON [PRIMARY]
GO

SET QUOTED_IDENTIFIER, ANSI_NULLS ON
GO
CREATE OR ALTER TRIGGER dbo.led_vehiculos_periodo_INS ON led_vehiculos_periodo AFTER INSERT 
AS
BEGIN
  SET NOCOUNT ON

  UPDATE led_vehiculos_periodo SET fecha_afectacion = getdate()
    FROM INSERTED,led_vehiculos_periodo
    WHERE led_vehiculos_periodo.vehiculo = INSERTED.vehiculo and led_vehiculos_periodo.periodo = inserted.periodo 
 AND INSERTED.fecha_afectacion IS NULL

  SET NOCOUNT OFF
END
GO

Depends On

No items found

Used By

101