IF OBJECT_ID(N'dbo._TabVyroba_VydejMatSarze', N'U') IS NULL
 CREATE TABLE dbo._TabVyroba_VydejMatSarze (
  ID INT IDENTITY(1,1) NOT NULL,
  IDPohybZbozi INT,
  Sarze NVARCHAR(100) NOT NULL,
  Mnozstvi NUMERIC(19,6) DEFAULT 0.0 NOT NULL,
  Autor nvarchar(80) DEFAULT suser_sname() NOT NULL,
  DatPorizeni datetime DEFAULT getdate() NOT NULL,
  PRIMARY KEY (ID DESC)
 )



/* 14.5.2024 */
IF COL_LENGTH(N'dbo._TabVyroba_VydejMatSarze', N'IDKmenZbozi') IS NULL ALTER TABLE dbo._TabVyroba_VydejMatSarze ADD IDKmenZbozi INT NULL



DROP INDEX IF EXISTS EI__TabVyroba_VydejMatSarze_IDPohybZbozi ON dbo._TabVyroba_VydejMatSarze
 CREATE NONCLUSTERED INDEX EI__TabVyroba_VydejMatSarze_IDPohybZbozi ON dbo._TabVyroba_VydejMatSarze (IDPohybZbozi)
  WITH ( PAD_INDEX = OFF, DROP_EXISTING = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)


DROP INDEX IF EXISTS EI__TabVyroba_VydejMatSarze_IDKmenZbozi ON dbo._TabVyroba_VydejMatSarze
 CREATE NONCLUSTERED INDEX EI__TabVyroba_VydejMatSarze_IDKmenZbozi ON dbo._TabVyroba_VydejMatSarze (IDKmenZbozi)
  WITH ( PAD_INDEX = OFF, DROP_EXISTING = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)
