Mostrando las entradas con la etiqueta Transact SQL. Mostrar todas las entradas
Mostrando las entradas con la etiqueta Transact SQL. Mostrar todas las entradas

13 sept 2013

Lectura de un XML con Transact SQL



@LO_UNIDADES_PLANEACION xml

-- Unidades de planeación
INSERT INTO [K_PROYECTO_UNIDAD_PLANEACION] (
FL_UNIDAD_PLANEACION,
NO_PROCENTAJE_AFECTACION)              
SELECT
x.ref.value('FL_UNIDAD_PLANEACION[1]', 'int'),
x.ref.value('NO_PROCENTAJE_AFECTACION[1]', 'float')
FROM @LO_UNIDADES_PLANEACION.nodes('/UnidadesPlaneacion/UnidadPlaneacion') x(ref)



Con esto, insertamos dos registros en la tabla [K_PROYECTO_UNIDAD_PLANEACION]