ALTER PROCEDURE GetSingersGenere
(@SingerData ntext)
AS
BEGIN
DECLARE @hDoc int
exec sp_xml_preparedocument @hDoc OUTPUT,@SingerData
IF OBject_id('SingerTable') IS NOT NULL
BEGIN
DROP TABLE SingerTable
END
CREATE TABLE SingerTable
(
SingerName varchar(200)
)
INSERT INTO SingerTable
(
SingerName
)
SELECT * FROM OpenXML (@hDoc,'/Singers/Singer')
WITH (SingerName varchar(200)) XMLSinger
SELECT * FROM SingerTable
END
and the way I am executing is this:-
EXEC GetSingersGenere
'<Singers>
<Singer>
Joe
</Singer>
<Singer>
ACDC
</Singer>
</Singers>'
I see NULL getting inserted in the table. Could anyone point out the mistake?