<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-4326747173526655599</id><updated>2024-10-24T10:37:12.470-07:00</updated><title type='text'>Developers Network</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://dev-eloper.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4326747173526655599/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://dev-eloper.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>13</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-4326747173526655599.post-6589340065457599969</id><published>2013-08-05T21:15:00.000-07:00</published><updated>2013-08-05T21:15:18.629-07:00</updated><title type='text'>Set Width of GridView BoundField</title><content type='html'>

ItemStyle-Width=&quot;40%&quot; ItemStyle-Wrap=&quot;false&quot; in the BoundField tag</content><link rel='replies' type='application/atom+xml' href='http://dev-eloper.blogspot.com/feeds/6589340065457599969/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4326747173526655599/6589340065457599969' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4326747173526655599/posts/default/6589340065457599969'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4326747173526655599/posts/default/6589340065457599969'/><link rel='alternate' type='text/html' href='http://dev-eloper.blogspot.com/2013/08/set-width-of-gridview-boundfield.html' title='Set Width of GridView BoundField'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4326747173526655599.post-1822871906541347339</id><published>2012-10-08T06:35:00.001-07:00</published><updated>2012-10-08T06:35:47.087-07:00</updated><title type='text'>Create A Comma Delimited List From a Column</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div class=&quot;post-body entry-content&quot;&gt;
&lt;p&gt;&lt;span style=&quot;font-family: verdana&quot;&gt;In this article I will try to show you a simple example on how to Create a Comma Delimited List from a column also called as CSV (Comma Separated Values).&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style=&quot;font-family: verdana&quot;&gt;For example here is our Sample Table -&lt;/span&gt;&lt;/p&gt;  &lt;table style=&quot;color: #ffffff&quot; bordercolordark=&quot;#c0c0c0&quot; width=&quot;127&quot; bordercolorlight=&quot;#c0c0c0&quot; border=&quot;1&quot; bg=&quot;bg&quot;&gt;&lt;tbody&gt;     &lt;tr bgcolor=&quot;#c6c3b5&quot;&gt;       &lt;td width=&quot;42&quot;&gt;&lt;strong&gt;&lt;span style=&quot;font-family: verdana&quot;&gt;&lt;font color=&quot;#000000&quot;&gt;Id&lt;/font&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/td&gt;        &lt;td width=&quot;83&quot;&gt;&lt;strong&gt;&lt;span style=&quot;font-family: verdana&quot;&gt;&lt;font color=&quot;#000000&quot;&gt;Names&lt;/font&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td width=&quot;42&quot;&gt;&lt;span style=&quot;font-family: verdana&quot;&gt;&lt;font color=&quot;#000000&quot;&gt;1&lt;/font&gt;&lt;/span&gt;&lt;/td&gt;        &lt;td width=&quot;83&quot;&gt;&lt;span style=&quot;font-family: verdana&quot;&gt;&lt;font color=&quot;#000000&quot;&gt;A&lt;/font&gt;&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td width=&quot;42&quot;&gt;&lt;span style=&quot;font-family: verdana&quot;&gt;&lt;font color=&quot;#000000&quot;&gt;1&lt;/font&gt;&lt;/span&gt;&lt;/td&gt;        &lt;td width=&quot;83&quot;&gt;&lt;span style=&quot;font-family: verdana&quot;&gt;&lt;font color=&quot;#000000&quot;&gt;B&lt;/font&gt;&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td width=&quot;42&quot;&gt;&lt;span style=&quot;font-family: verdana&quot;&gt;&lt;font color=&quot;#000000&quot;&gt;1&lt;/font&gt;&lt;/span&gt;&lt;/td&gt;        &lt;td width=&quot;83&quot;&gt;&lt;span style=&quot;font-family: verdana&quot;&gt;&lt;font color=&quot;#000000&quot;&gt;C&lt;/font&gt;&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td width=&quot;42&quot;&gt;&lt;span style=&quot;font-family: verdana&quot;&gt;&lt;font color=&quot;#000000&quot;&gt;2&lt;/font&gt;&lt;/span&gt;&lt;/td&gt;        &lt;td width=&quot;83&quot;&gt;&lt;span style=&quot;font-family: verdana&quot;&gt;&lt;font color=&quot;#000000&quot;&gt;A&lt;/font&gt;&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td width=&quot;42&quot;&gt;&lt;span style=&quot;font-family: verdana&quot;&gt;&lt;font color=&quot;#000000&quot;&gt;2&lt;/font&gt;&lt;/span&gt;&lt;/td&gt;        &lt;td width=&quot;83&quot;&gt;&lt;span style=&quot;font-family: verdana&quot;&gt;&lt;font color=&quot;#000000&quot;&gt;B&lt;/font&gt;&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td width=&quot;42&quot;&gt;&lt;span style=&quot;font-family: verdana&quot;&gt;&lt;font color=&quot;#000000&quot;&gt;3&lt;/font&gt;&lt;/span&gt;&lt;/td&gt;        &lt;td width=&quot;83&quot;&gt;&lt;span style=&quot;font-family: verdana&quot;&gt;&lt;font color=&quot;#000000&quot;&gt;X&lt;/font&gt;&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td width=&quot;42&quot;&gt;&lt;span style=&quot;font-family: verdana&quot;&gt;&lt;font color=&quot;#000000&quot;&gt;3&lt;/font&gt;&lt;/span&gt;&lt;/td&gt;        &lt;td width=&quot;83&quot;&gt;&lt;span style=&quot;font-family: verdana&quot;&gt;&lt;font color=&quot;#000000&quot;&gt;Y&lt;/font&gt;&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td width=&quot;42&quot;&gt;&lt;span style=&quot;font-family: verdana&quot;&gt;&lt;font color=&quot;#000000&quot;&gt;3&lt;/font&gt;&lt;/span&gt;&lt;/td&gt;        &lt;td width=&quot;83&quot;&gt;&lt;span style=&quot;font-family: verdana&quot;&gt;&lt;font color=&quot;#000000&quot;&gt;Z&lt;/font&gt;&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;&lt;span style=&quot;font-family: verdana&quot;&gt;&lt;font color=&quot;#000000&quot;&gt;And here is the expected output -&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style=&quot;font-family: verdana&quot;&gt;&lt;font color=&quot;#000000&quot;&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;table style=&quot;color: #ffffff&quot; bordercolordark=&quot;#c0c0c0&quot; width=&quot;132&quot; bordercolorlight=&quot;#c0c0c0&quot; border=&quot;1&quot; bg=&quot;bg&quot;&gt;&lt;tbody&gt;     &lt;tr bgcolor=&quot;#c6c3b5&quot;&gt;       &lt;td width=&quot;41&quot;&gt;&lt;strong&gt;&lt;span style=&quot;font-family: verdana&quot;&gt;&lt;font color=&quot;#000000&quot;&gt;Id&lt;/font&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/td&gt;        &lt;td width=&quot;89&quot;&gt;&lt;strong&gt;&lt;span style=&quot;font-family: verdana&quot;&gt;&lt;font color=&quot;#000000&quot;&gt;AllNames&lt;/font&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td width=&quot;41&quot;&gt;&lt;span style=&quot;font-family: verdana&quot;&gt;&lt;font color=&quot;#000000&quot;&gt;1&lt;/font&gt;&lt;/span&gt;&lt;/td&gt;        &lt;td width=&quot;89&quot;&gt;&lt;span style=&quot;font-family: verdana&quot;&gt;&lt;font color=&quot;#000000&quot;&gt;A, B, C&lt;/font&gt;&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td width=&quot;41&quot;&gt;&lt;span style=&quot;font-family: verdana&quot;&gt;&lt;font color=&quot;#000000&quot;&gt;2&lt;/font&gt;&lt;/span&gt;&lt;/td&gt;        &lt;td width=&quot;89&quot;&gt;&lt;span style=&quot;font-family: verdana&quot;&gt;&lt;font color=&quot;#000000&quot;&gt;A, B&lt;/font&gt;&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td width=&quot;41&quot;&gt;&lt;span style=&quot;font-family: verdana&quot;&gt;&lt;font color=&quot;#000000&quot;&gt;3&lt;/font&gt;&lt;/span&gt;&lt;/td&gt;        &lt;td width=&quot;89&quot;&gt;&lt;span style=&quot;font-family: verdana&quot;&gt;&lt;font color=&quot;#000000&quot;&gt;X, Y, Z&lt;/font&gt;&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;&lt;span style=&quot;font-family: verdana&quot;&gt;Though in above example I have used Comma, sometimes it may required to use other delimiters as well, like Single space (A B C) or Vertical bar (A | B | C) or may be some other delimiter. &lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style=&quot;font-family: verdana&quot;&gt;Create Sample Data -&lt;/span&gt;&lt;/p&gt;  &lt;table style=&quot;color: #f4f4f4&quot; bordercolordark=&quot;#000000&quot; width=&quot;561&quot; bgcolor=&quot;#f4f4f4&quot; bordercolorlight=&quot;#f4f4f4&quot; border=&quot;0&quot; bg=&quot;bg&quot;&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td width=&quot;559&quot;&gt;&lt;span style=&quot;font-family: verdana&quot;&gt;&lt;span style=&quot;color: #008040&quot;&gt;--&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&lt;span style=&quot;color: #008040&quot;&gt;Create sample table&lt;/span&gt;&lt;/span&gt;             &lt;br&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;CREATE&lt;/span&gt; &lt;span style=&quot;color: #0000ff&quot;&gt;TABLE&lt;/span&gt; &lt;font color=&quot;#000000&quot;&gt;Test &lt;/font&gt;            &lt;br&gt;&lt;font color=&quot;#000000&quot;&gt;(              &lt;br&gt;Id&lt;/font&gt; &lt;span style=&quot;color: #0000ff&quot;&gt;INT&lt;/span&gt;,             &lt;br&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&lt;span style=&quot;color: #000000&quot;&gt;Names&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;color: #0000ff&quot;&gt;VARCHAR&lt;/span&gt;&lt;font color=&quot;#000000&quot;&gt;(100)&lt;/font&gt;             &lt;br&gt;&lt;font color=&quot;#000000&quot;&gt;)&lt;/font&gt;             &lt;br&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;GO&lt;/span&gt;             &lt;br&gt;&lt;/span&gt;&lt;span style=&quot;color: #008040&quot;&gt;&lt;span style=&quot;font-family: verdana&quot;&gt;-- Load sample data&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&lt;span style=&quot;font-family: verdana&quot;&gt;                &lt;br&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana&quot;&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;INSERT&lt;/span&gt; &lt;span style=&quot;color: #0000ff&quot;&gt;INTO&lt;/span&gt; &lt;font color=&quot;#000000&quot;&gt;Test&lt;/font&gt; &lt;span style=&quot;color: #0000ff&quot;&gt;SELECT&lt;/span&gt;             &lt;br&gt;&lt;font color=&quot;#000000&quot;&gt;1,&lt;/font&gt;&lt;span style=&quot;color: #006080&quot;&gt;&lt;span style=&quot;color: #ff0000&quot;&gt;&#39;A&#39;&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;color: #0000ff&quot;&gt;UNION&lt;/span&gt; &lt;span style=&quot;color: #0000ff&quot;&gt;ALL&lt;/span&gt; &lt;span style=&quot;color: #0000ff&quot;&gt;SELECT&lt;/span&gt;             &lt;br&gt;&lt;font color=&quot;#000000&quot;&gt;1,&lt;/font&gt;&lt;span style=&quot;color: #006080&quot;&gt;&lt;span style=&quot;color: #ff0000&quot;&gt;&#39;B&#39;&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;color: #0000ff&quot;&gt;UNION&lt;/span&gt; &lt;span style=&quot;color: #0000ff&quot;&gt;ALL&lt;/span&gt; &lt;span style=&quot;color: #0000ff&quot;&gt;SELECT&lt;/span&gt;             &lt;br&gt;&lt;font color=&quot;#000000&quot;&gt;1,&lt;/font&gt;&lt;span style=&quot;color: #006080&quot;&gt;&lt;span style=&quot;color: #ff0000&quot;&gt;&#39;C&#39;&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;color: #0000ff&quot;&gt;UNION&lt;/span&gt; &lt;span style=&quot;color: #0000ff&quot;&gt;ALL&lt;/span&gt; &lt;span style=&quot;color: #0000ff&quot;&gt;SELECT&lt;/span&gt;             &lt;br&gt;&lt;font color=&quot;#000000&quot;&gt;2,&lt;/font&gt;&lt;span style=&quot;color: #006080&quot;&gt;&lt;span style=&quot;color: #ff0000&quot;&gt;&#39;A&#39;&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;color: #0000ff&quot;&gt;UNION&lt;/span&gt; &lt;span style=&quot;color: #0000ff&quot;&gt;ALL&lt;/span&gt; &lt;span style=&quot;color: #0000ff&quot;&gt;SELECT&lt;/span&gt;&lt;font color=&quot;#000000&quot;&gt;              &lt;br&gt;2,&lt;/font&gt;&lt;span style=&quot;color: #006080&quot;&gt;&lt;span style=&quot;color: #ff0000&quot;&gt;&#39;B&#39;&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;color: #0000ff&quot;&gt;UNION&lt;/span&gt; &lt;span style=&quot;color: #0000ff&quot;&gt;ALL&lt;/span&gt; &lt;span style=&quot;color: #0000ff&quot;&gt;SELECT&lt;/span&gt;             &lt;br&gt;&lt;font color=&quot;#000000&quot;&gt;3,&lt;/font&gt;&lt;span style=&quot;color: #006080&quot;&gt;&lt;span style=&quot;color: #ff0000&quot;&gt;&#39;X&#39;&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;color: #0000ff&quot;&gt;UNION&lt;/span&gt; &lt;span style=&quot;color: #0000ff&quot;&gt;ALL&lt;/span&gt; &lt;span style=&quot;color: #0000ff&quot;&gt;SELECT&lt;/span&gt;             &lt;br&gt;&lt;font color=&quot;#000000&quot;&gt;3,&lt;/font&gt;&lt;span style=&quot;color: #006080&quot;&gt;&lt;span style=&quot;color: #ff0000&quot;&gt;&#39;Y&#39;&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;color: #0000ff&quot;&gt;UNION&lt;/span&gt; &lt;span style=&quot;color: #0000ff&quot;&gt;ALL&lt;/span&gt; &lt;span style=&quot;color: #0000ff&quot;&gt;SELECT&lt;/span&gt;&lt;font color=&quot;#000000&quot;&gt;              &lt;br&gt;3,&lt;/font&gt;&lt;span style=&quot;color: #006080&quot;&gt;&lt;span style=&quot;color: #ff0000&quot;&gt;&#39;Z&#39;&lt;/span&gt;&lt;/span&gt;             &lt;br&gt;&lt;font color=&quot;#000000&quot;&gt;GO&lt;/font&gt;&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;&lt;span style=&quot;font-family: verdana&quot;&gt;&lt;/span&gt;&lt;/p&gt; &lt;span style=&quot;font-family: verdana&quot;&gt;SQL Server 2005 / SQL Server 2008 Solution for Comma delimiter.&lt;/span&gt;   &lt;br&gt;&lt;span style=&quot;font-family: verdana&quot;&gt;&lt;strong&gt;1st Solution -&lt;/strong&gt;&lt;/span&gt;   &lt;br&gt;  &lt;table style=&quot;color: #f4f4f4&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; width=&quot;556&quot; bgcolor=&quot;#f4f4f4&quot; border=&quot;0&quot; bg=&quot;bg&quot;&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td valign=&quot;top&quot; width=&quot;554&quot;&gt;         &lt;p&gt;&lt;span style=&quot;font-family: verdana&quot;&gt;&lt;font color=&quot;#000000&quot;&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;SELECT&lt;/span&gt; T1.Id&amp;nbsp; &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ,AllNames = &lt;span style=&quot;color: #ff00ff&quot;&gt;SubString&lt;/span&gt; (( &lt;span style=&quot;color: #0000ff&quot;&gt;SELECT&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;&#39;, &#39;&lt;/span&gt; + T2.Names                 &lt;br&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;FROM&lt;/span&gt; Test as T2                 &lt;br&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;WHERE&lt;/span&gt; T1.Id = T2.Id                 &lt;br&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;FOR XML PATH&lt;/span&gt; ( &lt;span style=&quot;color: #ff0000&quot;&gt;&#39;&#39;&lt;/span&gt; ) ), 3, 1000)                 &lt;br&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;FROM&lt;/span&gt; Test as T1                 &lt;br&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;GROUP BY&lt;/span&gt; Id&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;&lt;span style=&quot;font-family: verdana&quot;&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style=&quot;font-family: verdana&quot;&gt;If the column “Names” doesn’t contain any spaces in between its values then here is another solution -&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style=&quot;font-family: verdana&quot;&gt;&lt;strong&gt;2nd solution -&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;  &lt;table style=&quot;color: #f4f4f4&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; width=&quot;556&quot; bgcolor=&quot;#f4f4f4&quot; border=&quot;0&quot; bg=&quot;bg&quot;&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td valign=&quot;top&quot; width=&quot;554&quot;&gt;         &lt;p&gt;&lt;span style=&quot;font-family: verdana&quot;&gt;&lt;font color=&quot;#000000&quot;&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;SELECT&lt;/span&gt; T1.Id                 &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ,AllNames = &lt;span style=&quot;color: #ff00ff&quot;&gt;REPLACE&lt;/span&gt; (( &lt;span style=&quot;color: #0000ff&quot;&gt;SELECT&lt;/span&gt; T2.Names AS &lt;/font&gt;&lt;font color=&quot;#000000&quot;&gt;&lt;span style=&quot;color: #ff0000&quot;&gt;&#39;data()&#39;                  &lt;br&gt;&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;FROM&lt;/span&gt; Test as T2                 &lt;br&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;WHERE&lt;/span&gt; T1.Id = T2.Id                 &lt;br&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;FOR XML PATH&lt;/span&gt; ( &lt;span style=&quot;color: #ff0000&quot;&gt;&#39;&#39;&lt;/span&gt; ) ), &lt;span style=&quot;color: #ff0000&quot;&gt;&#39; &#39;&lt;/span&gt;, &lt;span style=&quot;color: #ff0000&quot;&gt;&#39;, &#39;&lt;/span&gt;)                 &lt;br&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;FROM&lt;/span&gt; Test as T1                 &lt;br&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;GROUP BY&lt;/span&gt;&lt;/font&gt; Id&lt;/span&gt;&lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;&lt;span style=&quot;font-family: verdana&quot;&gt;Advantage with 2nd solution is that if the data type of column whose value you want to concatenate is INT or any other noncharacter data type you don’t need to CONVERT it into varchar data type. In 1st solution you will need to convert the column to Varchar if its original data type is numeric. But 2nd solution will fail in case there are some in-between spaces in column values. &lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style=&quot;font-family: verdana&quot;&gt;Now if you want to create the list using other delimiter, replace comma from above query with your required delimiter.&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style=&quot;font-family: verdana&quot;&gt;E.g. for Vertical Bar &lt;/span&gt;&lt;span style=&quot;font-family: verdana&quot;&gt;&lt;/span&gt;&lt;/p&gt;  &lt;table style=&quot;color: #f4f4f4&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; width=&quot;556&quot; border=&quot;0&quot; bg=&quot;bg&quot;&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td valign=&quot;top&quot; width=&quot;554&quot;&gt;         &lt;p&gt;&lt;span style=&quot;font-family: verdana&quot;&gt;&lt;font color=&quot;#000000&quot;&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;SELECT&lt;/span&gt; T1.Id&amp;nbsp; &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ,AllNames = &lt;span style=&quot;color: #ff00ff&quot;&gt;SubString&lt;/span&gt; (( &lt;span style=&quot;color: #0000ff&quot;&gt;SELECT&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;&#39;| &#39;&lt;/span&gt; + T2.Names                 &lt;br&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;FROM&lt;/span&gt; Test as T2                 &lt;br&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;WHERE&lt;/span&gt; T1.Id = T2.Id                 &lt;br&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;FOR XML PATH&lt;/span&gt; ( &lt;span style=&quot;color: #ff0000&quot;&gt;&#39;&#39;&lt;/span&gt; ) ), 3, 1000)                 &lt;br&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;FROM&lt;/span&gt; Test as T1                 &lt;br&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;GROUP BY&lt;/span&gt; Id&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;&lt;span style=&quot;font-size: 100%; color: #ff0000; font-family: trebuchet ms&quot;&gt;&lt;strong&gt;&lt;em&gt;&lt;/em&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;  
&lt;div style=&quot;clear: both;&quot;&gt;&lt;/div&gt;
&lt;/div&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dev-eloper.blogspot.com/feeds/1822871906541347339/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4326747173526655599/1822871906541347339' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4326747173526655599/posts/default/1822871906541347339'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4326747173526655599/posts/default/1822871906541347339'/><link rel='alternate' type='text/html' href='http://dev-eloper.blogspot.com/2012/10/create-comma-delimited-list-from-column.html' title='Create A Comma Delimited List From a Column'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4326747173526655599.post-1964979169650929528</id><published>2012-07-19T23:16:00.002-07:00</published><updated>2012-07-19T23:18:31.374-07:00</updated><title type='text'>Work out min and hours</title><content type='html'>I have a minute value and i want to have to 2 string values one with how many hours and the other with the minutes, e.g.:&lt;br /&gt;&lt;br /&gt;Value - 121 minutes&lt;br /&gt;&lt;br /&gt;var span = System.TimeSpan.FromMinutes(121);&lt;br /&gt;var hours = ((int)span.TotalHours).ToString();     &lt;br /&gt;var minutes = span.Minutes.ToString();&lt;br /&gt;&lt;br /&gt;The ToString() is because you asked for string values ...&lt;br /&gt;&lt;br /&gt;TotalHours are the complete hours in the TimeSpan, they can be more than 24 (whereas the &quot;Hours&quot; field has a maximum of 24)&lt;br /&gt;&lt;br /&gt;Oh, and on second thought: Why use the TimeSpan and not calculate it yourself? Because TimeSpan is already there debugged &amp; tested by Microsoft, it has a nice clean interface (looking at the code you easily see whats going on without having to follow a calculation mentally) and it easily extends to further solutions. (Have the input in seconds? Use TimeSpan.FromSeconds(). Want the days? Use span.TotalDays ...)&lt;br /&gt;&lt;br /&gt;Update:&lt;br /&gt;&lt;br /&gt;I just noticed mistake in my answer: TotalHours returns a fractional value of all the hours, so we have to truncate it to an integer before converting it to a string.</content><link rel='replies' type='application/atom+xml' href='http://dev-eloper.blogspot.com/feeds/1964979169650929528/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4326747173526655599/1964979169650929528' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4326747173526655599/posts/default/1964979169650929528'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4326747173526655599/posts/default/1964979169650929528'/><link rel='alternate' type='text/html' href='http://dev-eloper.blogspot.com/2012/07/work-out-min-and-hours.html' title='Work out min and hours'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4326747173526655599.post-8766956834210774353</id><published>2012-06-25T23:54:00.001-07:00</published><updated>2012-06-25T23:54:45.923-07:00</updated><title type='text'>Extended Date Formats</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;table class=&quot;bodytext&quot; style=&quot;FONT-SIZE: 10px&quot; cellspacing=&quot;0&quot; cellpadding=&quot;3&quot; border=&quot;1&quot;&gt;
             &lt;tbody&gt;&lt;tr style=&quot;FONT-WEIGHT: bold; COLOR: #FFFFFF&quot; align=&quot;center&quot; bgcolor=&quot;#669900&quot;&gt;
              &lt;td colspan=&quot;3&quot;&gt;Extended Date Formats&lt;/td&gt;
             &lt;/tr&gt;
             &lt;tr style=&quot;FONT-WEIGHT: bold&quot; align=&quot;center&quot; bgcolor=&quot;#CCFF99&quot;&gt;
              &lt;td&gt;Date Format&lt;/td&gt;
              &lt;td&gt;SQL Statement&lt;/td&gt;
              &lt;td&gt;Sample Output&lt;/td&gt;
             &lt;/tr&gt;
             &lt;tr&gt;
              &lt;td align=&quot;center&quot;&gt;YY-MM-DD&lt;/td&gt;
              &lt;td&gt;
               &lt;div&gt;SELECT SUBSTRING(CONVERT(VARCHAR(10), GETDATE(), 120), 3, 8) AS [YY-MM-DD]&lt;/div&gt;
               &lt;div&gt;SELECT REPLACE(CONVERT(VARCHAR(8), GETDATE(), 11), &#39;/&#39;, &#39;-&#39;) AS [YY-MM-DD]&lt;/div&gt;
              &lt;/td&gt;
              &lt;td align=&quot;center&quot;&gt;99-01-24&lt;/td&gt;
             &lt;/tr&gt;
             &lt;tr&gt;
              &lt;td align=&quot;center&quot;&gt;YYYY-MM-DD&lt;/td&gt;
              &lt;td&gt;
               &lt;div&gt;SELECT CONVERT(VARCHAR(10), GETDATE(), 120) AS [YYYY-MM-DD]&lt;/div&gt;
               &lt;div&gt;SELECT REPLACE(CONVERT(VARCHAR(10), GETDATE(), 111), &#39;/&#39;, &#39;-&#39;) AS [YYYY-MM-DD]&lt;/div&gt;
              &lt;/td&gt;
              &lt;td align=&quot;center&quot;&gt;1999-01-24&lt;/td&gt;
             &lt;/tr&gt;
             &lt;tr&gt;
              &lt;td align=&quot;center&quot;&gt;MM/YY&lt;/td&gt;
              &lt;td&gt;SELECT RIGHT(CONVERT(VARCHAR(8), GETDATE(), 3), 5) AS [MM/YY]&lt;br&gt;
               SELECT SUBSTRING(CONVERT(VARCHAR(8), GETDATE(), 3), 4, 5) AS [MM/YY]&lt;/td&gt;
              &lt;td align=&quot;center&quot;&gt;08/99&lt;/td&gt;
             &lt;/tr&gt;
             &lt;tr&gt;
              &lt;td align=&quot;center&quot;&gt;MM/YYYY&lt;/td&gt;
              &lt;td&gt;SELECT RIGHT(CONVERT(VARCHAR(10), GETDATE(), 103), 7) AS [MM/YYYY]&lt;/td&gt;
              &lt;td align=&quot;center&quot;&gt;12/2005&lt;/td&gt;
             &lt;/tr&gt;
             &lt;tr&gt;
              &lt;td align=&quot;center&quot;&gt;YY/MM&lt;/td&gt;
              &lt;td&gt;SELECT CONVERT(VARCHAR(5), GETDATE(), 11) AS [YY/MM]&lt;/td&gt;
              &lt;td align=&quot;center&quot;&gt;99/08&lt;/td&gt;
             &lt;/tr&gt;
             &lt;tr&gt;
              &lt;td style=&quot;HEIGHT: 23px&quot; align=&quot;center&quot;&gt;YYYY/MM&lt;/td&gt;
              &lt;td style=&quot;HEIGHT: 23px&quot;&gt;SELECT CONVERT(VARCHAR(7), GETDATE(), 111) AS [YYYY/MM]&lt;/td&gt;
              &lt;td style=&quot;HEIGHT: 23px&quot; align=&quot;center&quot;&gt;2005/12&lt;/td&gt;
             &lt;/tr&gt;
             &lt;tr&gt;
              &lt;td align=&quot;center&quot;&gt;Month DD, YYYY &lt;sup style=&quot;COLOR: red&quot;&gt;1&lt;/sup&gt;&lt;/td&gt;
              &lt;td&gt;SELECT DATENAME(MM, GETDATE()) + RIGHT(CONVERT(VARCHAR(12), GETDATE(), 107), 9) 
               AS [Month DD, YYYY]&lt;/td&gt;
              &lt;td align=&quot;center&quot;&gt;July 04, 2006 &lt;sup style=&quot;COLOR: red&quot;&gt;1&lt;/sup&gt;&lt;/td&gt;
             &lt;/tr&gt;
             &lt;tr&gt;
              &lt;td align=&quot;center&quot;&gt;Mon YYYY &lt;sup style=&quot;COLOR: red&quot;&gt;1&lt;/sup&gt;&lt;/td&gt;
              &lt;td&gt;SELECT SUBSTRING(CONVERT(VARCHAR(11), GETDATE(), 113), 4, 8) AS [Mon YYYY]&lt;/td&gt;
              &lt;td align=&quot;center&quot;&gt;Apr 2006 &lt;sup style=&quot;COLOR: red&quot;&gt;1&lt;/sup&gt;&lt;/td&gt;
             &lt;/tr&gt;
             &lt;tr&gt;
              &lt;td align=&quot;center&quot;&gt;Month YYYY &lt;sup style=&quot;COLOR: red&quot;&gt;1&lt;/sup&gt;&lt;/td&gt;
              &lt;td&gt;SELECT DATENAME(MM, GETDATE()) + &#39; &#39; + CAST(YEAR(GETDATE()) AS VARCHAR(4)) AS 
               [Month YYYY]
              &lt;/td&gt;
              &lt;td align=&quot;center&quot;&gt;February 2006 &lt;sup style=&quot;COLOR: red&quot;&gt;1&lt;/sup&gt;&lt;/td&gt;
             &lt;/tr&gt;
             &lt;tr&gt;
              &lt;td align=&quot;center&quot;&gt;DD Month &lt;sup style=&quot;COLOR: red&quot;&gt;1&lt;/sup&gt;&lt;/td&gt;
              &lt;td&gt;SELECT CAST(DAY(GETDATE()) AS VARCHAR(2)) + &#39; &#39; + DATENAME(MM, GETDATE()) AS 
               [DD Month]&lt;/td&gt;
              &lt;td align=&quot;center&quot;&gt;11 September &lt;sup style=&quot;COLOR: red&quot;&gt;1&lt;/sup&gt;&lt;/td&gt;
             &lt;/tr&gt;
             &lt;tr&gt;
              &lt;td align=&quot;center&quot;&gt;Month DD &lt;sup style=&quot;COLOR: red&quot;&gt;1&lt;/sup&gt;&lt;/td&gt;
              &lt;td&gt;SELECT DATENAME(MM, GETDATE()) + &#39; &#39; + CAST(DAY(GETDATE()) AS VARCHAR(2)) AS 
               [Month DD]&lt;/td&gt;
              &lt;td align=&quot;center&quot;&gt;September 11 &lt;sup style=&quot;COLOR: red&quot;&gt;1&lt;/sup&gt;&lt;/td&gt;
             &lt;/tr&gt;
             &lt;tr&gt;
              &lt;td align=&quot;center&quot;&gt;DD Month YY &lt;sup style=&quot;COLOR: red&quot;&gt;1&lt;/sup&gt;&lt;/td&gt;
              &lt;td&gt;SELECT CAST(DAY(GETDATE()) AS VARCHAR(2)) + &#39; &#39; + DATENAME(MM, GETDATE()) + &#39; &#39; 
               + RIGHT(CAST(YEAR(GETDATE()) AS VARCHAR(4)), 2) AS [DD Month YY]&lt;/td&gt;
              &lt;td align=&quot;center&quot;&gt;19 February 72 &lt;sup style=&quot;COLOR: red&quot;&gt;1&lt;/sup&gt;&lt;/td&gt;
             &lt;/tr&gt;
             &lt;tr&gt;
              &lt;td align=&quot;center&quot;&gt;DD Month YYYY &lt;sup style=&quot;COLOR: red&quot;&gt;1&lt;/sup&gt;&lt;/td&gt;
              &lt;td&gt;SELECT CAST(DAY(GETDATE()) AS VARCHAR(2)) + &#39; &#39; + DATENAME(MM, GETDATE()) + &#39; &#39; 
               + CAST(YEAR(GETDATE()) AS VARCHAR(4)) AS [DD Month YYYY]&lt;/td&gt;
              &lt;td align=&quot;center&quot;&gt;11 September 2002 &lt;sup style=&quot;COLOR: red&quot;&gt;1&lt;/sup&gt;&lt;/td&gt;
             &lt;/tr&gt;
             &lt;tr&gt;
              &lt;td align=&quot;center&quot;&gt;MM-YY&lt;/td&gt;
              &lt;td&gt;SELECT RIGHT(CONVERT(VARCHAR(8), GETDATE(), 5), 5) AS [MM-YY]&lt;br&gt;
               SELECT SUBSTRING(CONVERT(VARCHAR(8), GETDATE(), 5), 4, 5) AS [MM-YY]&lt;/td&gt;
              &lt;td align=&quot;center&quot;&gt;12/92&lt;/td&gt;
             &lt;/tr&gt;
             &lt;tr&gt;
              &lt;td align=&quot;center&quot;&gt;MM-YYYY&lt;/td&gt;
              &lt;td&gt;SELECT RIGHT(CONVERT(VARCHAR(10), GETDATE(), 105), 7) AS [MM-YYYY]&lt;/td&gt;
              &lt;td align=&quot;center&quot;&gt;05-2006&lt;/td&gt;
             &lt;/tr&gt;
             &lt;tr&gt;
              &lt;td align=&quot;center&quot;&gt;YY-MM&lt;/td&gt;
              &lt;td&gt;SELECT RIGHT(CONVERT(VARCHAR(7), GETDATE(), 120), 5) AS [YY-MM]&lt;br&gt;
               SELECT SUBSTRING(CONVERT(VARCHAR(10), GETDATE(), 120), 3, 5) AS [YY-MM]&lt;/td&gt;
              &lt;td align=&quot;center&quot;&gt;92/12&lt;/td&gt;
             &lt;/tr&gt;
             &lt;tr&gt;
              &lt;td align=&quot;center&quot;&gt;YYYY-MM&lt;/td&gt;
              &lt;td&gt;SELECT CONVERT(VARCHAR(7), GETDATE(), 120) AS [YYYY-MM]&lt;/td&gt;
              &lt;td align=&quot;center&quot;&gt;2006-05&lt;/td&gt;
             &lt;/tr&gt;
             &lt;tr&gt;
              &lt;td align=&quot;center&quot;&gt;MMDDYY&lt;/td&gt;
              &lt;td&gt;SELECT REPLACE(CONVERT(VARCHAR(10), GETDATE(), 1), &#39;/&#39;, &#39;&#39;) AS [MMDDYY]&lt;/td&gt;
              &lt;td align=&quot;center&quot;&gt;122506&lt;/td&gt;
             &lt;/tr&gt;
             &lt;tr&gt;
              &lt;td align=&quot;center&quot;&gt;MMDDYYYY&lt;/td&gt;
              &lt;td&gt;SELECT REPLACE(CONVERT(VARCHAR(10), GETDATE(), 101), &#39;/&#39;, &#39;&#39;) AS [MMDDYYYY]&lt;/td&gt;
              &lt;td align=&quot;center&quot;&gt;12252006&lt;/td&gt;
             &lt;/tr&gt;
             &lt;tr&gt;
              &lt;td align=&quot;center&quot;&gt;DDMMYY&lt;/td&gt;
              &lt;td&gt;SELECT REPLACE(CONVERT(VARCHAR(10), GETDATE(), 3), &#39;/&#39;, &#39;&#39;) AS [DDMMYY]&lt;/td&gt;
              &lt;td align=&quot;center&quot;&gt;240702&lt;/td&gt;
             &lt;/tr&gt;
             &lt;tr&gt;
              &lt;td align=&quot;center&quot;&gt;DDMMYYYY&lt;/td&gt;
              &lt;td&gt;SELECT REPLACE(CONVERT(VARCHAR(10), GETDATE(), 103), &#39;/&#39;, &#39;&#39;) AS [DDMMYYYY]&lt;/td&gt;
              &lt;td align=&quot;center&quot;&gt;24072002&lt;/td&gt;
             &lt;/tr&gt;
             &lt;tr&gt;
              &lt;td align=&quot;center&quot;&gt;Mon-YY &lt;sup style=&quot;COLOR: red&quot;&gt;1&lt;/sup&gt;&lt;/td&gt;
              &lt;td&gt;SELECT REPLACE(RIGHT(CONVERT(VARCHAR(9), GETDATE(), 6), 6), &#39; &#39;, &#39;-&#39;) AS 
               [Mon-YY]&lt;/td&gt;
              &lt;td align=&quot;center&quot;&gt;Sep-02 &lt;sup style=&quot;COLOR: red&quot;&gt;1&lt;/sup&gt;&lt;/td&gt;
             &lt;/tr&gt;
             &lt;tr&gt;
              &lt;td align=&quot;center&quot;&gt;Mon-YYYY &lt;sup style=&quot;COLOR: red&quot;&gt;1&lt;/sup&gt;&lt;/td&gt;
              &lt;td&gt;SELECT REPLACE(RIGHT(CONVERT(VARCHAR(11), GETDATE(), 106), 8), &#39; &#39;, &#39;-&#39;) AS 
               [Mon-YYYY]&lt;/td&gt;
              &lt;td align=&quot;center&quot;&gt;Sep-2002 &lt;sup style=&quot;COLOR: red&quot;&gt;1&lt;/sup&gt;&lt;/td&gt;
             &lt;/tr&gt;
             &lt;tr&gt;
              &lt;td align=&quot;center&quot;&gt;DD-Mon-YY &lt;sup style=&quot;COLOR: red&quot;&gt;1&lt;/sup&gt;&lt;/td&gt;
              &lt;td&gt;SELECT REPLACE(CONVERT(VARCHAR(9), GETDATE(), 6), &#39; &#39;, &#39;-&#39;) AS [DD-Mon-YY]&lt;/td&gt;
              &lt;td align=&quot;center&quot;&gt;25-Dec-05 &lt;sup style=&quot;COLOR: red&quot;&gt;1&lt;/sup&gt;&lt;/td&gt;
             &lt;/tr&gt;
             &lt;tr&gt;
              &lt;td align=&quot;center&quot;&gt;DD-Mon-YYYY &lt;sup style=&quot;COLOR: red&quot;&gt;1&lt;/sup&gt;&lt;/td&gt;
              &lt;td&gt;SELECT REPLACE(CONVERT(VARCHAR(11), GETDATE(), 106), &#39; &#39;, &#39;-&#39;) AS [DD-Mon-YYYY]&lt;/td&gt;
              &lt;td align=&quot;center&quot;&gt;25-Dec-2005 &lt;sup style=&quot;COLOR: red&quot;&gt;1&lt;/sup&gt;&lt;/td&gt;
             &lt;/tr&gt;
            &lt;/tbody&gt;&lt;/table&gt;
&lt;br /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4326747173526655599/posts/default/8766956834210774353'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4326747173526655599/posts/default/8766956834210774353'/><link rel='alternate' type='text/html' href='http://dev-eloper.blogspot.com/2012/06/extended-date-formats.html' title='Extended Date Formats'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-4326747173526655599.post-4871314176050673539</id><published>2012-06-25T23:53:00.000-07:00</published><updated>2012-06-25T23:53:53.000-07:00</updated><title type='text'>Standard Date Formats</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;table class=&quot;bodytext&quot; style=&quot;FONT-SIZE: 10px&quot; cellspacing=&quot;0&quot; cellpadding=&quot;3&quot; border=&quot;1&quot;&gt;
             &lt;tbody&gt;&lt;tr style=&quot;FONT-WEIGHT: bold; COLOR: #FFFFFF&quot; align=&quot;center&quot; bgcolor=&quot;#669900&quot;&gt;
              &lt;td colspan=&quot;4&quot;&gt;Standard Date Formats&lt;/td&gt;
             &lt;/tr&gt;
             &lt;tr style=&quot;FONT-WEIGHT: bold&quot; align=&quot;center&quot; bgcolor=&quot;#CCFF99&quot;&gt;
              &lt;td&gt;Date Format&lt;/td&gt;
              &lt;td&gt;Standard&lt;/td&gt;
              &lt;td&gt;SQL Statement&lt;/td&gt;
              &lt;td&gt;Sample Output&lt;/td&gt;
             &lt;/tr&gt;
             &lt;tr&gt;
              &lt;td align=&quot;center&quot;&gt;Mon DD YYYY &lt;sup style=&quot;COLOR: red&quot;&gt;1&lt;/sup&gt;&lt;br&gt;
               HH:MIAM (or PM)&lt;/td&gt;
              &lt;td align=&quot;center&quot;&gt;Default&lt;/td&gt;
              &lt;td&gt;SELECT CONVERT(VARCHAR(20), GETDATE(), 100)&lt;/td&gt;
              &lt;td align=&quot;center&quot;&gt;Jan 1 2005 1:29PM &lt;sup style=&quot;COLOR: red&quot;&gt;1&lt;/sup&gt;&lt;/td&gt;
             &lt;/tr&gt;
             &lt;tr&gt;
              &lt;td align=&quot;center&quot;&gt;MM/DD/YY&lt;/td&gt;
              &lt;td align=&quot;center&quot;&gt;USA&lt;/td&gt;
              &lt;td&gt;SELECT CONVERT(VARCHAR(8), GETDATE(), 1) AS [MM/DD/YY]&lt;/td&gt;
              &lt;td align=&quot;center&quot;&gt;11/23/98&lt;/td&gt;
             &lt;/tr&gt;
             &lt;tr&gt;
              &lt;td align=&quot;center&quot;&gt;MM/DD/YYYY&lt;/td&gt;
              &lt;td align=&quot;center&quot;&gt;USA&lt;/td&gt;
              &lt;td&gt;SELECT CONVERT(VARCHAR(10), GETDATE(), 101) AS [MM/DD/YYYY]&lt;/td&gt;
              &lt;td align=&quot;center&quot;&gt;11/23/1998&lt;/td&gt;
             &lt;/tr&gt;
             &lt;tr&gt;
              &lt;td align=&quot;center&quot;&gt;YY.MM.DD&lt;/td&gt;
              &lt;td align=&quot;center&quot;&gt;ANSI&lt;/td&gt;
              &lt;td&gt;SELECT CONVERT(VARCHAR(8), GETDATE(), 2) AS [YY.MM.DD]&lt;/td&gt;
              &lt;td align=&quot;center&quot;&gt;72.01.01&lt;/td&gt;
             &lt;/tr&gt;
             &lt;tr&gt;
              &lt;td align=&quot;center&quot;&gt;YYYY.MM.DD&lt;/td&gt;
              &lt;td align=&quot;center&quot;&gt;ANSI&lt;/td&gt;
              &lt;td&gt;SELECT CONVERT(VARCHAR(10), GETDATE(), 102) AS [YYYY.MM.DD]&lt;/td&gt;
              &lt;td align=&quot;center&quot;&gt;1972.01.01&lt;/td&gt;
             &lt;/tr&gt;
             &lt;tr&gt;
              &lt;td align=&quot;center&quot;&gt;DD/MM/YY&lt;/td&gt;
              &lt;td align=&quot;center&quot;&gt;British/French&lt;/td&gt;
              &lt;td&gt;SELECT CONVERT(VARCHAR(8), GETDATE(), 3) AS [DD/MM/YY]&lt;/td&gt;
              &lt;td align=&quot;center&quot;&gt;19/02/72&lt;/td&gt;
             &lt;/tr&gt;
             &lt;tr&gt;
              &lt;td align=&quot;center&quot;&gt;DD/MM/YYYY&lt;/td&gt;
              &lt;td align=&quot;center&quot;&gt;British/French&lt;/td&gt;
              &lt;td&gt;SELECT CONVERT(VARCHAR(10), GETDATE(), 103) AS [DD/MM/YYYY]&lt;/td&gt;
              &lt;td align=&quot;center&quot;&gt;19/02/1972&lt;/td&gt;
             &lt;/tr&gt;
             &lt;tr&gt;
              &lt;td align=&quot;center&quot;&gt;DD.MM.YY&lt;/td&gt;
              &lt;td align=&quot;center&quot;&gt;German&lt;/td&gt;
              &lt;td&gt;SELECT CONVERT(VARCHAR(8), GETDATE(), 4) AS [DD.MM.YY]&lt;/td&gt;
              &lt;td align=&quot;center&quot;&gt;25.12.05&lt;/td&gt;
             &lt;/tr&gt;
             &lt;tr&gt;
              &lt;td align=&quot;center&quot;&gt;DD.MM.YYYY&lt;/td&gt;
              &lt;td align=&quot;center&quot;&gt;German&lt;/td&gt;
              &lt;td&gt;SELECT CONVERT(VARCHAR(10), GETDATE(), 104) AS [DD.MM.YYYY]&lt;/td&gt;
              &lt;td align=&quot;center&quot;&gt;25.12.2005&lt;/td&gt;
             &lt;/tr&gt;
             &lt;tr&gt;
              &lt;td align=&quot;center&quot;&gt;DD-MM-YY&lt;/td&gt;
              &lt;td align=&quot;center&quot;&gt;Italian&lt;/td&gt;
              &lt;td&gt;SELECT CONVERT(VARCHAR(8), GETDATE(), 5) AS [DD-MM-YY]&lt;/td&gt;
              &lt;td align=&quot;center&quot;&gt;24-01-98&lt;/td&gt;
             &lt;/tr&gt;
             &lt;tr&gt;
              &lt;td align=&quot;center&quot;&gt;DD-MM-YYYY&lt;/td&gt;
              &lt;td align=&quot;center&quot;&gt;Italian&lt;/td&gt;
              &lt;td&gt;SELECT CONVERT(VARCHAR(10), GETDATE(), 105) AS [DD-MM-YYYY]&lt;/td&gt;
              &lt;td align=&quot;center&quot;&gt;24-01-1998&lt;/td&gt;
             &lt;/tr&gt;
             &lt;tr&gt;
              &lt;td align=&quot;center&quot;&gt;DD Mon YY &lt;sup style=&quot;COLOR: red&quot;&gt;1&lt;/sup&gt;&lt;/td&gt;
              &lt;td align=&quot;center&quot;&gt;-&lt;/td&gt;
              &lt;td&gt;SELECT CONVERT(VARCHAR(9), GETDATE(), 6) AS [DD MON YY]&lt;/td&gt;
              &lt;td align=&quot;center&quot;&gt;04 Jul 06 &lt;sup style=&quot;COLOR: red&quot;&gt;1&lt;/sup&gt;&lt;/td&gt;
             &lt;/tr&gt;
             &lt;tr&gt;
              &lt;td align=&quot;center&quot;&gt;DD Mon YYYY &lt;sup style=&quot;COLOR: red&quot;&gt;1&lt;/sup&gt;&lt;/td&gt;
              &lt;td align=&quot;center&quot;&gt;-&lt;/td&gt;
              &lt;td&gt;SELECT CONVERT(VARCHAR(11), GETDATE(), 106) AS [DD MON YYYY]&lt;/td&gt;
              &lt;td align=&quot;center&quot;&gt;04 Jul 2006 &lt;sup style=&quot;COLOR: red&quot;&gt;1&lt;/sup&gt;&lt;/td&gt;
             &lt;/tr&gt;
             &lt;tr&gt;
              &lt;td align=&quot;center&quot;&gt;Mon DD, YY &lt;sup style=&quot;COLOR: red&quot;&gt;1&lt;/sup&gt;&lt;/td&gt;
              &lt;td align=&quot;center&quot;&gt;-&lt;/td&gt;
              &lt;td&gt;SELECT CONVERT(VARCHAR(10), GETDATE(), 7) AS [Mon DD, YY]&lt;/td&gt;
              &lt;td align=&quot;center&quot;&gt;Jan 24, 98 &lt;sup style=&quot;COLOR: red&quot;&gt;1&lt;/sup&gt;&lt;/td&gt;
             &lt;/tr&gt;
             &lt;tr&gt;
              &lt;td align=&quot;center&quot;&gt;Mon DD, YYYY &lt;sup style=&quot;COLOR: red&quot;&gt;1&lt;/sup&gt;&lt;/td&gt;
              &lt;td align=&quot;center&quot;&gt;-&lt;/td&gt;
              &lt;td&gt;SELECT CONVERT(VARCHAR(12), GETDATE(), 107) AS [Mon DD, YYYY]&lt;/td&gt;
              &lt;td align=&quot;center&quot;&gt;Jan 24, 1998 &lt;sup style=&quot;COLOR: red&quot;&gt;1&lt;/sup&gt;&lt;/td&gt;
             &lt;/tr&gt;
             &lt;tr&gt;
              &lt;td align=&quot;center&quot;&gt;HH:MM:SS&lt;/td&gt;
              &lt;td align=&quot;center&quot;&gt;-&lt;/td&gt;
              &lt;td&gt;SELECT CONVERT(VARCHAR(8), GETDATE(), 108)&lt;/td&gt;
              &lt;td align=&quot;center&quot;&gt;03:24:53&lt;/td&gt;
             &lt;/tr&gt;
             &lt;tr&gt;
              &lt;td align=&quot;center&quot;&gt;Mon DD YYYY HH:MI:SS:MMMAM (or PM) &lt;sup style=&quot;COLOR: red&quot;&gt;1&lt;/sup&gt;&lt;/td&gt;
              &lt;td align=&quot;center&quot;&gt;Default +
               &lt;br&gt;
               milliseconds&lt;/td&gt;
              &lt;td&gt;SELECT CONVERT(VARCHAR(26), GETDATE(), 109)&lt;/td&gt;
              &lt;td align=&quot;center&quot;&gt;Apr 28 2006 12:32:29:253PM &lt;sup style=&quot;COLOR: red&quot;&gt;1&lt;/sup&gt;&lt;/td&gt;
             &lt;/tr&gt;
             &lt;tr&gt;
              &lt;td align=&quot;center&quot;&gt;MM-DD-YY&lt;/td&gt;
              &lt;td align=&quot;center&quot;&gt;USA&lt;/td&gt;
              &lt;td&gt;SELECT CONVERT(VARCHAR(8), GETDATE(), 10) AS [MM-DD-YY]&lt;/td&gt;
              &lt;td align=&quot;center&quot;&gt;01-01-06&lt;/td&gt;
             &lt;/tr&gt;
             &lt;tr&gt;
              &lt;td align=&quot;center&quot;&gt;MM-DD-YYYY&lt;/td&gt;
              &lt;td align=&quot;center&quot;&gt;USA&lt;/td&gt;
              &lt;td&gt;SELECT CONVERT(VARCHAR(10), GETDATE(), 110) AS [MM-DD-YYYY]&lt;/td&gt;
              &lt;td align=&quot;center&quot;&gt;01-01-2006&lt;/td&gt;
             &lt;/tr&gt;
             &lt;tr&gt;
              &lt;td align=&quot;center&quot;&gt;YY/MM/DD&lt;/td&gt;
              &lt;td align=&quot;center&quot;&gt;-&lt;/td&gt;
              &lt;td&gt;SELECT CONVERT(VARCHAR(8), GETDATE(), 11) AS [YY/MM/DD]&lt;/td&gt;
              &lt;td align=&quot;center&quot;&gt;98/11/23&lt;/td&gt;
             &lt;/tr&gt;
             &lt;tr&gt;
              &lt;td align=&quot;center&quot;&gt;YYYY/MM/DD&lt;/td&gt;
              &lt;td align=&quot;center&quot;&gt;-&lt;/td&gt;
              &lt;td&gt;SELECT CONVERT(VARCHAR(10), GETDATE(), 111) AS [YYYY/MM/DD]&lt;/td&gt;
              &lt;td align=&quot;center&quot;&gt;1998/11/23&lt;/td&gt;
             &lt;/tr&gt;
             &lt;tr&gt;
              &lt;td align=&quot;center&quot;&gt;YYMMDD&lt;/td&gt;
              &lt;td align=&quot;center&quot;&gt;ISO&lt;/td&gt;
              &lt;td&gt;SELECT CONVERT(VARCHAR(6), GETDATE(), 12) AS [YYMMDD]&lt;/td&gt;
              &lt;td align=&quot;center&quot;&gt;980124&lt;/td&gt;
             &lt;/tr&gt;
             &lt;tr&gt;
              &lt;td align=&quot;center&quot;&gt;YYYYMMDD&lt;/td&gt;
              &lt;td align=&quot;center&quot;&gt;ISO&lt;/td&gt;
              &lt;td&gt;SELECT CONVERT(VARCHAR(8), GETDATE(), 112) AS [YYYYMMDD]&lt;/td&gt;
              &lt;td align=&quot;center&quot;&gt;19980124&lt;/td&gt;
             &lt;/tr&gt;
             &lt;tr&gt;
              &lt;td align=&quot;center&quot;&gt;DD Mon YYYY HH:MM:SS:MMM(24h) &lt;sup style=&quot;COLOR: red&quot;&gt;1&lt;/sup&gt;&lt;/td&gt;
              &lt;td align=&quot;center&quot;&gt;Europe default + milliseconds&lt;/td&gt;
              &lt;td&gt;SELECT CONVERT(VARCHAR(24), GETDATE(), 113)&lt;/td&gt;
              &lt;td align=&quot;center&quot;&gt;28 Apr 2006 00:34:55:190 &lt;sup style=&quot;COLOR: red&quot;&gt;1&lt;/sup&gt;&lt;/td&gt;
             &lt;/tr&gt;
             &lt;tr&gt;
              &lt;td align=&quot;center&quot;&gt;HH:MI:SS:MMM(24H)&lt;/td&gt;
              &lt;td align=&quot;center&quot;&gt;-&lt;/td&gt;
              &lt;td&gt;SELECT CONVERT(VARCHAR(12), GETDATE(), 114) AS [HH:MI:SS:MMM(24H)]&lt;/td&gt;
              &lt;td align=&quot;center&quot;&gt;11:34:23:013&lt;/td&gt;
             &lt;/tr&gt;
             &lt;tr&gt;
              &lt;td align=&quot;center&quot;&gt;YYYY-MM-DD HH:MI:SS(24h)&lt;/td&gt;
              &lt;td align=&quot;center&quot;&gt;ODBC Canonical&lt;/td&gt;
              &lt;td&gt;SELECT CONVERT(VARCHAR(19), GETDATE(), 120)&lt;/td&gt;
              &lt;td align=&quot;center&quot;&gt;1972-01-01 13:42:24&lt;/td&gt;
             &lt;/tr&gt;
             &lt;tr&gt;
              &lt;td align=&quot;center&quot;&gt;YYYY-MM-DD HH:MI:SS.MMM(24h)&lt;/td&gt;
              &lt;td align=&quot;center&quot;&gt;ODBC Canonical&lt;br&gt;
               (with milliseconds)&lt;/td&gt;
              &lt;td&gt;SELECT CONVERT(VARCHAR(23), GETDATE(), 121)&lt;/td&gt;
              &lt;td align=&quot;center&quot;&gt;1972-02-19 06:35:24.489&lt;/td&gt;
             &lt;/tr&gt;
             &lt;tr&gt;
              &lt;td align=&quot;center&quot;&gt;YYYY-MM-DDTHH:MM:SS:MMM&lt;/td&gt;
              &lt;td align=&quot;center&quot;&gt;ISO8601&lt;/td&gt;
              &lt;td&gt;SELECT CONVERT(VARCHAR(23), GETDATE(), 126)&lt;/td&gt;
              &lt;td align=&quot;center&quot;&gt;1998-11-23T11:25:43:250&lt;/td&gt;
             &lt;/tr&gt;
             &lt;tr&gt;
              &lt;td align=&quot;center&quot;&gt;DD Mon YYYY HH:MI:SS:MMMAM &lt;sup style=&quot;COLOR: red&quot;&gt;1&lt;/sup&gt;&lt;/td&gt;
              &lt;td align=&quot;center&quot;&gt;Kuwaiti&lt;/td&gt;
              &lt;td&gt;SELECT CONVERT(VARCHAR(26), GETDATE(), 130)&lt;/td&gt;
              &lt;td align=&quot;center&quot;&gt;28 Apr 2006 12:39:32:429AM &lt;sup style=&quot;COLOR: red&quot;&gt;1&lt;/sup&gt;&lt;/td&gt;
             &lt;/tr&gt;
             &lt;tr&gt;
              &lt;td align=&quot;center&quot;&gt;DD/MM/YYYY HH:MI:SS:MMMAM&lt;/td&gt;
              &lt;td align=&quot;center&quot;&gt;Kuwaiti&lt;/td&gt;
              &lt;td&gt;SELECT CONVERT(VARCHAR(25), GETDATE(), 131)&lt;/td&gt;
              &lt;td align=&quot;center&quot;&gt;28/04/2006 12:39:32:429AM&lt;/td&gt;
             &lt;/tr&gt;
            &lt;/tbody&gt;&lt;/table&gt;
&lt;br /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4326747173526655599/posts/default/4871314176050673539'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4326747173526655599/posts/default/4871314176050673539'/><link rel='alternate' type='text/html' href='http://dev-eloper.blogspot.com/2012/06/standard-date-formats.html' title='Standard Date Formats'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-4326747173526655599.post-3295640761705063346</id><published>2010-04-15T22:31:00.000-07:00</published><updated>2010-04-15T22:39:05.336-07:00</updated><title type='text'>Proper Title Case</title><content type='html'>CREATE FUNCTION fn_ProperCase(@x varchar(7999))&lt;br /&gt;RETURNS varchar(7999)&lt;br /&gt;AS&lt;br /&gt;  BEGIN&lt;br /&gt;&lt;br /&gt; DECLARE @y int&lt;br /&gt; SET @y = 1&lt;br /&gt; &lt;br /&gt; SELECT @x = UPPER(SUBSTRING(@x,1,1))+LOWER(SUBSTRING(@x,2,LEN(@x)-1))+&#39; &#39;&lt;br /&gt; &lt;br /&gt; WHILE @y &lt; LEN(@x)&lt;br /&gt;   BEGIN&lt;br /&gt;  SELECT @y=CHARINDEX(&#39; &#39;,@x,@y)&lt;br /&gt;  SELECT @x=SUBSTRING(@x,1,@y)+UPPER(SUBSTRING(@x,@y+1,1))+SUBSTRING(@x,@y+2,LEN(@x)-@y+1) &lt;br /&gt;  SELECT @y=@y+1&lt;br /&gt;   END&lt;br /&gt; RETURN @x&lt;br /&gt;END&lt;br /&gt;&lt;br /&gt;SELECT dbo.fn_ProperCase(&#39;THE QUICK FOX JUMPED OVER THE LAZY DOG&#39;)</content><link rel='replies' type='application/atom+xml' href='http://dev-eloper.blogspot.com/feeds/3295640761705063346/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4326747173526655599/3295640761705063346' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4326747173526655599/posts/default/3295640761705063346'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4326747173526655599/posts/default/3295640761705063346'/><link rel='alternate' type='text/html' href='http://dev-eloper.blogspot.com/2010/04/proper-title-case.html' title='Proper Title Case'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4326747173526655599.post-3234636530879111321</id><published>2009-12-02T22:25:00.000-08:00</published><updated>2009-12-02T22:38:49.290-08:00</updated><title type='text'>SQL SERVER – @@IDENTITY vs SCOPE_IDENTITY() vs IDENT_CURRENT – Retrieve Last Inserted Identity of Record</title><content type='html'>&lt;span style=&quot;font-weight:bold;&quot;&gt;SELECT @@IDENTITY&lt;/span&gt;&lt;br /&gt;It returns the last IDENTITY value produced on a connection, regardless of the table that produced the value, and regardless of the scope of the statement that produced the value.&lt;br /&gt;@@IDENTITY will return the last identity value entered into a table in your current session. While @@IDENTITY is limited to the current session, it is not limited to the current scope. If you have a trigger on a table that causes an identity to be created in another table, you will get the identity that was created last, even if it was the trigger that created it.&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight:bold;&quot;&gt;SELECT SCOPE_IDENTITY()&lt;br /&gt;&lt;/span&gt;It returns the last IDENTITY value produced on a connection and by a statement in the same scope, regardless of the table that produced the value.&lt;br /&gt;SCOPE_IDENTITY(), like @@IDENTITY, will return the last identity value created in the current session, but it will also limit it to your current scope as well. In other words, it will return the last identity value that you explicitly created, rather than any identity that was created by a trigger or a user defined function.&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight:bold;&quot;&gt;SELECT IDENT_CURRENT(‘tablename’)&lt;/span&gt;&lt;br /&gt;It returns the last IDENTITY value produced in a table, regardless of the connection that created the value, and regardless of the scope of the statement that produced the value.&lt;br /&gt;IDENT_CURRENT is not limited by scope and session; it is limited to a specified table. IDENT_CURRENT returns the identity value generated for a specific table in any session and any scope.&lt;br /&gt;&lt;br /&gt;To avoid the potential problems associated with adding a trigger later on, always use SCOPE_IDENTITY() to return the identity of the recently added row in your T SQL Statement or Stored Procedure.</content><link rel='replies' type='application/atom+xml' href='http://dev-eloper.blogspot.com/feeds/3234636530879111321/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4326747173526655599/3234636530879111321' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4326747173526655599/posts/default/3234636530879111321'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4326747173526655599/posts/default/3234636530879111321'/><link rel='alternate' type='text/html' href='http://dev-eloper.blogspot.com/2009/12/sql-server-identity-vs-scopeidentity-vs.html' title='SQL SERVER – @@IDENTITY vs SCOPE_IDENTITY() vs IDENT_CURRENT – Retrieve Last Inserted Identity of Record'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4326747173526655599.post-1920726100453515641</id><published>2009-11-01T20:46:00.000-08:00</published><updated>2009-11-01T20:51:52.660-08:00</updated><title type='text'>Functin - How to Get Leap Year</title><content type='html'>/*Detecting leap year*/&lt;br /&gt;CREATE FUNCTION dbo.IsLeapYear(@Year int)&lt;br /&gt;    RETURNS bit&lt;br /&gt;AS&lt;br /&gt;BEGIN&lt;br /&gt;    DECLARE @RetVal bit&lt;br /&gt;    IF (@Year % 400) = 0 --//every 400 years&lt;br /&gt;        SET @RetVal = 1&lt;br /&gt;    ELSE&lt;br /&gt;    BEGIN&lt;br /&gt;        IF (@Year % 100) = 0&lt;br /&gt;                SET @RetVal = 0&lt;br /&gt;        ELSE&lt;br /&gt;        BEGIN&lt;br /&gt;                IF (@Year % 4) = 0&lt;br /&gt;                        SET @RetVal  = 1&lt;br /&gt;                ELSE&lt;br /&gt;                        SET @RetVal  = 0&lt;br /&gt;        END&lt;br /&gt;    END&lt;br /&gt;    RETURN @RetVal&lt;br /&gt;END&lt;br /&gt;GO</content><link rel='replies' type='application/atom+xml' href='http://dev-eloper.blogspot.com/feeds/1920726100453515641/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4326747173526655599/1920726100453515641' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4326747173526655599/posts/default/1920726100453515641'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4326747173526655599/posts/default/1920726100453515641'/><link rel='alternate' type='text/html' href='http://dev-eloper.blogspot.com/2009/11/functin-how-to-get-leap-year.html' title='Functin - How to Get Leap Year'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4326747173526655599.post-2877084251887662201</id><published>2009-10-12T22:39:00.000-07:00</published><updated>2013-09-20T06:06:56.054-07:00</updated><title type='text'>MaxLength not working in ASP.NET textbox multiLine</title><content type='html'>Great code I found for maxlength issue with .NET textboxes. .NET textboxes, if TextMode is set to MutilLine, the maxlength property just doesn&#39;t work, sux. So after playing around with different soloutions. I found this on, thanks to a guy named &quot;Leo.&quot; So a big thanks to him!&lt;br /&gt;
&lt;br /&gt;
Add this function in JavaScript on your page, I stuck it my &quot;functions.js&quot; file I include on the page anyway.&lt;br /&gt;
&lt;br /&gt;
function checkMaxLen(txt,maxLen) {&lt;br /&gt;
try{&lt;br /&gt;
if(txt.value.length &amp;gt; (maxLen-1)) {&lt;br /&gt;
var cont = txt.value;&lt;br /&gt;
txt.value = cont.substring(0,(maxLen -1));&lt;br /&gt;
return false;&lt;br /&gt;
};&lt;br /&gt;
}catch(e){&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Then on the textbox use something like  this:&lt;br /&gt;
&lt;code&gt;&lt;br /&gt;&amp;lt;asp:TextBox runat=&quot;server&quot; ID=&quot;txtComments&quot; CssClass=&quot;comment_textbox&quot; Height=&quot;75px&quot; TextMode=&quot;MultiLine&quot; onkeyup=&quot;return checkMaxLen(this,151)&quot;&amp;gt;&amp;lt;/asp:TextBox&amp;gt;&lt;/code&gt;&lt;br /&gt;
&lt;br /&gt;
Notice the function passes the textbox (this) and the maxlength you want, in this case 150, notice I have 151, the function will limit the maxlength minus one... So if you want to limit the textbox with mutiline set to 100, you enter 101, make sense?

&lt;script type=&quot;text/javascript&quot;&gt;

  var _gaq = _gaq || [];
  _gaq.push([&#39;_setAccount&#39;, &#39;UA-11028870-1&#39;]);
  _gaq.push([&#39;_trackPageview&#39;]);

  (function() {
    var ga = document.createElement(&#39;script&#39;); ga.type = &#39;text/javascript&#39;; ga.async = true;
    ga.src = (&#39;https:&#39; == document.location.protocol ? &#39;https://ssl&#39; : &#39;http://www&#39;) + &#39;.google-analytics.com/ga.js&#39;;
    var s = document.getElementsByTagName(&#39;script&#39;)[0]; s.parentNode.insertBefore(ga, s);
  })();

&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot;
src=&quot;http://pagead2.googlesyndication.com/pagead/show_ads.js&quot;&gt;
&lt;/script&gt;</content><link rel='replies' type='application/atom+xml' href='http://dev-eloper.blogspot.com/feeds/2877084251887662201/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4326747173526655599/2877084251887662201' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4326747173526655599/posts/default/2877084251887662201'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4326747173526655599/posts/default/2877084251887662201'/><link rel='alternate' type='text/html' href='http://dev-eloper.blogspot.com/2009/10/maxlength-not-working-in-aspnet-textbox.html' title='MaxLength not working in ASP.NET textbox multiLine'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4326747173526655599.post-7309833833031796019</id><published>2009-07-22T05:46:00.000-07:00</published><updated>2013-09-20T06:08:06.883-07:00</updated><title type='text'>Linked Server - How to pass a variable to a linked server query</title><content type='html'>This article describes how to pass a variable to a linked server query.&lt;br /&gt;
&lt;br /&gt;
When you query a linked server, you frequently perform a pass-through query that uses the OPENQUERY, OPENROWSET, or OPENDATASOURCE statement. You can view the examples in SQL Server Books Online to see how to do this by using pre-defined Transact-SQL strings, but there are no examples of how to pass a variable to these functions. This article provides three examples of how to pass a variable to a linked server query.&lt;br /&gt;
&lt;br /&gt;
To pass a variable to one of the pass-through functions, you must build a dynamic query.&lt;br /&gt;
&lt;br /&gt;
Any data that includes quotes needs particular handling. For more information, see the &quot;Using char and varchar Data&quot; topic in SQL Server Books Online and see the following article in the Microsoft Knowledge Base:&lt;br /&gt;
&lt;h3 id=&quot;tocHeadRef&quot;&gt;
Pass Basic Values&lt;/h3&gt;
&lt;script type=&quot;text/javascript&quot;&gt;                 loadTOCNode(2, &#39;summary&#39;);             &lt;/script&gt;When the basic Transact-SQL statement is known, but you have to pass in one or more specific values, use code that is similar to the following sample:&lt;br /&gt;
&lt;div class=&quot;kb_codebody&quot;&gt;
&lt;div class=&quot;kb_codecontent&quot;&gt;
&lt;code&gt;&lt;/code&gt;&lt;br /&gt;
&lt;pre class=&quot;code&quot;&gt;      DECLARE @TSQL varchar(8000), @VAR char(2)
     SELECT  @VAR = &#39;CA&#39;
     SELECT  @TSQL = &#39;SELECT * FROM OPENQUERY(MyLinkedServer,&#39;&#39;SELECT * FROM pubs.dbo.authors WHERE state = &#39;&#39;&#39;&#39;&#39; + @VAR + &#39;&#39;&#39;&#39;&#39;&#39;&#39;)&#39;
     EXEC (@TSQL)
    &lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;h3 id=&quot;tocHeadRef&quot;&gt;
Pass the Whole Query&lt;/h3&gt;
&lt;script type=&quot;text/javascript&quot;&gt;                 loadTOCNode(2, &#39;summary&#39;);             &lt;/script&gt;When you have to pass in the whole Transact-SQL query or the name of the linked server (or both), use code that is similar to the following sample: &lt;br /&gt;
&lt;div class=&quot;kb_codebody&quot;&gt;
&lt;div class=&quot;kb_codecontent&quot;&gt;
&lt;code&gt;&lt;/code&gt;&lt;br /&gt;
&lt;pre class=&quot;code&quot;&gt;DECLARE @OPENQUERY nvarchar(4000), @TSQL nvarchar(4000), @LinkedServer nvarchar(4000)
SET @LinkedServer = &#39;MyLinkedServer&#39;
SET @OPENQUERY = &#39;SELECT * FROM OPENQUERY(&#39;+ @LinkedServer + &#39;,&#39;&#39;&#39;
SET @TSQL = &#39;SELECT au_lname, au_id FROM pubs..authors&#39;&#39;)&#39;
EXEC (@OPENQUERY+@TSQL)&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;h3 id=&quot;tocHeadRef&quot;&gt;
Use the Sp_executesql Stored Procedure&lt;/h3&gt;
&lt;script type=&quot;text/javascript&quot;&gt;                 loadTOCNode(2, &#39;summary&#39;);             &lt;/script&gt; To avoid the multi-layered quotes, use code that is similar to the following sample:  &lt;br /&gt;
&lt;div class=&quot;kb_codebody&quot;&gt;
&lt;div class=&quot;kb_codecontent&quot;&gt;
&lt;code&gt;&lt;/code&gt;&lt;br /&gt;
&lt;pre class=&quot;code&quot;&gt;DECLARE @VAR char(2)
SELECT  @VAR = &#39;CA&#39;
EXEC MyLinkedServer.master.dbo.sp_executesql
    N&#39;SELECT * FROM pubs.dbo.authors WHERE state = @state&#39;,
    N&#39;@state char(2)&#39;,
    @VAR&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;

&lt;script type=&quot;text/javascript&quot;&gt;

  var _gaq = _gaq || [];
  _gaq.push([&#39;_setAccount&#39;, &#39;UA-11028870-1&#39;]);
  _gaq.push([&#39;_trackPageview&#39;]);

  (function() {
    var ga = document.createElement(&#39;script&#39;); ga.type = &#39;text/javascript&#39;; ga.async = true;
    ga.src = (&#39;https:&#39; == document.location.protocol ? &#39;https://ssl&#39; : &#39;http://www&#39;) + &#39;.google-analytics.com/ga.js&#39;;
    var s = document.getElementsByTagName(&#39;script&#39;)[0]; s.parentNode.insertBefore(ga, s);
  })();

&lt;/script&gt;</content><link rel='replies' type='application/atom+xml' href='http://dev-eloper.blogspot.com/feeds/7309833833031796019/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4326747173526655599/7309833833031796019' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4326747173526655599/posts/default/7309833833031796019'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4326747173526655599/posts/default/7309833833031796019'/><link rel='alternate' type='text/html' href='http://dev-eloper.blogspot.com/2009/07/linked-server-how-to-pass-variable-to.html' title='Linked Server - How to pass a variable to a linked server query'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4326747173526655599.post-372236196170060522</id><published>2009-06-14T23:40:00.000-07:00</published><updated>2009-06-14T23:45:21.678-07:00</updated><title type='text'>Upgrading to IE8 breaks debugging with Visual Studio 2005</title><content type='html'>Since Microsoft published IE8 as a Windows Update and my boss said he upgraded to it, I figured it was safe to upgrade to it as well. I’ve been enjoying the changes for a couple days now, but when I attempted to debug an ASP.NET application with Visual Studio 2005, it would no longer stop at a breakpoint. Pretty frustrating if you ask me. I’ve found a few articles online describing problems, most of which I haven’t encountered yet. You may want to implement all these workarounds.&lt;br /&gt;&lt;br /&gt;The problem I was having appears to be related to how IE8 uses multiple processes. Apparently VS 2005 doesn’t know which process to attach to. Here are three solutions:&lt;br /&gt;&lt;br /&gt;1.Don’t have IE8 running at the time you want to debug. This worked for me.&lt;br /&gt;2.Modify the registry as described in the second link above. This worked for me as well. Here are the steps:&lt;br /&gt;1.Open RegEdit&lt;br /&gt;2.Browse to HKEY_LOCAL_MACHINE -&gt; SOFTWARE -&gt; Microsoft -&gt; Internet Explorer -&gt; Main&lt;br /&gt;3.Add a DWORD value called TabProcGrowth with a value of 0&lt;br /&gt;4.Turn off protected mode browsing in IE (Security page of Internet Options) if you are running on Vista or newer.&lt;br /&gt;3.Uninstall IE8 to revert back to IE7. I don’t really want to do this though. I’ve grown particularly fond of a few of the new features in IE8, such as previous session restore (although I wish it would allow me to restore more than just the last session) and improvements in search.&lt;br /&gt;&lt;br /&gt;I don’t know if this is a problem with VS 2008, but some of the articles seem to imply it only applies to VS 2005. Maybe it’s time to upgrade Visual Studio</content><link rel='replies' type='application/atom+xml' href='http://dev-eloper.blogspot.com/feeds/372236196170060522/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4326747173526655599/372236196170060522' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4326747173526655599/posts/default/372236196170060522'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4326747173526655599/posts/default/372236196170060522'/><link rel='alternate' type='text/html' href='http://dev-eloper.blogspot.com/2009/06/upgrading-to-ie8-breaks-debugging-with.html' title='Upgrading to IE8 breaks debugging with Visual Studio 2005'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4326747173526655599.post-8390777596264801212</id><published>2009-03-24T04:06:00.000-07:00</published><updated>2009-06-14T23:46:49.896-07:00</updated><title type='text'>Referencing 2.0 Web Services (asmx) in Visual Studio 2008</title><content type='html'>&lt;strong&gt;&lt;/strong&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj6fqkzLIXOIPDgAyNuT0E5bCyFXy-pn-X7Ivlbkr8R5rkx400tfAQkZ5I1dwolm-KVBhdYs-ZgXaofhW9scLyWbixXWvmtJnIV4fdlt2TR5dezmry3yTjH3Y1ooGOLlkdcLpVuHGYaUlo/s1600-h/AddAServiceReference_thumb.jpg&quot;&gt;&lt;/a&gt;Recently I needed to add a reference to a classic (.Net 2.0) web service inside a new project that was being created via Visual Studio 2008.&lt;br /&gt;Now, I have not done a lot of work with WebServices in the past 6-9 months, but thought it would be cake. Please keep in mind, the service I wanted to connect to was NOT a WCF Service, it was a standard ASMX service.&lt;br /&gt;&lt;strong&gt;Below is what I thought would work, but did not&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;1- Attempt to Add A Service Reference&lt;a href=&quot;http://devlicio.us/blogs/derik_whittaker/WindowsLiveWriter/Refer.0WebServicesasmxinVisualStudio2008_C054/AddAServiceReference_2.jpg&quot;&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;img style=&quot;TEXT-ALIGN: center; MARGIN: 0px auto 10px; WIDTH: 244px; DISPLAY: block; HEIGHT: 119px; CURSOR: hand&quot; id=&quot;BLOGGER_PHOTO_ID_5316712016067681298&quot; border=&quot;0&quot; alt=&quot;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEisEYTKPwwef1e_iNZ_8z1oEPFnKw8-TkpAcyoQI69yG0rSW1MGUNC-q6Sj0dtIMLChKGZwq6nWUOss2uDBbvyWY66haCEvYBt5tfvU7Bn3fpLTgUhWMY1_I1G6ymiYck6qqmbUNZ2saD0/s320/AddAServiceReference_thumb.jpg&quot; /&gt;&lt;br /&gt;&lt;br /&gt;2- Choose Services in Solution (my Project is in the same solution file).&lt;a href=&quot;http://devlicio.us/blogs/derik_whittaker/WindowsLiveWriter/Refer.0WebServicesasmxinVisualStudio2008_C054/ServicesInSolution_2.jpg&quot;&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjy6uM-oaD0UgHJY3qLC0TKn8oPhrspcdrot1VgGP_ho74xQt_-ALQso6wk3mNEaaPp-TknpRe6-IcokRojD_i5Za2tkyn2VRSOUgCpQUw3k51kEe7HuhE7PRtelfzk8-WNdUnecRzR3mI/s1600-h/ServicesInSolution_thumb2.jpg&quot;&gt;&lt;img style=&quot;WIDTH: 320px; HEIGHT: 237px; CURSOR: hand&quot; id=&quot;BLOGGER_PHOTO_ID_5316712512552840130&quot; border=&quot;0&quot; alt=&quot;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjy6uM-oaD0UgHJY3qLC0TKn8oPhrspcdrot1VgGP_ho74xQt_-ALQso6wk3mNEaaPp-TknpRe6-IcokRojD_i5Za2tkyn2VRSOUgCpQUw3k51kEe7HuhE7PRtelfzk8-WNdUnecRzR3mI/s320/ServicesInSolution_thumb2.jpg&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;3- View the generated service implementation.&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh4VUykTu_VSCTcAAaNvgqdQbU64cEhhW63juq0mRekghHSr3OysEOpeL7Ew66n8xYn6qbzHJlAig9WGhfAdb8j5usSbZGTTawuo7dU3VazTC6iiOxCF9MmYh_LYh1RYgWKwA3pocjTD8o/s1600-h/IncorrectGeneratedService_thumb3.jpg&quot;&gt;&lt;img style=&quot;WIDTH: 237px; HEIGHT: 165px; CURSOR: hand&quot; id=&quot;BLOGGER_PHOTO_ID_5316712781274169458&quot; border=&quot;0&quot; alt=&quot;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh4VUykTu_VSCTcAAaNvgqdQbU64cEhhW63juq0mRekghHSr3OysEOpeL7Ew66n8xYn6qbzHJlAig9WGhfAdb8j5usSbZGTTawuo7dU3VazTC6iiOxCF9MmYh_LYh1RYgWKwA3pocjTD8o/s320/IncorrectGeneratedService_thumb3.jpg&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;p&gt;4- WCF Style code implementation&lt;/p&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgmMozhqA7p0QPLiBnIsaFkcCVBkJZ3g6Py81oWRv3L4KkObBEHKd1lEtG7DDF1b5pH6QRvWHvZ-phAIQEXOOoLtcbfgChyphenhypheneu7b367zpzLJd467V7LiIobGEqemWr2BLNttBHA2KA0auHM/s1600-h/WCFStyleImplementation_thumb4.jpg&quot;&gt;&lt;img style=&quot;WIDTH: 320px; HEIGHT: 138px; CURSOR: hand&quot; id=&quot;BLOGGER_PHOTO_ID_5316713331949547586&quot; border=&quot;0&quot; alt=&quot;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgmMozhqA7p0QPLiBnIsaFkcCVBkJZ3g6Py81oWRv3L4KkObBEHKd1lEtG7DDF1b5pH6QRvWHvZ-phAIQEXOOoLtcbfgChyphenhypheneu7b367zpzLJd467V7LiIobGEqemWr2BLNttBHA2KA0auHM/s320/WCFStyleImplementation_thumb4.jpg&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;What you will notice from step 4 is that the way you go about implementing this service is in the WCF style. This is not what I was looking for. I was wanting to reference this like all the other code in our projects.&lt;/p&gt;&lt;p&gt;&lt;strong&gt;Below is what DID work&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;2- Attempt to Add A Service Reference&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;img style=&quot;TEXT-ALIGN: center; MARGIN: 0px auto 10px; WIDTH: 244px; DISPLAY: block; HEIGHT: 119px; CURSOR: hand&quot; id=&quot;BLOGGER_PHOTO_ID_5316714707337121442&quot; border=&quot;0&quot; alt=&quot;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjaz0sNb4popzcdoyiChj6YHb9IqU_SAVwnbL8wfjIvs3m1cFQCTOB1N-kGV2y3Yo2Ua2-iitSCW3lYiE0H7v48jveosqklyRWffN2IVrXLnS5IJsDw2dDsVMjNN3BcHcFw2jAtKx_HrGM/s320/AddAServiceReference_thumb.jpg&quot; /&gt;&lt;/p&gt;&lt;p&gt;3-Need to add the service as a Web Reference&lt;a href=&quot;http://devlicio.us/blogs/derik_whittaker/WindowsLiveWriter/Refer.0WebServicesasmxinVisualStudio2008_C054/ClickAddWebReference_2.jpg&quot;&gt;&lt;/a&gt; &lt;/p&gt;&lt;img style=&quot;TEXT-ALIGN: center; MARGIN: 0px auto 10px; WIDTH: 320px; DISPLAY: block; HEIGHT: 297px; CURSOR: hand&quot; id=&quot;BLOGGER_PHOTO_ID_5316715318634152562&quot; border=&quot;0&quot; alt=&quot;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEieMfKQsuWsOPGCvCz_EwzDu4gDl8es1unPHR4_DuQSn1H31PYRe-02V7_3fbUaCK9iA8NqXqPB6RMR74fS6XOsNkgriLAeg9-VlP_82kGhWWidzZvaEDd-m2nb6DSAhUXGkxoxV-fwmMg/s320/ClickAddWebReference_thumb3.jpg&quot; /&gt; 4- Finally need to search for and find your web service &lt;img style=&quot;TEXT-ALIGN: center; MARGIN: 0px auto 10px; WIDTH: 320px; DISPLAY: block; HEIGHT: 223px; CURSOR: hand&quot; id=&quot;BLOGGER_PHOTO_ID_5316716427512813026&quot; border=&quot;0&quot; alt=&quot;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj55i88qqur938-UewUXCO3vVz24W2i5sfIZ0z05sZgI71ngAy3TbezllZ9irDqhXL1HvX_ld1TTCfgG5ER4OAOjFaMIu_TLxL2nwXEtr9qDHO9uzJl568wZHCf91srQdk7D4S3176oqQk/s320/AddWebReference_thumb4.jpg&quot; /&gt;&lt;br /&gt;5- Lastly, if you have done everything correctly, you should see the following.&lt;a href=&quot;http://devlicio.us/blogs/derik_whittaker/WindowsLiveWriter/Refer.0WebServicesasmxinVisualStudio2008_C054/CorrectlyGeneratedService_2.jpg&quot;&gt;&lt;/a&gt; &lt;img style=&quot;TEXT-ALIGN: center; MARGIN: 0px auto 10px; WIDTH: 219px; DISPLAY: block; HEIGHT: 105px; CURSOR: hand&quot; id=&quot;BLOGGER_PHOTO_ID_5316717501672729474&quot; border=&quot;0&quot; alt=&quot;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiiRQzjbuPAWpEx0VNXO4piiVNJGzzh-qF0tesCErrT1R4s4ZVku-p32-BB_6B0qtd0UnehyQ9n-jFM368wNYuyLYT07k8Av1Cb_58GcholSUK3JJVCzVUih9Zk5Ll2BTrxeH7YSGF3__w/s320/CorrectlyGeneratedService_thumb5.jpg&quot; /&gt;&lt;br /&gt;Now I know that the preferred service type is now WCF, but come-on not everyone is using WCF just yet. Adding a traditional web service reference is way too much friction. Why is not possible to add a reference from the solution explorer? Really can anyone answer me that.&lt;br /&gt;Till next time,</content><link rel='replies' type='application/atom+xml' href='http://dev-eloper.blogspot.com/feeds/8390777596264801212/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4326747173526655599/8390777596264801212' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4326747173526655599/posts/default/8390777596264801212'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4326747173526655599/posts/default/8390777596264801212'/><link rel='alternate' type='text/html' href='http://dev-eloper.blogspot.com/2009/03/referencing-2.html' title='Referencing 2.0 Web Services (asmx) in Visual Studio 2008'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEisEYTKPwwef1e_iNZ_8z1oEPFnKw8-TkpAcyoQI69yG0rSW1MGUNC-q6Sj0dtIMLChKGZwq6nWUOss2uDBbvyWY66haCEvYBt5tfvU7Bn3fpLTgUhWMY1_I1G6ymiYck6qqmbUNZ2saD0/s72-c/AddAServiceReference_thumb.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4326747173526655599.post-5924789262210905589</id><published>2009-03-19T06:10:00.000-07:00</published><updated>2009-06-14T23:47:26.673-07:00</updated><title type='text'>Date/Time Conversions Using SQL Server</title><content type='html'>&lt;strong&gt;Problem &lt;/strong&gt;&lt;br /&gt;There are many instances when dates and times don&#39;t show up at your doorstep in the format you&#39;d like it to be, nor does the output of a query fit the needs of the people viewing it. One option is to format the data in the application itself. Another option is to use the built-in functions SQL Server provides to format the date string for you.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Solution &lt;/strong&gt;&lt;br /&gt;SQL Server provides a number of options you can use to format a date/time string. One of the first considerations is the actual date/time needed. The most common is the current date/time using getdate(). This provides the current date and time according to the server providing the date and time. If a universal date/time is needed, then getutcdate() should be used. To change the format of the date, you convert the requested date to a string and specify the format number corresponding to the format needed. Below is a list of formats and an example of the output:&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;DATE FORMATS &lt;/strong&gt;&lt;br /&gt;Format # Query (current date: 12/30/2006) Sample&lt;br /&gt;1 select convert(varchar, getdate(), 1) 12/30/06&lt;br /&gt;2 select convert(varchar, getdate(), 2) 06.12.30&lt;br /&gt;3 select convert(varchar, getdate(), 3) 30/12/06&lt;br /&gt;4 select convert(varchar, getdate(), 4) 30.12.06&lt;br /&gt;5 select convert(varchar, getdate(), 5) 30-12-06&lt;br /&gt;6 select convert(varchar, getdate(), 6) 30 Dec 06&lt;br /&gt;7 select convert(varchar, getdate(), 7) Dec 30, 06&lt;br /&gt;10 select convert(varchar, getdate(), 10) 12-30-06&lt;br /&gt;11 select convert(varchar, getdate(), 11) 06/12/30&lt;br /&gt;101 select convert(varchar, getdate(), 101) 12/30/2006&lt;br /&gt;102 select convert(varchar, getdate(), 102) 2006.12.30&lt;br /&gt;103 select convert(varchar, getdate(), 103) 30/12/2006&lt;br /&gt;104 select convert(varchar, getdate(), 104) 30.12.2006&lt;br /&gt;105 select convert(varchar, getdate(), 105) 30-12-2006&lt;br /&gt;106 select convert(varchar, getdate(), 106) 30 Dec 2006&lt;br /&gt;107 select convert(varchar, getdate(), 107) Dec 30, 2006&lt;br /&gt;110 select convert(varchar, getdate(), 110) 12-30-2006&lt;br /&gt;111 select convert(varchar, getdate(), 111) 2006/12/30&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;TIME FORMATS &lt;/strong&gt;&lt;br /&gt;8 or 108 select convert(varchar, getdate(), 8) 00:38:54&lt;br /&gt;9 or 109 select convert(varchar, getdate(), 9) Dec 30 2006 12:38:54:840AM&lt;br /&gt;14 or 114 select convert(varchar, getdate(), 14) 00:38:54:840&lt;br /&gt;&lt;br /&gt;You can also format the date or time without dividing characters, as well as concatenate the date and time string:&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Sample statement Output &lt;/strong&gt;&lt;br /&gt;select replace(convert(varchar, getdate(),101),&#39;/&#39;,&#39;&#39;) 12302006&lt;br /&gt;select replace(convert(varchar, getdate(),101),&#39;/&#39;,&#39;&#39;) + replace(convert(varchar, getdate(),108),&#39;:&#39;,&#39;&#39;) 12302006004426</content><link rel='replies' type='application/atom+xml' href='http://dev-eloper.blogspot.com/feeds/5924789262210905589/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4326747173526655599/5924789262210905589' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4326747173526655599/posts/default/5924789262210905589'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4326747173526655599/posts/default/5924789262210905589'/><link rel='alternate' type='text/html' href='http://dev-eloper.blogspot.com/2009/03/datetime-conversions-using-sql-server.html' title='Date/Time Conversions Using SQL Server'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>