/*DOC_DOCUMENTOCOMENTARIO*/
IF NOT EXISTS(SELECT *FROM [_columnas] WHERE[tabla]='doc_documentoComentario'
      AND [columna]='id_usuario' AND[mostrarEnGrilla]=1 AND[ordenGrilla]=1AND[requerido]=1 AND[tipo]='int'AND[defecto]=0 AND [tamano] IS NULL)
BEGIN
INSERT INTO [_columnas]
([tabla] ,[columna] ,[mostrarEnGrilla],[ordenGrilla],[requerido] ,[tipo],[defecto],[tamano])
 VALUES
 ('doc_documentoComentario' ,'id_usuario',1 ,1 ,1 ,'int' ,0 ,null)
END

IF NOT EXISTS(SELECT *FROM [_columnas] WHERE[tabla]='doc_documentoComentario'
      AND [columna]='id_tarea'AND[mostrarEnGrilla]=1 AND[ordenGrilla]=2AND[requerido]=1 AND[tipo]='int'AND[defecto]=0 AND [tamano] IS NULL)
BEGIN
INSERT INTO [_columnas]
([tabla] ,[columna] ,[mostrarEnGrilla],[ordenGrilla],[requerido] ,[tipo],[defecto],[tamano])
 VALUES
 ('doc_documentoComentario' ,'id_tarea',1 ,2 ,1 ,'int' ,0 ,null)
END

IF NOT EXISTS(SELECT *FROM [_columnas] WHERE[tabla]='doc_documentoComentario'
      AND [columna]='fechaRecordar_fh'AND[mostrarEnGrilla]=1 AND[ordenGrilla]=3AND[requerido]=1 AND[tipo]='smalldatetime'AND[defecto]=1/1/1900 AND [tamano] IS NULL)
BEGIN
INSERT INTO [_columnas]
([tabla] ,[columna] ,[mostrarEnGrilla],[ordenGrilla],[requerido] ,[tipo],[defecto],[tamano])
 VALUES
 ('doc_documentoComentario' ,'fechaRecordar_fh',1 ,3 ,1 ,'smalldatetime' ,1/1/1900 ,null)
END

IF NOT EXISTS(SELECT *FROM [_columnas] WHERE[tabla]='doc_documentoComentario'
      AND [columna]='cerrada'AND[mostrarEnGrilla]=1 AND[ordenGrilla]=4AND[requerido]=1 AND[tipo]='bit'AND[defecto]=0 AND [tamano] IS NULL)
BEGIN
INSERT INTO [_columnas]
([tabla] ,[columna] ,[mostrarEnGrilla],[ordenGrilla],[requerido] ,[tipo],[defecto],[tamano])
 VALUES
 ('doc_documentoComentario' ,'cerrada',1 ,4 ,1 ,'bit' ,0 ,null)
END

IF NOT EXISTS(SELECT *FROM [_columnas] WHERE[tabla]='doc_documentoComentario'
      AND [columna]='id_documentoComentario'AND[mostrarEnGrilla]=1 AND[ordenGrilla]=5AND[requerido]=1 AND[tipo]='int'AND[defecto]=0 AND [tamano] IS NULL)
BEGIN
INSERT INTO [_columnas]
([tabla] ,[columna] ,[mostrarEnGrilla],[ordenGrilla],[requerido] ,[tipo],[defecto],[tamano])
 VALUES
 ('doc_documentoComentario' ,'id_documentoComentario',1 ,5 ,1 ,'int' ,0 ,null)
END

IF NOT EXISTS(SELECT *FROM [_columnas] WHERE[tabla]='doc_documentoComentario'
      AND [columna]='id_documento'AND[mostrarEnGrilla]=1 AND[ordenGrilla]=6AND[requerido]=1 AND[tipo]='int'AND[defecto]=0 AND [tamano] IS NULL)
BEGIN
INSERT INTO [_columnas]
([tabla] ,[columna] ,[mostrarEnGrilla],[ordenGrilla],[requerido] ,[tipo],[defecto],[tamano])
 VALUES
 ('doc_documentoComentario' ,'id_documento',1 ,6 ,1 ,'int' ,0 ,null)
END









--PARA DOCTAREA


IF NOT EXISTS(SELECT *FROM [_columnas] WHERE[tabla]='doc_tarea'
      AND [columna]='id'AND[mostrarEnGrilla]=1 AND[ordenGrilla]=1 AND[requerido]=1 AND[tipo]='int'AND[defecto]is null AND [tamano] IS NULL)
