<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
		>
<channel>
	<title>Comments on: SQL SERVER &#8211; Tips from the SQL Joes 2 Pros Development Series &#8211; OpenXML Options &#8211; Day 35 of 35</title>
	<atom:link href="http://blog.sqlauthority.com/2011/09/04/sql-server-tips-from-the-sql-joes-2-pros-development-series-openxml-options-day-35-of-35/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.sqlauthority.com/2011/09/04/sql-server-tips-from-the-sql-joes-2-pros-development-series-openxml-options-day-35-of-35/</link>
	<description>Personal Notes of Pinal Dave</description>
	<lastBuildDate>Thu, 23 May 2013 14:22:59 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
	<item>
		<title>By: sharath molagavalli</title>
		<link>http://blog.sqlauthority.com/2011/09/04/sql-server-tips-from-the-sql-joes-2-pros-development-series-openxml-options-day-35-of-35/#comment-440081</link>
		<dc:creator><![CDATA[sharath molagavalli]]></dc:creator>
		<pubDate>Tue, 19 Mar 2013 11:56:20 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=14179#comment-440081</guid>
		<description><![CDATA[Can somebody explain the difference between flag 0 argument &amp; flag 1 argument
, of OPENXML function]]></description>
		<content:encoded><![CDATA[<p>Can somebody explain the difference between flag 0 argument &amp; flag 1 argument<br />
, of OPENXML function</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: SQL SERVER &#8211; Understanding XML &#8211; Contest Win Joes 2 Pros Combo (USD 198) &#8211; Day 5 of 5 &#171; SQL Server Journey with SQL Authority</title>
		<link>http://blog.sqlauthority.com/2011/09/04/sql-server-tips-from-the-sql-joes-2-pros-development-series-openxml-options-day-35-of-35/#comment-327986</link>
		<dc:creator><![CDATA[SQL SERVER &#8211; Understanding XML &#8211; Contest Win Joes 2 Pros Combo (USD 198) &#8211; Day 5 of 5 &#171; SQL Server Journey with SQL Authority]]></dc:creator>
		<pubDate>Fri, 10 Aug 2012 01:31:44 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=14179#comment-327986</guid>
		<description><![CDATA[[...] SQL Joes 2 Pros Development Series – OpenXML Options [...]]]></description>
		<content:encoded><![CDATA[<p>[...] SQL Joes 2 Pros Development Series – OpenXML Options [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Connie Lihme</title>
		<link>http://blog.sqlauthority.com/2011/09/04/sql-server-tips-from-the-sql-joes-2-pros-development-series-openxml-options-day-35-of-35/#comment-277438</link>
		<dc:creator><![CDATA[Connie Lihme]]></dc:creator>
		<pubDate>Thu, 19 Apr 2012 02:55:00 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=14179#comment-277438</guid>
		<description><![CDATA[Gordon - We have a position open in Plano, TX for a Data Analyst. If you are interested, could you contact me -Thank you very much]]></description>
		<content:encoded><![CDATA[<p>Gordon &#8211; We have a position open in Plano, TX for a Data Analyst. If you are interested, could you contact me -Thank you very much</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kevin Scharnhorst</title>
		<link>http://blog.sqlauthority.com/2011/09/04/sql-server-tips-from-the-sql-joes-2-pros-development-series-openxml-options-day-35-of-35/#comment-166274</link>
		<dc:creator><![CDATA[Kevin Scharnhorst]]></dc:creator>
		<pubDate>Wed, 07 Sep 2011 16:40:13 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=14179#comment-166274</guid>
		<description><![CDATA[Correct answer is option #2

Kevin Scharnhorst
United States]]></description>
		<content:encoded><![CDATA[<p>Correct answer is option #2</p>
<p>Kevin Scharnhorst<br />
United States</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: SQL SERVER – A Guide to Integrating SQL Server with XML, C#, and PowerShell – Book Available for SQL Server Certification Journey to SQLAuthority</title>
		<link>http://blog.sqlauthority.com/2011/09/04/sql-server-tips-from-the-sql-joes-2-pros-development-series-openxml-options-day-35-of-35/#comment-166107</link>
		<dc:creator><![CDATA[SQL SERVER – A Guide to Integrating SQL Server with XML, C#, and PowerShell – Book Available for SQL Server Certification Journey to SQLAuthority]]></dc:creator>
		<pubDate>Wed, 07 Sep 2011 02:13:51 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=14179#comment-166107</guid>
		<description><![CDATA[[...] Q 35) SQL SERVER – Tips from the SQL Joes 2 Pros Development Series – OpenXML Options – Day 35 of 3... [...]]]></description>
		<content:encoded><![CDATA[<p>[...] Q 35) SQL SERVER – Tips from the SQL Joes 2 Pros Development Series – OpenXML Options – Day 35 of 3&#8230; [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Raghav</title>
		<link>http://blog.sqlauthority.com/2011/09/04/sql-server-tips-from-the-sql-joes-2-pros-development-series-openxml-options-day-35-of-35/#comment-165963</link>
		<dc:creator><![CDATA[Raghav]]></dc:creator>
		<pubDate>Tue, 06 Sep 2011 12:13:03 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=14179#comment-165963</guid>
		<description><![CDATA[Tricky one. Hope this helps me in future]]></description>
		<content:encoded><![CDATA[<p>Tricky one. Hope this helps me in future</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Don</title>
		<link>http://blog.sqlauthority.com/2011/09/04/sql-server-tips-from-the-sql-joes-2-pros-development-series-openxml-options-day-35-of-35/#comment-165762</link>
		<dc:creator><![CDATA[Don]]></dc:creator>
		<pubDate>Mon, 05 Sep 2011 20:51:52 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=14179#comment-165762</guid>
		<description><![CDATA[I meant to say Option 2 will produce the correct results.

Don]]></description>
		<content:encoded><![CDATA[<p>I meant to say Option 2 will produce the correct results.</p>
<p>Don</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: pinaldave</title>
		<link>http://blog.sqlauthority.com/2011/09/04/sql-server-tips-from-the-sql-joes-2-pros-development-series-openxml-options-day-35-of-35/#comment-165735</link>
		<dc:creator><![CDATA[pinaldave]]></dc:creator>
		<pubDate>Mon, 05 Sep 2011 17:34:40 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=14179#comment-165735</guid>
		<description><![CDATA[The correct answer of the question is 

SELECT Storename, StoreHours.query(&#039;data(/hours[@dayofWeek=&quot;Wednesday&quot;]/@open)&#039;)
FROM Building]]></description>
		<content:encoded><![CDATA[<p>The correct answer of the question is </p>
<p>SELECT Storename, StoreHours.query(&#8216;data(/hours[@dayofWeek="Wednesday"]/@open)&#8217;)<br />
FROM Building</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: pinaldave</title>
		<link>http://blog.sqlauthority.com/2011/09/04/sql-server-tips-from-the-sql-joes-2-pros-development-series-openxml-options-day-35-of-35/#comment-165731</link>
		<dc:creator><![CDATA[pinaldave]]></dc:creator>
		<pubDate>Mon, 05 Sep 2011 17:14:05 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=14179#comment-165731</guid>
		<description><![CDATA[As this was the last question - it was posted as indeed tricky question. We have received two correct answer. I must congratulate winners for the same. 

&lt;p style=&quot;text-align:justify;&quot;&gt;A.)None is the correct answer.&lt;/p&gt;
&lt;p style=&quot;text-align:justify;&quot;&gt;Winner from USA&lt;b&gt;&lt;a href=&quot;http://blog.sqlauthority.com/2011/09/04/sql-server-tips-from-the-sql-joes-2-pros-development-series-openxml-options-day-35-of-35/#comment-165275&quot; rel=&quot;nofollow&quot;&gt;Naomi&lt;/a&gt;&lt;/b&gt;&lt;/p&gt;
&lt;p style=&quot;text-align:justify;&quot;&gt;Winner from India: &lt;b&gt;&lt;a href=&quot;http://blog.sqlauthority.com/2011/09/04/sql-server-tips-from-the-sql-joes-2-pros-development-series-openxml-options-day-35-of-35/#comment-165604&quot; rel=&quot;nofollow&quot;&gt;Mitesh Modi&lt;/a&gt;&lt;/b&gt;&lt;/p&gt;



I thank you all for participating here. The permanent record of this update is posted on &lt;a href=&quot;http://www.facebook.com/SQLAuth?sk=app_179191362131547&quot; rel=&quot;nofollow&quot;&gt;facebook&lt;/a&gt; page.]]></description>
		<content:encoded><![CDATA[<p>As this was the last question &#8211; it was posted as indeed tricky question. We have received two correct answer. I must congratulate winners for the same. </p>
<p style="text-align:justify;">A.)None is the correct answer.</p>
<p style="text-align:justify;">Winner from USA<b><a href="http://blog.sqlauthority.com/2011/09/04/sql-server-tips-from-the-sql-joes-2-pros-development-series-openxml-options-day-35-of-35/#comment-165275" rel="nofollow">Naomi</a></b></p>
<p style="text-align:justify;">Winner from India: <b><a href="http://blog.sqlauthority.com/2011/09/04/sql-server-tips-from-the-sql-joes-2-pros-development-series-openxml-options-day-35-of-35/#comment-165604" rel="nofollow">Mitesh Modi</a></b></p>
<p>I thank you all for participating here. The permanent record of this update is posted on <a href="http://www.facebook.com/SQLAuth?sk=app_179191362131547" rel="nofollow">facebook</a> page.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bill Pepping</title>
		<link>http://blog.sqlauthority.com/2011/09/04/sql-server-tips-from-the-sql-joes-2-pros-development-series-openxml-options-day-35-of-35/#comment-165672</link>
		<dc:creator><![CDATA[Bill Pepping]]></dc:creator>
		<pubDate>Mon, 05 Sep 2011 13:42:12 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=14179#comment-165672</guid>
		<description><![CDATA[Hi Naomi,

Thanks for the input.  

You are correct regarding that EXIST doesn&#039;t show all the data.  

While I didn&#039;t just see 8 am in my result set, I clearly wasn&#039;t retrieving all of the Wednesday opening times.  

Thanks for the insight.


Bill]]></description>
		<content:encoded><![CDATA[<p>Hi Naomi,</p>
<p>Thanks for the input.  </p>
<p>You are correct regarding that EXIST doesn&#8217;t show all the data.  </p>
<p>While I didn&#8217;t just see 8 am in my result set, I clearly wasn&#8217;t retrieving all of the Wednesday opening times.  </p>
<p>Thanks for the insight.</p>
<p>Bill</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: vaishali</title>
		<link>http://blog.sqlauthority.com/2011/09/04/sql-server-tips-from-the-sql-joes-2-pros-development-series-openxml-options-day-35-of-35/#comment-165632</link>
		<dc:creator><![CDATA[vaishali]]></dc:creator>
		<pubDate>Mon, 05 Sep 2011 10:42:56 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=14179#comment-165632</guid>
		<description><![CDATA[option 2 is correct answer.

Vaishali
Country of residence: Hyderabad, India]]></description>
		<content:encoded><![CDATA[<p>option 2 is correct answer.</p>
<p>Vaishali<br />
Country of residence: Hyderabad, India</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Narendra</title>
		<link>http://blog.sqlauthority.com/2011/09/04/sql-server-tips-from-the-sql-joes-2-pros-development-series-openxml-options-day-35-of-35/#comment-165609</link>
		<dc:creator><![CDATA[Narendra]]></dc:creator>
		<pubDate>Mon, 05 Sep 2011 09:47:07 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=14179#comment-165609</guid>
		<description><![CDATA[Option -2 is the Correct answer 


Thanks
Narendra(India)]]></description>
		<content:encoded><![CDATA[<p>Option -2 is the Correct answer </p>
<p>Thanks<br />
Narendra(India)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mahmad Khoja</title>
		<link>http://blog.sqlauthority.com/2011/09/04/sql-server-tips-from-the-sql-joes-2-pros-development-series-openxml-options-day-35-of-35/#comment-165607</link>
		<dc:creator><![CDATA[Mahmad Khoja]]></dc:creator>
		<pubDate>Mon, 05 Sep 2011 09:34:32 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=14179#comment-165607</guid>
		<description><![CDATA[The correct answer is option 2

SELECT StoreName, StoreHours. value(‘/hours[1]/@open’,&#039;time’)
FROM Buildings
WHERE StoreHours.exist(‘/hours[@dayofWeek=&quot; Wednesday&quot;]‘) = 1 


Mahmad Khoja
India]]></description>
		<content:encoded><![CDATA[<p>The correct answer is option 2</p>
<p>SELECT StoreName, StoreHours. value(‘/hours[1]/@open’,&#8217;time’)<br />
FROM Buildings<br />
WHERE StoreHours.exist(‘/hours[@dayofWeek=" Wednesday"]‘) = 1 </p>
<p>Mahmad Khoja<br />
India</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: miteshmca</title>
		<link>http://blog.sqlauthority.com/2011/09/04/sql-server-tips-from-the-sql-joes-2-pros-development-series-openxml-options-day-35-of-35/#comment-165604</link>
		<dc:creator><![CDATA[miteshmca]]></dc:creator>
		<pubDate>Mon, 05 Sep 2011 09:30:01 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=14179#comment-165604</guid>
		<description><![CDATA[ANS : None

I agree with Naomi
Ans given by Naomi using Cross Apply which is working.

IF I run the third option I get the same error as Naomi
Msg 2396, Level 16, State 1, Line 35
XQuery [@Buildings.StoreHours.query()]: Attribute may not appear outside of an element

Error Solution
------------------
Use the data() function to query attributes and resolve this problem


DECLARE @Buildings table(StoreName varchar(10), StoreHours XML)
INSERT INTO @Buildings( StoreName, StoreHours )
VALUES  ( &#039;A&#039;,
          &#039;



&#039;
          )

INSERT INTO @Buildings( StoreName, StoreHours )
VALUES  ( &#039;B&#039;,
          &#039;



&#039;
          )
INSERT INTO @Buildings( StoreName, StoreHours )
VALUES  ( &#039;C&#039;, 
          &#039;



&#039;
          )

--SELECT * FROM @Buildings
declare @Day varchar(20)
set @Day = &#039;Wednesday&#039;


SELECT Storename, StoreHours.query(&#039;data(/hours[@dayofWeek=&quot;Wednesday&quot;]/@open)&#039;) AS &#039;WedOpenTime&#039;
FROM @Buildings

StoreName          WedOpenTime
A	                    6:00
B	                    7:00
C	                    8:00

Mitesh Modi
(India)]]></description>
		<content:encoded><![CDATA[<p>ANS : None</p>
<p>I agree with Naomi<br />
Ans given by Naomi using Cross Apply which is working.</p>
<p>IF I run the third option I get the same error as Naomi<br />
Msg 2396, Level 16, State 1, Line 35<br />
XQuery [@Buildings.StoreHours.query()]: Attribute may not appear outside of an element</p>
<p>Error Solution<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
Use the data() function to query attributes and resolve this problem</p>
<p>DECLARE @Buildings table(StoreName varchar(10), StoreHours XML)<br />
INSERT INTO @Buildings( StoreName, StoreHours )<br />
VALUES  ( &#8216;A&#8217;,<br />
          &#8216;</p>
<p>&#8216;<br />
          )</p>
<p>INSERT INTO @Buildings( StoreName, StoreHours )<br />
VALUES  ( &#8216;B&#8217;,<br />
          &#8216;</p>
<p>&#8216;<br />
          )<br />
INSERT INTO @Buildings( StoreName, StoreHours )<br />
VALUES  ( &#8216;C&#8217;,<br />
          &#8216;</p>
<p>&#8216;<br />
          )</p>
<p>&#8211;SELECT * FROM @Buildings<br />
declare @Day varchar(20)<br />
set @Day = &#8216;Wednesday&#8217;</p>
<p>SELECT Storename, StoreHours.query(&#8216;data(/hours[@dayofWeek="Wednesday"]/@open)&#8217;) AS &#8216;WedOpenTime&#8217;<br />
FROM @Buildings</p>
<p>StoreName          WedOpenTime<br />
A	                    6:00<br />
B	                    7:00<br />
C	                    8:00</p>
<p>Mitesh Modi<br />
(India)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: madhivanan</title>
		<link>http://blog.sqlauthority.com/2011/09/04/sql-server-tips-from-the-sql-joes-2-pros-development-series-openxml-options-day-35-of-35/#comment-165599</link>
		<dc:creator><![CDATA[madhivanan]]></dc:creator>
		<pubDate>Mon, 05 Sep 2011 08:55:16 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=14179#comment-165599</guid>
		<description><![CDATA[Option 2

2.SELECT StoreName, StoreHours. value(‘/hours[1]/@open’,&#039;time’)
FROM Buildings
WHERE StoreHours.exist(‘/hours[@dayofWeek=&quot; Wednesday&quot;]‘) = 1

Country:India]]></description>
		<content:encoded><![CDATA[<p>Option 2</p>
<p>2.SELECT StoreName, StoreHours. value(‘/hours[1]/@open’,&#8217;time’)<br />
FROM Buildings<br />
WHERE StoreHours.exist(‘/hours[@dayofWeek=" Wednesday"]‘) = 1</p>
<p>Country:India</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nikhildas</title>
		<link>http://blog.sqlauthority.com/2011/09/04/sql-server-tips-from-the-sql-joes-2-pros-development-series-openxml-options-day-35-of-35/#comment-165590</link>
		<dc:creator><![CDATA[Nikhildas]]></dc:creator>
		<pubDate>Mon, 05 Sep 2011 08:27:58 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=14179#comment-165590</guid>
		<description><![CDATA[Correct Answer option #2

SELECT StoreName, StoreHours. value(‘/hours[1]/@open’,&#039;time’)
FROM Buildings
WHERE StoreHours.exist(‘/hours[@dayofWeek=&quot; Wednesday&quot;]‘) = 1


Nikhildas
Cochin
INDIA]]></description>
		<content:encoded><![CDATA[<p>Correct Answer option #2</p>
<p>SELECT StoreName, StoreHours. value(‘/hours[1]/@open’,&#8217;time’)<br />
FROM Buildings<br />
WHERE StoreHours.exist(‘/hours[@dayofWeek=" Wednesday"]‘) = 1</p>
<p>Nikhildas<br />
Cochin<br />
INDIA</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rajesh Mohanrangan</title>
		<link>http://blog.sqlauthority.com/2011/09/04/sql-server-tips-from-the-sql-joes-2-pros-development-series-openxml-options-day-35-of-35/#comment-165584</link>
		<dc:creator><![CDATA[Rajesh Mohanrangan]]></dc:creator>
		<pubDate>Mon, 05 Sep 2011 07:36:06 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=14179#comment-165584</guid>
		<description><![CDATA[Answer: option 2

Regards
Rajesh
From india]]></description>
		<content:encoded><![CDATA[<p>Answer: option 2</p>
<p>Regards<br />
Rajesh<br />
From india</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rajneesh Verma</title>
		<link>http://blog.sqlauthority.com/2011/09/04/sql-server-tips-from-the-sql-joes-2-pros-development-series-openxml-options-day-35-of-35/#comment-165560</link>
		<dc:creator><![CDATA[Rajneesh Verma]]></dc:creator>
		<pubDate>Mon, 05 Sep 2011 05:27:55 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=14179#comment-165560</guid>
		<description><![CDATA[I will use &quot;SELECT StoreName, StoreHours. value(‘/hours[1]/@open’,&#039;time’)
FROM Buildings&quot; 
Option 2 is the correct Answer.

Thanks Pinal for this series. I read all the questions and also tried to give answers. I won a Book also.:)

Rajneesh Verma
(INDIA)]]></description>
		<content:encoded><![CDATA[<p>I will use &#8220;SELECT StoreName, StoreHours. value(‘/hours[1]/@open’,&#8217;time’)<br />
FROM Buildings&#8221;<br />
Option 2 is the correct Answer.</p>
<p>Thanks Pinal for this series. I read all the questions and also tried to give answers. I won a Book also.:)</p>
<p>Rajneesh Verma<br />
(INDIA)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kalyanasundaram.K</title>
		<link>http://blog.sqlauthority.com/2011/09/04/sql-server-tips-from-the-sql-joes-2-pros-development-series-openxml-options-day-35-of-35/#comment-165545</link>
		<dc:creator><![CDATA[Kalyanasundaram.K]]></dc:creator>
		<pubDate>Mon, 05 Sep 2011 04:26:29 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=14179#comment-165545</guid>
		<description><![CDATA[Correct Answer : Option 2

2 ) SELECT StoreName, StoreHours. value(‘/hours[1]/@open’,&#039;time’)
     FROM Buildings
     WHERE StoreHours.exist(‘/hours[@dayofWeek=&quot; Wednesday&quot;]‘) = 1

Its bit complex to choose correct answer for Day35 Blog Quiz Series.

Chennai, Tamilnadu, India]]></description>
		<content:encoded><![CDATA[<p>Correct Answer : Option 2</p>
<p>2 ) SELECT StoreName, StoreHours. value(‘/hours[1]/@open’,&#8217;time’)<br />
     FROM Buildings<br />
     WHERE StoreHours.exist(‘/hours[@dayofWeek=" Wednesday"]‘) = 1</p>
<p>Its bit complex to choose correct answer for Day35 Blog Quiz Series.</p>
<p>Chennai, Tamilnadu, India</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Naomi</title>
		<link>http://blog.sqlauthority.com/2011/09/04/sql-server-tips-from-the-sql-joes-2-pros-development-series-openxml-options-day-35-of-35/#comment-165520</link>
		<dc:creator><![CDATA[Naomi]]></dc:creator>
		<pubDate>Mon, 05 Sep 2011 02:22:02 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=14179#comment-165520</guid>
		<description><![CDATA[Hi Bill,

Make sure to create different store hours for every day (say, put some exotic values for Wednesday) and re-test. You&#039;ll notice, that the second option (with the modifications) will return the first record and not the Wednesday open hours. The reason is that &#039;exist&#039; option checks for existence of the option (in this case it checks that Wednesday exists and it&#039;s true), but it doesn&#039;t select that option.

So, the correct answer to this question - none of the options as presented returns the correct result.]]></description>
		<content:encoded><![CDATA[<p>Hi Bill,</p>
<p>Make sure to create different store hours for every day (say, put some exotic values for Wednesday) and re-test. You&#8217;ll notice, that the second option (with the modifications) will return the first record and not the Wednesday open hours. The reason is that &#8216;exist&#8217; option checks for existence of the option (in this case it checks that Wednesday exists and it&#8217;s true), but it doesn&#8217;t select that option.</p>
<p>So, the correct answer to this question &#8211; none of the options as presented returns the correct result.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Deb</title>
		<link>http://blog.sqlauthority.com/2011/09/04/sql-server-tips-from-the-sql-joes-2-pros-development-series-openxml-options-day-35-of-35/#comment-165517</link>
		<dc:creator><![CDATA[Deb]]></dc:creator>
		<pubDate>Mon, 05 Sep 2011 02:00:09 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=14179#comment-165517</guid>
		<description><![CDATA[With as little as I know about SQL and XML, I would think #2 would be the  answer.

SELECT StoreName, StoreHours. value(‘/hours[1]/@open’,&#039;time’)
FROM Buildings
WHERE StoreHours.exist(‘/hours[@dayofWeek=&quot; Wednesday&quot;]‘) = 1

Unfortunately with it being a weekend I do not have access to sql mgmt studio to check it.  I would think the space before Wed would create a problem.  The third one just doesn&#039;t look right to me and the first one might work but I&#039;m not sure about the where clause. I know how exists works and I feel better about the second option.

USA]]></description>
		<content:encoded><![CDATA[<p>With as little as I know about SQL and XML, I would think #2 would be the  answer.</p>
<p>SELECT StoreName, StoreHours. value(‘/hours[1]/@open’,&#8217;time’)<br />
FROM Buildings<br />
WHERE StoreHours.exist(‘/hours[@dayofWeek=" Wednesday"]‘) = 1</p>
<p>Unfortunately with it being a weekend I do not have access to sql mgmt studio to check it.  I would think the space before Wed would create a problem.  The third one just doesn&#8217;t look right to me and the first one might work but I&#8217;m not sure about the where clause. I know how exists works and I feel better about the second option.</p>
<p>USA</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bill Pepping</title>
		<link>http://blog.sqlauthority.com/2011/09/04/sql-server-tips-from-the-sql-joes-2-pros-development-series-openxml-options-day-35-of-35/#comment-165504</link>
		<dc:creator><![CDATA[Bill Pepping]]></dc:creator>
		<pubDate>Mon, 05 Sep 2011 00:55:55 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=14179#comment-165504</guid>
		<description><![CDATA[Hi Pinal,
 
Challenge:
Question 35
You have a table named Buildings that has an XML column named StoreHours. This column contains the opening and closing times:




…



You need to write a query that returns a list of Buildings and their opening time for Wednesday.  Which code segment should you use?

1.SELECT StoreName, StoreHours. value(‘/hours[1]/@open’,&#039;time’)
FROM Buildings
WHERE StoreHours.value(‘/hours[1]/@dayofWeek’,&#039;varchar(20)’) = @Day

2.SELECT StoreName, StoreHours. value(‘/hours[1]/@open’,&#039;time’)
FROM Buildings
WHERE StoreHours.exist(‘/hours[@dayofWeek=&quot; Wednesday&quot;]‘) = 1

3.SELECT Storename, StoreHours.query(‘/hours[@dayofWeek=&quot;Wednesday&quot;]/@open’)
FROM Buildings

Correct Answer:
The correct choice is # 2, with some slight SQL syntax modifications.

Explanation:
Besides replacing the single and double quotation marks (they were italics), the query still doesn&#039;t return any data unless you remove the space in 
&quot; Wednesday&quot; (use &quot;Wednesday&quot;).  Here is what my final query looked like&quot;:


SELECT StoreName, convert(varchar(5), StoreHours.value(&#039;/hours[1]/@open&#039;,&#039;time&#039;), 8) + &#039; AM&#039;  as &#039;Opening Time on Wednesdays&#039;
FROM Buildings
WHERE StoreHours.exist(&#039;/hours[@dayofWeek=&quot;Wednesday&quot;]&#039;) = 1


Here is the data I retrieved (after creating a Buildings table and inserting StoreName (varchar) and Opening Times (XML data)):

StoreName	Opening Time on Wednesdays

Super Market	08:00 AM
Sports Arena	10:00 AM
Office		08:00 AM



Country:
United States
 
Thanks for the knowledge!
 
Regards,
 
Bill Pepping]]></description>
		<content:encoded><![CDATA[<p>Hi Pinal,</p>
<p>Challenge:<br />
Question 35<br />
You have a table named Buildings that has an XML column named StoreHours. This column contains the opening and closing times:</p>
<p>…</p>
<p>You need to write a query that returns a list of Buildings and their opening time for Wednesday.  Which code segment should you use?</p>
<p>1.SELECT StoreName, StoreHours. value(‘/hours[1]/@open’,&#8217;time’)<br />
FROM Buildings<br />
WHERE StoreHours.value(‘/hours[1]/@dayofWeek’,&#8217;varchar(20)’) = @Day</p>
<p>2.SELECT StoreName, StoreHours. value(‘/hours[1]/@open’,&#8217;time’)<br />
FROM Buildings<br />
WHERE StoreHours.exist(‘/hours[@dayofWeek=" Wednesday"]‘) = 1</p>
<p>3.SELECT Storename, StoreHours.query(‘/hours[@dayofWeek="Wednesday"]/@open’)<br />
FROM Buildings</p>
<p>Correct Answer:<br />
The correct choice is # 2, with some slight SQL syntax modifications.</p>
<p>Explanation:<br />
Besides replacing the single and double quotation marks (they were italics), the query still doesn&#8217;t return any data unless you remove the space in<br />
&#8221; Wednesday&#8221; (use &#8220;Wednesday&#8221;).  Here is what my final query looked like&#8221;:</p>
<p>SELECT StoreName, convert(varchar(5), StoreHours.value(&#8216;/hours[1]/@open&#8217;,'time&#8217;), 8) + &#8216; AM&#8217;  as &#8216;Opening Time on Wednesdays&#8217;<br />
FROM Buildings<br />
WHERE StoreHours.exist(&#8216;/hours[@dayofWeek="Wednesday"]&#8216;) = 1</p>
<p>Here is the data I retrieved (after creating a Buildings table and inserting StoreName (varchar) and Opening Times (XML data)):</p>
<p>StoreName	Opening Time on Wednesdays</p>
<p>Super Market	08:00 AM<br />
Sports Arena	10:00 AM<br />
Office		08:00 AM</p>
<p>Country:<br />
United States</p>
<p>Thanks for the knowledge!</p>
<p>Regards,</p>
<p>Bill Pepping</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Gordon Kane</title>
		<link>http://blog.sqlauthority.com/2011/09/04/sql-server-tips-from-the-sql-joes-2-pros-development-series-openxml-options-day-35-of-35/#comment-165497</link>
		<dc:creator><![CDATA[Gordon Kane]]></dc:creator>
		<pubDate>Mon, 05 Sep 2011 00:00:44 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=14179#comment-165497</guid>
		<description><![CDATA[2.SELECT StoreName, StoreHours. value(‘/hours[1]/@open’,&#039;time’)
 FROM Buildings
 WHERE StoreHours.exist(‘/hours[@dayofWeek=&quot; Wednesday&quot;]‘) = 1

Gordon Kane
Allen TX
USA]]></description>
		<content:encoded><![CDATA[<p>2.SELECT StoreName, StoreHours. value(‘/hours[1]/@open’,&#8217;time’)<br />
 FROM Buildings<br />
 WHERE StoreHours.exist(‘/hours[@dayofWeek=" Wednesday"]‘) = 1</p>
<p>Gordon Kane<br />
Allen TX<br />
USA</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sowmiya Duraisamy</title>
		<link>http://blog.sqlauthority.com/2011/09/04/sql-server-tips-from-the-sql-joes-2-pros-development-series-openxml-options-day-35-of-35/#comment-165481</link>
		<dc:creator><![CDATA[Sowmiya Duraisamy]]></dc:creator>
		<pubDate>Sun, 04 Sep 2011 21:33:07 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=14179#comment-165481</guid>
		<description><![CDATA[Option 2 is correct.
SELECT StoreName, StoreHours. value(‘/hours[1]/@open’,&#039;time’)
FROM Buildings
WHERE StoreHours.exist(‘/hours[@dayofWeek=&quot; Wednesday&quot;]‘) = 1

If &quot;Wednesday&quot; exist then the opening hours will be retrieved and displayed.

I&#039;m from USA]]></description>
		<content:encoded><![CDATA[<p>Option 2 is correct.<br />
SELECT StoreName, StoreHours. value(‘/hours[1]/@open’,&#8217;time’)<br />
FROM Buildings<br />
WHERE StoreHours.exist(‘/hours[@dayofWeek=" Wednesday"]‘) = 1</p>
<p>If &#8220;Wednesday&#8221; exist then the opening hours will be retrieved and displayed.</p>
<p>I&#8217;m from USA</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Don</title>
		<link>http://blog.sqlauthority.com/2011/09/04/sql-server-tips-from-the-sql-joes-2-pros-development-series-openxml-options-day-35-of-35/#comment-165480</link>
		<dc:creator><![CDATA[Don]]></dc:creator>
		<pubDate>Sun, 04 Sep 2011 21:30:55 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=14179#comment-165480</guid>
		<description><![CDATA[Option will produce the desired results.

Country: United States]]></description>
		<content:encoded><![CDATA[<p>Option will produce the desired results.</p>
<p>Country: United States</p>
]]></content:encoded>
	</item>
</channel>
</rss>
