if not exists (select * FROM _columnas where tabla = 'gen_registroEnvio' and columna = 'tabla')
begin  
INSERT INTO [dbo].[_columnas]
           ([tabla]
           ,[columna]
           ,[mostrarEnGrilla]
           ,[ordenGrilla]
           ,[requerido]
           ,[tipo]
           ,[defecto]
           ,[tamano])
     VALUES
           ('gen_registroEnvio'
           ,'tabla'
           ,1
           ,1
           ,1
           ,'varchar'
           ,'('''')'
           ,200)
end

go

if not exists (select * FROM _columnas where tabla = 'gen_registroEnvio' and columna = 'reintentar')
begin  	   
INSERT INTO [dbo].[_columnas]
           ([tabla]
           ,[columna]
           ,[mostrarEnGrilla]
           ,[ordenGrilla]
           ,[requerido]
           ,[tipo]
           ,[defecto]
           ,[tamano])
     VALUES
           ('gen_registroEnvio'
           ,'reintentar'
           ,1
           ,1
           ,1
           ,'bit'
           ,'((1))'
           ,NULL)
end

go

if not exists (select * FROM _columnas where tabla = 'gen_registroEnvio' and columna = 'id_envioCorreo')
begin  		   
INSERT INTO [dbo].[_columnas]
           ([tabla]
           ,[columna]
           ,[mostrarEnGrilla]
           ,[ordenGrilla]
           ,[requerido]
           ,[tipo]
           ,[defecto]
           ,[tamano])
     VALUES
           ('gen_registroEnvio'
           ,'id_envioCorreo'
           ,1
           ,1
           ,1
           ,'int'
           ,'((0))'
           ,NULL)
end

go

if not exists (select * FROM _columnas where tabla = 'gen_registroEnvio' and columna = 'id_registroEnvio')
begin  		   
INSERT INTO [dbo].[_columnas]
           ([tabla]
           ,[columna]
           ,[mostrarEnGrilla]
           ,[ordenGrilla]
           ,[requerido]
           ,[tipo]
           ,[defecto]
           ,[tamano])
     VALUES
           ('gen_registroEnvio'
           ,'id_registroEnvio'
           ,1
           ,1
           ,1
           ,'int'
           ,'((0))'
           ,NULL)
end

go

if not exists (select * FROM _columnas where tabla = 'gen_detalleregistroEnvio' and columna = 'email')
begin  		   
INSERT INTO [dbo].[_columnas]
           ([tabla]
           ,[columna]
           ,[mostrarEnGrilla]
           ,[ordenGrilla]
           ,[requerido]
           ,[tipo]
           ,[defecto]
           ,[tamano])
     VALUES
           ('gen_detalleregistroEnvio'
           ,'email'
           ,1
           ,1
           ,1
           ,'varchar'
           ,'('''')'
           ,100)
end

go

if not exists (select * FROM _columnas where tabla = 'gen_detalleregistroEnvio' and columna = 'enviado')
begin  		   
INSERT INTO [dbo].[_columnas]
           ([tabla]
           ,[columna]
           ,[mostrarEnGrilla]
           ,[ordenGrilla]
           ,[requerido]
           ,[tipo]
           ,[defecto]
           ,[tamano])
     VALUES
           ('gen_detalleregistroEnvio'
           ,'enviado'
           ,1
           ,1
           ,1
           ,'bit'
           ,'((1))'
           ,NULL)
end

go

if not exists (select * FROM _columnas where tabla = 'gen_detalleregistroEnvio' and columna = 'enviar')
begin     
INSERT INTO [dbo].[_columnas]
           ([tabla]
           ,[columna]
           ,[mostrarEnGrilla]
           ,[ordenGrilla]
           ,[requerido]
           ,[tipo]
           ,[defecto]
           ,[tamano])
     VALUES
           ('gen_detalleregistroEnvio'
           ,'enviar'
           ,1
           ,1
           ,1
           ,'bit'
           ,'((1))'
           ,NULL)
end

go

if not exists (select * FROM _columnas where tabla = 'gen_detalleregistroEnvio' and columna = 'idObjeto')
begin     
INSERT INTO [dbo].[_columnas]
           ([tabla]
           ,[columna]
           ,[mostrarEnGrilla]
           ,[ordenGrilla]
           ,[requerido]
           ,[tipo]
           ,[defecto]
           ,[tamano])
     VALUES
           ('gen_detalleregistroEnvio'
           ,'idObjeto'
           ,1
           ,1
           ,1
           ,'int'
           ,'((0))'
           ,NULL)
end

go

if not exists (select * FROM _columnas where tabla = 'gen_detalleregistroEnvio' and columna = 'id_registroEnvio')
begin  		   
INSERT INTO [dbo].[_columnas]
           ([tabla]
           ,[columna]
           ,[mostrarEnGrilla]
           ,[ordenGrilla]
           ,[requerido]
           ,[tipo]
           ,[defecto]
           ,[tamano])
     VALUES
           ('gen_detalleregistroEnvio'
           ,'id_registroEnvio'
           ,1
           ,1
           ,1
           ,'int'
           ,'((0))'
           ,NULL)
end