BEGIN
INSERT INTO [_columnas]
([tabla] ,[columna] ,[mostrarEnGrilla],[ordenGrilla],[requerido] ,[tipo],[defecto],[tamano])
 VALUES('doc_tarea' ,'id',1 ,1 ,1 ,'int' ,null ,null)
END



IF NOT EXISTS(SELECT * FROM [_columnas] WHERE[tabla]='doc_tarea'
 AND [columna]='uid'AND[mostrarEnGrilla]=1 AND[ordenGrilla]=2 AND[requerido]=1 AND[tipo]='int'AND[defecto]is null AND [tamano]=500)
 BEGIN
INSERT INTO [_columnas]([tabla] ,[columna] ,[mostrarEnGrilla],[ordenGrilla],[requerido] ,[tipo],[defecto],[tamano])
 VALUES('doc_tarea' ,'uid',1 ,2 ,1 ,'int' ,null ,500)
END




IF NOT EXISTS(SELECT *FROM [_columnas] WHERE[tabla]='doc_tarea'
      AND [columna]='eid'AND[mostrarEnGrilla]=1 AND[ordenGrilla]=3 AND[requerido]=1 AND[tipo]='varchar'AND[defecto]is null AND [tamano] =50)
BEGIN
INSERT INTO [_columnas]
([tabla] ,[columna] ,[mostrarEnGrilla],[ordenGrilla],[requerido] ,[tipo],[defecto],[tamano])
 VALUES('doc_tarea' ,'eid',1 ,3 ,1 ,'varchar' ,null,50)
END


IF NOT EXISTS(SELECT * FROM [_columnas] WHERE[tabla]='doc_tarea'
 AND [columna]='id_usuario_modifico'AND[mostrarEnGrilla]=1 AND[ordenGrilla]=4 AND[requerido]=1 AND[tipo]='int'AND[defecto]=0 AND [tamano] IS NULL)
 BEGIN
INSERT INTO [_columnas]([tabla] ,[columna] ,[mostrarEnGrilla],[ordenGrilla],[requerido] ,[tipo],[defecto],[tamano])
 VALUES('doc_tarea' ,'id_usuario_modifico',1 ,4 ,1 ,'int' ,0 ,null)
END



IF NOT EXISTS(SELECT *FROM [_columnas] WHERE[tabla]='doc_tarea'
      AND [columna]='id_usuario_creo'AND[mostrarEnGrilla]=1 AND[ordenGrilla]=5 AND[requerido]=1 AND[tipo]='int'AND[defecto]=0 AND [tamano] IS NULL)
BEGIN
INSERT INTO [_columnas]
([tabla] ,[columna] ,[mostrarEnGrilla],[ordenGrilla],[requerido] ,[tipo],[defecto],[tamano])
 VALUES('doc_tarea' ,'id_usuario_creo',1 ,5 ,1 ,'int' ,0 ,null)
END




IF NOT EXISTS(SELECT * FROM [_columnas] WHERE[tabla]='doc_tarea'
 AND [columna]='fechaModificacion'AND[mostrarEnGrilla]=1 AND[ordenGrilla]=6 AND[requerido]=1 AND[tipo]='datetime'AND[defecto]='(getdate())' AND [tamano] IS NULL)
 BEGIN
INSERT INTO [_columnas]([tabla] ,[columna] ,[mostrarEnGrilla],[ordenGrilla],[requerido] ,[tipo],[defecto],[tamano])
 VALUES('doc_tarea' ,'fechaModificacion',1 ,6 ,1 ,'datetime' ,'(getdate())' ,null)
END


IF NOT EXISTS(SELECT *FROM [_columnas] WHERE[tabla]='doc_tarea'
      AND [columna]='fechaCreacion'AND[mostrarEnGrilla]=1 AND[ordenGrilla]=7 AND[requerido]=1 AND[tipo]='smalldatetime'AND[defecto]='(getdate())' AND [tamano] IS NULL)
BEGIN
INSERT INTO [_columnas]
([tabla] ,[columna] ,[mostrarEnGrilla],[ordenGrilla],[requerido] ,[tipo],[defecto],[tamano])
 VALUES('doc_tarea' ,'fechaCreacion',1 ,7,1 ,'smalldatetime' ,'(getdate())',null)
END


IF NOT EXISTS(SELECT * FROM [_columnas] WHERE[tabla]='doc_tarea'
 AND [columna]='active'AND[mostrarEnGrilla]=1 AND[ordenGrilla]=8 AND[requerido]=1 AND[tipo]='bit'AND[defecto]=1 AND [tamano] IS NULL)
 BEGIN
