Creating Data for a CML field

The simplest way to populate your database with test data.

Moderators: David Atkinson, Anu Deshpande, Lionel

Creating Data for a CML field

Postby rockinder » Thu Oct 07, 2010 10:09 pm

I have a table with one column as XMl. this XML contains say student data. Is there a way to create data specific to a XML that I need. Say using a XSD.
the data is like
<XML><name>abc</name><Address>nmnnnn333</Address>....</XML>

Want to create say 10k different XMLs in the same structure. is it possible.
rockinder
 
Posts: 4
Joined: Mon Aug 31, 2009 8:12 pm

Postby CraigOttley » Fri Dec 17, 2010 1:31 pm

Hi Rockinder,

I've had this problem in the past, If I remember rightly there's no easy way of doing this through SQL Data Generator.

One thing you could try is using the FOR XML clause from flat tables. I think you have to have certain options set on the table and database level for this to work.

This work for me on Adventure works using the Person.Contact table and the AdditionalContactInfo column... (Takes a few seconds for the screen to refresh)

Code: Select all
SELECT TOP 1
        NameStyle ,
        Title ,
        FirstName ,
        MiddleName ,
        LastName ,
        Suffix ,
        EmailAddress ,
        EmailPromotion ,
        Phone ,
        PasswordHash ,
        PasswordSalt
FROM    Person.Contact
ORDER BY NEWID()
FOR     XML PATH('Contact') ,
            ROOT('Person')


Make sure you have Loop until number... Ticked.

HTH
CraigOttley
 
Posts: 13
Joined: Thu Jul 15, 2010 11:50 am
Location: Newport Pagnell


Return to SQL Data Generator 1

Who is online

Users browsing this forum: Google [Bot] and 0 guests