<?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, GetDate and Linq to Sql.</title>
	<atom:link href="http://peteohanlon.wordpress.com/2008/01/11/sql-server-getdate-and-linq-to-sql/feed/" rel="self" type="application/rss+xml" />
	<link>http://peteohanlon.wordpress.com/2008/01/11/sql-server-getdate-and-linq-to-sql/</link>
	<description>Confessions of a WPF lover</description>
	<lastBuildDate>Sat, 14 Nov 2009 07:45:20 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: معترض</title>
		<link>http://peteohanlon.wordpress.com/2008/01/11/sql-server-getdate-and-linq-to-sql/#comment-417</link>
		<dc:creator>معترض</dc:creator>
		<pubDate>Mon, 02 Nov 2009 09:13:01 +0000</pubDate>
		<guid isPermaLink="false">http://peteohanlon.wordpress.com/2008/01/11/sql-server-getdate-and-linq-to-sql/#comment-417</guid>
		<description>thanks very much
az taraf barobach</description>
		<content:encoded><![CDATA[<p>thanks very much<br />
az taraf barobach</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: peteohanlon</title>
		<link>http://peteohanlon.wordpress.com/2008/01/11/sql-server-getdate-and-linq-to-sql/#comment-124</link>
		<dc:creator>peteohanlon</dc:creator>
		<pubDate>Fri, 05 Dec 2008 12:56:48 +0000</pubDate>
		<guid isPermaLink="false">http://peteohanlon.wordpress.com/2008/01/11/sql-server-getdate-and-linq-to-sql/#comment-124</guid>
		<description>Nice - I&#039;ll have a try. I originally wrote this because I couldn&#039;t find a way to get the auto value, and the documentation for L2S was sparse at the time.</description>
		<content:encoded><![CDATA[<p>Nice &#8211; I&#8217;ll have a try. I originally wrote this because I couldn&#8217;t find a way to get the auto value, and the documentation for L2S was sparse at the time.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jman</title>
		<link>http://peteohanlon.wordpress.com/2008/01/11/sql-server-getdate-and-linq-to-sql/#comment-122</link>
		<dc:creator>jman</dc:creator>
		<pubDate>Thu, 04 Dec 2008 18:51:22 +0000</pubDate>
		<guid isPermaLink="false">http://peteohanlon.wordpress.com/2008/01/11/sql-server-getdate-and-linq-to-sql/#comment-122</guid>
		<description>There is a much easier and more efficient way of doing this. Simply navigate to your linq to sql(.dbml) file, click on the appropriate column and in the properties window set the &quot;Auto Generated Value&quot; to true. Now you dont have to spend time creating this function and calling it every time you want this to occur.

It would be nice if you didnt even have to set &quot;Auto Generated Value&quot; property at all however.</description>
		<content:encoded><![CDATA[<p>There is a much easier and more efficient way of doing this. Simply navigate to your linq to sql(.dbml) file, click on the appropriate column and in the properties window set the &#8220;Auto Generated Value&#8221; to true. Now you dont have to spend time creating this function and calling it every time you want this to occur.</p>
<p>It would be nice if you didnt even have to set &#8220;Auto Generated Value&#8221; property at all however.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Artiom</title>
		<link>http://peteohanlon.wordpress.com/2008/01/11/sql-server-getdate-and-linq-to-sql/#comment-54</link>
		<dc:creator>Artiom</dc:creator>
		<pubDate>Wed, 11 Jun 2008 19:07:44 +0000</pubDate>
		<guid isPermaLink="false">http://peteohanlon.wordpress.com/2008/01/11/sql-server-getdate-and-linq-to-sql/#comment-54</guid>
		<description>Actually there is an advantage, and quite a big one..
If you use the code that Jay provided, the query will be ran separately, and the date will be passed as a parameter. Furthermore, it can&#039;t be used in precompiled queries!

With the code provided by peteohanlon, linq will replace your GetSystemDate call in the linq query with GetDate in the resulting SQL query! And it can be used in precompiled queries :)

It can also be used just to get the datetime though. In this case both are pretty much identical..

Regards,
Artiom</description>
		<content:encoded><![CDATA[<p>Actually there is an advantage, and quite a big one..<br />
If you use the code that Jay provided, the query will be ran separately, and the date will be passed as a parameter. Furthermore, it can&#8217;t be used in precompiled queries!</p>
<p>With the code provided by peteohanlon, linq will replace your GetSystemDate call in the linq query with GetDate in the resulting SQL query! And it can be used in precompiled queries <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>It can also be used just to get the datetime though. In this case both are pretty much identical..</p>
<p>Regards,<br />
Artiom</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: peteohanlon</title>
		<link>http://peteohanlon.wordpress.com/2008/01/11/sql-server-getdate-and-linq-to-sql/#comment-27</link>
		<dc:creator>peteohanlon</dc:creator>
		<pubDate>Fri, 15 Feb 2008 10:40:29 +0000</pubDate>
		<guid isPermaLink="false">http://peteohanlon.wordpress.com/2008/01/11/sql-server-getdate-and-linq-to-sql/#comment-27</guid>
		<description>Jay - there&#039;s no advantage to this, other than it&#039;s more Linq trickery.</description>
		<content:encoded><![CDATA[<p>Jay &#8211; there&#8217;s no advantage to this, other than it&#8217;s more Linq trickery.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jay</title>
		<link>http://peteohanlon.wordpress.com/2008/01/11/sql-server-getdate-and-linq-to-sql/#comment-26</link>
		<dc:creator>Jay</dc:creator>
		<pubDate>Thu, 14 Feb 2008 20:11:14 +0000</pubDate>
		<guid isPermaLink="false">http://peteohanlon.wordpress.com/2008/01/11/sql-server-getdate-and-linq-to-sql/#comment-26</guid>
		<description>Is there an advantage to this method over ExecuteQuery?
(VB)
Private Function GetServerTime() as DateTime
Dim result as IEnumerable(Of DateTime) = _
Me.ExecuteQuery(GetType(DateTime), _
&quot;SELECT GETDATE() AS CurrentSQLDateTime&quot;, _
New Object() {})
Return result.Single
End Function

If so, any idea of the VB syntax for those bracketed attributes?</description>
		<content:encoded><![CDATA[<p>Is there an advantage to this method over ExecuteQuery?<br />
(VB)<br />
Private Function GetServerTime() as DateTime<br />
Dim result as IEnumerable(Of DateTime) = _<br />
Me.ExecuteQuery(GetType(DateTime), _<br />
&#8220;SELECT GETDATE() AS CurrentSQLDateTime&#8221;, _<br />
New Object() {})<br />
Return result.Single<br />
End Function</p>
<p>If so, any idea of the VB syntax for those bracketed attributes?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: DW</title>
		<link>http://peteohanlon.wordpress.com/2008/01/11/sql-server-getdate-and-linq-to-sql/#comment-19</link>
		<dc:creator>DW</dc:creator>
		<pubDate>Mon, 21 Jan 2008 23:09:59 +0000</pubDate>
		<guid isPermaLink="false">http://peteohanlon.wordpress.com/2008/01/11/sql-server-getdate-and-linq-to-sql/#comment-19</guid>
		<description>Thanks for the tip, its cool to see that we can use attributes to access SQL functions like that.</description>
		<content:encoded><![CDATA[<p>Thanks for the tip, its cool to see that we can use attributes to access SQL functions like that.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
