SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

SET ANSI_PADDING ON
GO

if not exists(select * FROM information_schema.tables WHERE table_name = 'ort_reporteTecnico_ot' )
begin

CREATE TABLE [dbo].[ort_reporteTecnico_ot](
	[id] [int] IDENTITY(0,1) NOT NULL,
	[uid] [varchar](500) NOT NULL,
	[eid] [varchar](50) NOT NULL,
	[id_usuario_modifico] [int] NOT NULL,
	[id_usuario_creo] [int] NOT NULL,
	[fechaModificacion] [datetime] NOT NULL,
	[fechaCreacion] [smalldatetime] NOT NULL,
	[active] [bit] NOT NULL,
	[id_reporteTecnico] [int] NOT NULL,
	[id_ot] [int] NOT NULL,
	[observaciones] [varchar](2000) NOT NULL,

 CONSTRAINT [PK_ort_reporteTecnico_ot] PRIMARY KEY CLUSTERED ([id] ASC)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]) ON [PRIMARY]

SET ANSI_PADDING OFF

ALTER TABLE [dbo].[ort_reporteTecnico_ot] ADD  DEFAULT ((0)) FOR [id_usuario_modifico]

ALTER TABLE [dbo].[ort_reporteTecnico_ot] ADD  DEFAULT ((0)) FOR [id_usuario_creo]

ALTER TABLE [dbo].[ort_reporteTecnico_ot] ADD  DEFAULT (getdate()) FOR [fechaModificacion]
ALTER TABLE [dbo].[ort_reporteTecnico_ot] ADD  DEFAULT (getdate()) FOR [fechaCreacion]

ALTER TABLE [dbo].[ort_reporteTecnico_ot] ADD  DEFAULT ((1)) FOR [active]

insert into [dbo].[ort_reporteTecnico_ot] (id_ot,id_reporteTecnico,observaciones,uid,eid)
VALUES (0,0,'','0000-0000-0000-0000-0000-0','00')
end
go

