

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

