SQL Server Performance

XML PrepareDocument

Discussion in 'General Developer Questions' started by rajkolli_2000, Apr 18, 2006.

  1. rajkolli_2000 New Member

    Hi All

    THis is my query:

    declare @xmlstring varchar(7500)
    set @xmlstring ='<ROOT>
    <GRAPH StDt="2006-02-02" EndDt="2006-02-02" />
    <GRAPH StDt=" " EndDt="" />
    <GRAPH StDt=" " EndDt="" />
    <GRAPH StDt="2006-02-02" EndDt="2006-02-02" />
    </ROOT> '
    Declare @hDoc int
    EXEC sp_xml_preparedocument @hDoc OUTPUT, @xmlString
    INSERT INTO GDetails (


    WITH ( StDt datetime '@StDt',
    EndDt datetime '@EndDt'

    Problem is wherever there is emptyString in xml string like stdt="" i am getting
    "1/1/1900" being inserted in the table column.... it should be inserted as null actually...

    How to solve this....


    How should i do it
  2. satya Moderator

    Can you specify the default value as NULL for that column?

    Satya SKJ
    Microsoft SQL Server MVP
    Contributing Editor & Forums Moderator
    This posting is provided “AS IS” with no rights for the sake of knowledge sharing.
  3. rajkolli_2000 New Member

    already tha column default is null even though i t is inserting the default date
  4. FrankKalis Moderator

  5. FrankKalis Moderator

Share This Page