Welcome to dbFreaks.com!
FAQFAQ      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

Shredding XML Question

 
   Database Help (Home) -> XML RSS
Next:  UTF-8  
Author Message
user

External


Since: Jun 21, 2007
Posts: 1



(Msg. 1) Posted: Thu Jun 21, 2007 7:28 pm
Post subject: Shredding XML Question
Archived from groups: microsoft>public>sqlserver>xml (more info?)

I need to bring the following data in an xml format (many more years
included) into the table listed at the bottom of this request.

This data is in a large text file, say in c:\calendar.xml

<Calendar>
<ActualDate>2005-01-01T00:00:00</ActualDate>
<MonthName>January </MonthName>
<DayNumber>1</DayNumber>
<YearNumber>2005</YearNumber>
<DayOfWeek>Saturday </DayOfWeek>
<DayType>Holiday </DayType>
</Calendar>
<Calendar>
<ActualDate>2005-01-02T00:00:00</ActualDate>
<MonthName>January </MonthName>
<DayNumber>2</DayNumber>
<YearNumber>2005</YearNumber>
<DayOfWeek>Sunday </DayOfWeek>
<DayType>Weekend </DayType>
</Calendar>
<Calendar>
<ActualDate>2005-01-03T00:00:00</ActualDate>
<MonthName>January </MonthName>
<DayNumber>3</DayNumber>
<YearNumber>2005</YearNumber>
<DayOfWeek>Monday </DayOfWeek>
<DayType>Business </DayType>
</Calendar>

The relational table definition is as listed:

CREATE TABLE Calendar

(

ActualDate DATETIME NOT NULL PRIMARY KEY,

MonthName CHAR(15) NULL,

DayNumber INT NULL,

YearNumber INT NULL,

DayOfWeek CHAR(15) NULL

CHECK (DayOfWeek IN ('Sunday','Monday','Tuesday',

'Wednesday', 'Thursday', 'Friday', 'Saturday')),

DayType CHAR(15) NULL

CHECK (DayType IN ('Business','Weekend', 'Holiday')),

)





Thank you in advance.

 >> Stay informed about: Shredding XML Question 
Back to top
Login to vote
Adam Machanic

External


Since: Jan 21, 2008
Posts: 7



(Msg. 2) Posted: Thu Jun 21, 2007 10:37 pm
Post subject: Re: Shredding XML Question [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

See if you can modify the example in this thread to suit your needs:

http://simple-talk.com/community/forums/thread/30267.aspx


--

Adam Machanic
SQL Server MVP

Author, "Expert SQL Server 2005 Development"
http://www.apress.com/book/bookDisplay.html?bID=10220



<TenKMan> wrote in message news:O2C6nyGtHHA.4888@TK2MSFTNGP02.phx.gbl...
>I need to bring the following data in an xml format (many more years
> included) into the table listed at the bottom of this request.
>
> This data is in a large text file, say in c:\calendar.xml
>
> <Calendar>
> <ActualDate>2005-01-01T00:00:00</ActualDate>
> <MonthName>January </MonthName>
> <DayNumber>1</DayNumber>
> <YearNumber>2005</YearNumber>
> <DayOfWeek>Saturday </DayOfWeek>
> <DayType>Holiday </DayType>
> </Calendar>
> <Calendar>
> <ActualDate>2005-01-02T00:00:00</ActualDate>
> <MonthName>January </MonthName>
> <DayNumber>2</DayNumber>
> <YearNumber>2005</YearNumber>
> <DayOfWeek>Sunday </DayOfWeek>
> <DayType>Weekend </DayType>
> </Calendar>
> <Calendar>
> <ActualDate>2005-01-03T00:00:00</ActualDate>
> <MonthName>January </MonthName>
> <DayNumber>3</DayNumber>
> <YearNumber>2005</YearNumber>
> <DayOfWeek>Monday </DayOfWeek>
> <DayType>Business </DayType>
> </Calendar>
>
> The relational table definition is as listed:
>
> CREATE TABLE Calendar
>
> (
>
> ActualDate DATETIME NOT NULL PRIMARY KEY,
>
> MonthName CHAR(15) NULL,
>
> DayNumber INT NULL,
>
> YearNumber INT NULL,
>
> DayOfWeek CHAR(15) NULL
>
> CHECK (DayOfWeek IN ('Sunday','Monday','Tuesday',
>
> 'Wednesday', 'Thursday', 'Friday', 'Saturday')),
>
> DayType CHAR(15) NULL
>
> CHECK (DayType IN ('Business','Weekend', 'Holiday')),
>
> )
>
>
>
>
>
> Thank you in advance.
>
>
>

 >> Stay informed about: Shredding XML Question 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
BulkLoad question - In order to upload data using SQLXML Bulkload, must the data and schema reside in a file, or can you store the data to a variable, then use Bulkload ?

XML Question - Hello I have the following XML file <?xml version="1.0" encoding="us-ascii" ?> - <clsProdDataSingleBill> - <PhoneNo> <string>0893877610</string> </PhoneNo> - <Email> <string>D...

Easy query question - This one should be easy, but for some reason I can't get it. I have a table with an XML column, containing the following: <xs:ReservationChargeItem xmlns:xs="http://www.hoboo.com/ReservationSchema" DropOffCode="" PickUpCode=&quo...

SQL 2005 For Xml Path question - In the SQL 2005 Books Online section titled "Using PATH Mode", there is an example near the bottom that results in the following XML. Is there a way to get the xml so it's encoded correctly (not using < >)? Not sure why it's doing th...

tuning question, relation between indexes and "for xml pat.. - ,Hi, I'm facing very strange problem here. I made index analysis by quering dynamic views, and found that bunch of indexes is not being used at all. Beside that, I found bunch of indexes which are duplicated. For example, on the same set of columns,..
   Database Help (Home) -> XML All times are: Pacific Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You can edit your posts in this forum
You can delete your posts in this forum
You can vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]