Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1107491
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T01:56:41+00:00 2026-05-17T01:56:41+00:00

ALTER PROCEDURE GetSingersGenere (@SingerData ntext) AS BEGIN DECLARE @hDoc int exec sp_xml_preparedocument @hDoc OUTPUT,@SingerData

  • 0
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?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T01:56:42+00:00Added an answer on May 17, 2026 at 1:56 am

    By default the OPENXML will look at attribute values or child elements for the data. If you write your select as:

    SELECT * FROM OpenXML (@hDoc,'/Singers/Singer')
        WITH (SingerName varchar(200) 'text()') XMLSinger
    

    It should work ok. Note the addition of ‘text()’ in to the schema mapping to specify that we just want the text value of the node instead of any attribute value.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here is my sample: ALTER PROCEDURE EmpFirstName @myParam int, @empFName varchar(20) output AS BEGIN
ALTER PROCEDURE dbo.ModeratorSpamDeleteComment DECLARE @CommentID int; AS BEGIN DELETE Comments WHERE CommentsID=@CommentID END It
ALTER PROCEDURE [dbo].[test] @tour int, @tourname varchar(50) OUTPUT, @tourdepartures varchar(50) OUTPUT AS BEGIN --
ALTER PROCEDURE Sp_Num_Tracking @UserID int AS BEGIN declare @lastLogonDate datetime; ALTER PROCEDURE Sp_num_Tracking @UserID
ALTER PROCEDURE [dbo].[AmendInsertDuplicateFields] (@ReportID varchar(50)) AS BEGIN DECLARE @NewReportID VARCHAR(50) SET @NewReportID = NEWID()
ALTER PROCEDURE [Lending].[uspHMDALarIncomeGet] (@ApplicationId int) AS BEGIN SET NOCOUNT ON SET TRANSACTION ISOLATION LEVEL
I have the following stored procedure: ALTER PROCEDURE Pro_members_Insert @id int outPut, @LoginName nvarchar(50),
--Stored procedure ALTER PROCEDURE [dbo].[Test] @USERID varchar(25) AS BEGIN SET NOCOUNT ON IF NOT
I get error why? ALTER PROCEDURE dbo.verifGuids @value char(36), @message char(1)Output AS Begin select
ALTER PROCEDURE [dbo].[HO_GetListOfLeaguesPerLocation] AS BEGIN SELECT DISTINCT LeagueID, (EXEC dbo.HO_GetLeagueNumOfMatches LeagueID) FROM Games END

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.