INSERT INTO [_columnas]([tabla] ,[columna] ,[mostrarEnGrilla],[ordenGrilla],[requerido] ,[tipo],[defecto],[tamano])
 VALUES('doc_tarea' ,'active',1 ,8 ,1 ,'bit' ,1 ,null)
END





IF NOT EXISTS(SELECT *FROM [_columnas] WHERE[tabla]='doc_tarea'
      AND [columna]='tarea'AND[mostrarEnGrilla]=1 AND[ordenGrilla]=9 AND[requerido]=1 AND[tipo]='varchar'AND[defecto]is null AND [tamano] =300)
BEGIN
INSERT INTO [_columnas]
([tabla] ,[columna] ,[mostrarEnGrilla],[ordenGrilla],[requerido] ,[tipo],[defecto],[tamano])
 VALUES('doc_tarea' ,'tarea',1 ,9 ,1 ,'varchar' ,null ,300)
END


IF NOT EXISTS(SELECT * FROM [_columnas] WHERE[tabla]='doc_tarea'
 AND [columna]='tarea_codigo'AND[mostrarEnGrilla]=1 AND[ordenGrilla]=10 AND[requerido]=1 AND[tipo]='varchar'AND[defecto]IS NULL AND [tamano] =100 )
 BEGIN
INSERT INTO [_columnas]([tabla] ,[columna] ,[mostrarEnGrilla],[ordenGrilla],[requerido] ,[tipo],[defecto],[tamano])
 VALUES('doc_tarea' ,'tarea_codigo',1 ,10 ,1 ,'varchar' ,null ,100)
END

/**************************************************/

IF NOT EXISTS(SELECT *FROM [_columnas] WHERE[tabla]='doc_tarea'
      AND [columna]='id_catalogo'AND[mostrarEnGrilla]=1 AND[ordenGrilla]=11 AND[requerido]=1 AND[tipo]='int'AND[defecto]=0 AND [tamano] IS NULL)
BEGIN
INSERT INTO [_columnas]
([tabla] ,[columna] ,[mostrarEnGrilla],[ordenGrilla],[requerido] ,[tipo],[defecto],[tamano])
 VALUES('doc_tarea' ,'id_catalogo',1 ,11 ,1 ,'int' ,0 ,null)
END

IF NOT EXISTS(SELECT * FROM [_columnas] WHERE[tabla]='doc_tarea'
 AND [columna]='id_cargo'AND[mostrarEnGrilla]=1 AND[ordenGrilla]=12 AND[requerido]=1 AND[tipo]='int'AND[defecto]=0 AND [tamano] IS NULL)
 BEGIN
INSERT INTO [_columnas]([tabla] ,[columna] ,[mostrarEnGrilla],[ordenGrilla],[requerido] ,[tipo],[defecto],[tamano])
 VALUES('doc_tarea' ,'id_cargo',1 ,12 ,1 ,'int' ,0 ,null)
END


IF NOT EXISTS(SELECT *FROM [_columnas] WHERE[tabla]='doc_tarea'
      AND [columna]='fechaPlaneada_fh'AND[mostrarEnGrilla]=1 AND[ordenGrilla]=13 AND[requerido]=1 AND[tipo]='smalldatetime'AND[defecto]=1/1/1900 AND [tamano] IS NULL)
BEGIN
INSERT INTO [_columnas]
([tabla] ,[columna] ,[mostrarEnGrilla],[ordenGrilla],[requerido] ,[tipo],[defecto],[tamano])
 VALUES('doc_tarea' ,'fechaPlaneada_fh',1 ,13 ,1 ,'smalldatetime' ,1/1/1900 ,null)
END

IF NOT EXISTS(SELECT * FROM [_columnas] WHERE[tabla]='doc_tarea'
 AND [columna]='porcentajeAvance'AND[mostrarEnGrilla]=1 AND[ordenGrilla]=14 AND[requerido]=1 AND[tipo]='int'AND[defecto]=0 AND [tamano] IS NULL)
 BEGIN
INSERT INTO [_columnas]([tabla] ,[columna] ,[mostrarEnGrilla],[ordenGrilla],[requerido] ,[tipo],[defecto],[tamano])
 VALUES('doc_tarea' ,'porcentajeAvance',1 ,14 ,1 ,'int' ,0 ,null)
END





