I'm doing a feasibility study for storing data in the following structure with SQL SERVER 2008:
-MYTABLE |ID|RECORDS|BRANCH_OFFICE|MONTH|YEAR
The RECORDS column has the XML data type and it will look like:
<visits>
<visit id="000112233">
<costumer>Mr. One Costumer</costumer>
<date>2011-02-10</date>
<employee>MAT01234</employee>
</visit>
<visit id="000112234">
<costumer>Mr. Another Costumer</costumer>
<date>2011-02-12</date>
<employee>MAT01235</employee>
</visit>
<visit id="000112235">
<costumer>Mr. Some Costumer</costumer>
<date>2011-02-12</date>
<employee>MAT01234</employee>
</visit>
<visit id="000112236">
<costumer>Mr. Some Costumer</costumer>
<date>2011-02-15</date>
<employee>MAT01235</employee>
</visit>
</visits>
I'm intending to query the xml column with xquery, is this a good way to store these data? If i want to get the list of visits occurring in 2011-10, adding a tag with the difference of days between the "date" tag and now, how could it be?
