<?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-3738915380073694572</id><updated>2024-10-08T19:24:04.007-07:00</updated><category term="Sql Server"/><category term="SQL Tips"/><category term=".ldf .mdf file Size"/><category term="Add new column"/><category term="Automatic Restore Backup database"/><category term="Count the difference of character in two string in SQL Server"/><category term="DB Size"/><category term="Database file size"/><category term="Default values"/><category term="Default varchar limit"/><category term="Delete Vs Truncate"/><category term="Delete in SQL Server"/><category term="Display count for number of column in table with non zero values for each rows"/><category term="Drop multiple table in SQL Server"/><category term="Drop table"/><category term="Fetch data from remote server"/><category term="Find physical path for Database backup file in SQL Server"/><category term="How to Get XML Response From Web URL In SQL Server"/><category term="How to find an exact Age using Birth date in SQL Server"/><category term="How to use Recursive CTE in SQL SERVER"/><category term="Insert default"/><category term="Multiple Record value in One Filed"/><category term="Multiple column PIVOT"/><category term="OpenRowSet"/><category term="Paresh blog"/><category term="Prevent saving changes"/><category term="Query to search text of all sql server database objects"/><category term="Read XMLColumn value and Get it in Table format"/><category term="Remove non alphabetic character from string in SQL Server"/><category term="Retrieve comma seperated values in to a table in SQL Server"/><category term="SQL Function for Comma seperator value to return in Table format"/><category term="SQL Query"/><category term="SQL Server DROP"/><category term="SQL Server PIVOT"/><category term="SQL Server database file"/><category term="Single DROP statement"/><category term="Split"/><category term="Split string into column"/><category term="Table design SQL Server"/><category term="Table re-creation"/><category term="Truncate in SQL Server"/><category term="UNPIVOT in SQL SERVER with Example"/><category term="Varchar datatype"/><category term="XML Serialization/Deserialization in C#.Net with Collection of objects"/><category term="default Size"/><title type='text'>Paresh&#39;s Blog</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://paresh4you.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3738915380073694572/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://paresh4you.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/3738915380073694572/posts/default?start-index=26&amp;max-results=25&amp;redirect=false'/><author><name>Paresh Patel</name><uri>http://www.blogger.com/profile/11363011501398480384</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiEvIVhlCJ9QU8YKsM40XF4pKcctXZF93MWS7gnWlaN_B3GsyfzTJqJ3faC8xuOO4sHLP_yY_yEIh07tbqe90Sl7F0KzyqDCEBsacubT7OHu7U6zPLtjbhqiVaIMmXSKw/s1600-r/Pareshnice.JPG'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>27</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-3738915380073694572.post-6541290901255101786</id><published>2016-03-30T04:33:00.000-07:00</published><updated>2016-03-30T04:33:00.629-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Multiple column PIVOT"/><category scheme="http://www.blogger.com/atom/ns#" term="SQL Server PIVOT"/><title type='text'>SQL Pivoting on multiple columns</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
We can create pivoting on multiple columns as below.&lt;br /&gt;
&lt;br /&gt;
&lt;u&gt;&lt;i&gt;&lt;b&gt;Query:&lt;/b&gt;&lt;/i&gt;&lt;/u&gt;&lt;br /&gt;
&lt;br /&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;
 &lt;o:OfficeDocumentSettings&gt;
  &lt;o:AllowPNG/&gt;
 &lt;/o:OfficeDocumentSettings&gt;
&lt;/xml&gt;&lt;![endif]--&gt;
&lt;!--[if gte mso 9]&gt;&lt;xml&gt;
 &lt;w:WordDocument&gt;
  &lt;w:View&gt;Normal&lt;/w:View&gt;
  &lt;w:Zoom&gt;0&lt;/w:Zoom&gt;
  &lt;w:TrackMoves/&gt;
  &lt;w:TrackFormatting/&gt;
  &lt;w:PunctuationKerning/&gt;
  &lt;w:ValidateAgainstSchemas/&gt;
  &lt;w:SaveIfXMLInvalid&gt;false&lt;/w:SaveIfXMLInvalid&gt;
  &lt;w:IgnoreMixedContent&gt;false&lt;/w:IgnoreMixedContent&gt;
  &lt;w:AlwaysShowPlaceholderText&gt;false&lt;/w:AlwaysShowPlaceholderText&gt;
  &lt;w:DoNotPromoteQF/&gt;
  &lt;w:LidThemeOther&gt;EN-US&lt;/w:LidThemeOther&gt;
  &lt;w:LidThemeAsian&gt;X-NONE&lt;/w:LidThemeAsian&gt;
  &lt;w:LidThemeComplexScript&gt;X-NONE&lt;/w:LidThemeComplexScript&gt;
  &lt;w:Compatibility&gt;
   &lt;w:BreakWrappedTables/&gt;
   &lt;w:SnapToGridInCell/&gt;
   &lt;w:WrapTextWithPunct/&gt;
   &lt;w:UseAsianBreakRules/&gt;
   &lt;w:DontGrowAutofit/&gt;
   &lt;w:SplitPgBreakAndParaMark/&gt;
   &lt;w:EnableOpenTypeKerning/&gt;
   &lt;w:DontFlipMirrorIndents/&gt;
   &lt;w:OverrideTableStyleHps/&gt;
  &lt;/w:Compatibility&gt;
  &lt;m:mathPr&gt;
   &lt;m:mathFont m:val=&quot;Cambria Math&quot;/&gt;
   &lt;m:brkBin m:val=&quot;before&quot;/&gt;
   &lt;m:brkBinSub m:val=&quot;&amp;#45;-&quot;/&gt;
   &lt;m:smallFrac m:val=&quot;off&quot;/&gt;
   &lt;m:dispDef/&gt;
   &lt;m:lMargin m:val=&quot;0&quot;/&gt;
   &lt;m:rMargin m:val=&quot;0&quot;/&gt;
   &lt;m:defJc m:val=&quot;centerGroup&quot;/&gt;
   &lt;m:wrapIndent m:val=&quot;1440&quot;/&gt;
   &lt;m:intLim m:val=&quot;subSup&quot;/&gt;
   &lt;m:naryLim m:val=&quot;undOvr&quot;/&gt;
  &lt;/m:mathPr&gt;&lt;/w:WordDocument&gt;
&lt;/xml&gt;&lt;![endif]--&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;
 &lt;w:LatentStyles DefLockedState=&quot;false&quot; DefUnhideWhenUsed=&quot;false&quot;
  DefSemiHidden=&quot;false&quot; DefQFormat=&quot;false&quot; DefPriority=&quot;99&quot;
  LatentStyleCount=&quot;371&quot;&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;0&quot; QFormat=&quot;true&quot; Name=&quot;Normal&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;9&quot; QFormat=&quot;true&quot; Name=&quot;heading 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;9&quot; SemiHidden=&quot;true&quot;
   UnhideWhenUsed=&quot;true&quot; QFormat=&quot;true&quot; Name=&quot;heading 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;9&quot; SemiHidden=&quot;true&quot;
   UnhideWhenUsed=&quot;true&quot; QFormat=&quot;true&quot; Name=&quot;heading 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;9&quot; SemiHidden=&quot;true&quot;
   UnhideWhenUsed=&quot;true&quot; QFormat=&quot;true&quot; Name=&quot;heading 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;9&quot; SemiHidden=&quot;true&quot;
   UnhideWhenUsed=&quot;true&quot; QFormat=&quot;true&quot; Name=&quot;heading 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;9&quot; SemiHidden=&quot;true&quot;
   UnhideWhenUsed=&quot;true&quot; QFormat=&quot;true&quot; Name=&quot;heading 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;9&quot; SemiHidden=&quot;true&quot;
   UnhideWhenUsed=&quot;true&quot; QFormat=&quot;true&quot; Name=&quot;heading 7&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;9&quot; SemiHidden=&quot;true&quot;
   UnhideWhenUsed=&quot;true&quot; QFormat=&quot;true&quot; Name=&quot;heading 8&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;9&quot; SemiHidden=&quot;true&quot;
   UnhideWhenUsed=&quot;true&quot; QFormat=&quot;true&quot; Name=&quot;heading 9&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;index 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;index 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;index 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;index 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;index 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;index 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;index 7&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;index 8&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;index 9&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;39&quot; SemiHidden=&quot;true&quot;
   UnhideWhenUsed=&quot;true&quot; Name=&quot;toc 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;39&quot; SemiHidden=&quot;true&quot;
   UnhideWhenUsed=&quot;true&quot; Name=&quot;toc 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;39&quot; SemiHidden=&quot;true&quot;
   UnhideWhenUsed=&quot;true&quot; Name=&quot;toc 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;39&quot; SemiHidden=&quot;true&quot;
   UnhideWhenUsed=&quot;true&quot; Name=&quot;toc 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;39&quot; SemiHidden=&quot;true&quot;
   UnhideWhenUsed=&quot;true&quot; Name=&quot;toc 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;39&quot; SemiHidden=&quot;true&quot;
   UnhideWhenUsed=&quot;true&quot; Name=&quot;toc 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;39&quot; SemiHidden=&quot;true&quot;
   UnhideWhenUsed=&quot;true&quot; Name=&quot;toc 7&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;39&quot; SemiHidden=&quot;true&quot;
   UnhideWhenUsed=&quot;true&quot; Name=&quot;toc 8&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;39&quot; SemiHidden=&quot;true&quot;
   UnhideWhenUsed=&quot;true&quot; Name=&quot;toc 9&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Normal Indent&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;footnote text&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;annotation text&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;header&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;footer&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;index heading&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;35&quot; SemiHidden=&quot;true&quot;
   UnhideWhenUsed=&quot;true&quot; QFormat=&quot;true&quot; Name=&quot;caption&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;table of figures&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;envelope address&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;envelope return&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;footnote reference&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;annotation reference&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;line number&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;page number&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;endnote reference&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;endnote text&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;table of authorities&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;macro&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;toa heading&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;List&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;List Bullet&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;List Number&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;List 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;List 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;List 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;List 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;List Bullet 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;List Bullet 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;List Bullet 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;List Bullet 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;List Number 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;List Number 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;List Number 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;List Number 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;10&quot; QFormat=&quot;true&quot; Name=&quot;Title&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Closing&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Signature&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;1&quot; SemiHidden=&quot;true&quot;
   UnhideWhenUsed=&quot;true&quot; Name=&quot;Default Paragraph Font&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Body Text&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Body Text Indent&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;List Continue&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;List Continue 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;List Continue 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;List Continue 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;List Continue 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Message Header&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;11&quot; QFormat=&quot;true&quot; Name=&quot;Subtitle&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Salutation&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Date&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Body Text First Indent&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Body Text First Indent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Note Heading&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Body Text 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Body Text 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Body Text Indent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Body Text Indent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Block Text&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Hyperlink&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;FollowedHyperlink&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;22&quot; QFormat=&quot;true&quot; Name=&quot;Strong&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;20&quot; QFormat=&quot;true&quot; Name=&quot;Emphasis&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Document Map&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Plain Text&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;E-mail Signature&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;HTML Top of Form&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;HTML Bottom of Form&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Normal (Web)&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;HTML Acronym&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;HTML Address&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;HTML Cite&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;HTML Code&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;HTML Definition&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;HTML Keyboard&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;HTML Preformatted&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;HTML Sample&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;HTML Typewriter&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;HTML Variable&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Normal Table&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;annotation subject&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;No List&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Outline List 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Outline List 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Outline List 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Table Simple 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Table Simple 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Table Simple 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Table Classic 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Table Classic 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Table Classic 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Table Classic 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Table Colorful 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Table Colorful 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Table Colorful 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Table Columns 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Table Columns 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Table Columns 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Table Columns 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Table Columns 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Table Grid 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Table Grid 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Table Grid 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Table Grid 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Table Grid 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Table Grid 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Table Grid 7&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Table Grid 8&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Table List 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Table List 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Table List 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Table List 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Table List 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Table List 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Table List 7&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Table List 8&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Table 3D effects 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Table 3D effects 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Table 3D effects 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Table Contemporary&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Table Elegant&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Table Professional&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Table Subtle 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Table Subtle 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Table Web 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Table Web 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Table Web 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Balloon Text&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;39&quot; Name=&quot;Table Grid&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; UnhideWhenUsed=&quot;true&quot;
   Name=&quot;Table Theme&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; Name=&quot;Placeholder Text&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;1&quot; QFormat=&quot;true&quot; Name=&quot;No Spacing&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;60&quot; Name=&quot;Light Shading&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;61&quot; Name=&quot;Light List&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;62&quot; Name=&quot;Light Grid&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;63&quot; Name=&quot;Medium Shading 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;64&quot; Name=&quot;Medium Shading 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;65&quot; Name=&quot;Medium List 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;66&quot; Name=&quot;Medium List 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;67&quot; Name=&quot;Medium Grid 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;68&quot; Name=&quot;Medium Grid 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;69&quot; Name=&quot;Medium Grid 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;70&quot; Name=&quot;Dark List&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;71&quot; Name=&quot;Colorful Shading&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;72&quot; Name=&quot;Colorful List&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;73&quot; Name=&quot;Colorful Grid&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;60&quot; Name=&quot;Light Shading Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;61&quot; Name=&quot;Light List Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;62&quot; Name=&quot;Light Grid Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;63&quot; Name=&quot;Medium Shading 1 Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;64&quot; Name=&quot;Medium Shading 2 Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;65&quot; Name=&quot;Medium List 1 Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; SemiHidden=&quot;true&quot; Name=&quot;Revision&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;34&quot; QFormat=&quot;true&quot;
   Name=&quot;List Paragraph&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;29&quot; QFormat=&quot;true&quot; Name=&quot;Quote&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;30&quot; QFormat=&quot;true&quot;
   Name=&quot;Intense Quote&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;66&quot; Name=&quot;Medium List 2 Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;67&quot; Name=&quot;Medium Grid 1 Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;68&quot; Name=&quot;Medium Grid 2 Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;69&quot; Name=&quot;Medium Grid 3 Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;70&quot; Name=&quot;Dark List Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;71&quot; Name=&quot;Colorful Shading Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;72&quot; Name=&quot;Colorful List Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;73&quot; Name=&quot;Colorful Grid Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;60&quot; Name=&quot;Light Shading Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;61&quot; Name=&quot;Light List Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;62&quot; Name=&quot;Light Grid Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;63&quot; Name=&quot;Medium Shading 1 Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;64&quot; Name=&quot;Medium Shading 2 Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;65&quot; Name=&quot;Medium List 1 Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;66&quot; Name=&quot;Medium List 2 Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;67&quot; Name=&quot;Medium Grid 1 Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;68&quot; Name=&quot;Medium Grid 2 Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;69&quot; Name=&quot;Medium Grid 3 Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;70&quot; Name=&quot;Dark List Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;71&quot; Name=&quot;Colorful Shading Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;72&quot; Name=&quot;Colorful List Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;73&quot; Name=&quot;Colorful Grid Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;60&quot; Name=&quot;Light Shading Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;61&quot; Name=&quot;Light List Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;62&quot; Name=&quot;Light Grid Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;63&quot; Name=&quot;Medium Shading 1 Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;64&quot; Name=&quot;Medium Shading 2 Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;65&quot; Name=&quot;Medium List 1 Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;66&quot; Name=&quot;Medium List 2 Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;67&quot; Name=&quot;Medium Grid 1 Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;68&quot; Name=&quot;Medium Grid 2 Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;69&quot; Name=&quot;Medium Grid 3 Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;70&quot; Name=&quot;Dark List Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;71&quot; Name=&quot;Colorful Shading Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;72&quot; Name=&quot;Colorful List Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;73&quot; Name=&quot;Colorful Grid Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;60&quot; Name=&quot;Light Shading Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;61&quot; Name=&quot;Light List Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;62&quot; Name=&quot;Light Grid Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;63&quot; Name=&quot;Medium Shading 1 Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;64&quot; Name=&quot;Medium Shading 2 Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;65&quot; Name=&quot;Medium List 1 Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;66&quot; Name=&quot;Medium List 2 Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;67&quot; Name=&quot;Medium Grid 1 Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;68&quot; Name=&quot;Medium Grid 2 Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;69&quot; Name=&quot;Medium Grid 3 Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;70&quot; Name=&quot;Dark List Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;71&quot; Name=&quot;Colorful Shading Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;72&quot; Name=&quot;Colorful List Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;73&quot; Name=&quot;Colorful Grid Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;60&quot; Name=&quot;Light Shading Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;61&quot; Name=&quot;Light List Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;62&quot; Name=&quot;Light Grid Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;63&quot; Name=&quot;Medium Shading 1 Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;64&quot; Name=&quot;Medium Shading 2 Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;65&quot; Name=&quot;Medium List 1 Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;66&quot; Name=&quot;Medium List 2 Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;67&quot; Name=&quot;Medium Grid 1 Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;68&quot; Name=&quot;Medium Grid 2 Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;69&quot; Name=&quot;Medium Grid 3 Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;70&quot; Name=&quot;Dark List Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;71&quot; Name=&quot;Colorful Shading Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;72&quot; Name=&quot;Colorful List Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;73&quot; Name=&quot;Colorful Grid Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;60&quot; Name=&quot;Light Shading Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;61&quot; Name=&quot;Light List Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;62&quot; Name=&quot;Light Grid Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;63&quot; Name=&quot;Medium Shading 1 Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;64&quot; Name=&quot;Medium Shading 2 Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;65&quot; Name=&quot;Medium List 1 Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;66&quot; Name=&quot;Medium List 2 Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;67&quot; Name=&quot;Medium Grid 1 Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;68&quot; Name=&quot;Medium Grid 2 Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;69&quot; Name=&quot;Medium Grid 3 Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;70&quot; Name=&quot;Dark List Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;71&quot; Name=&quot;Colorful Shading Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;72&quot; Name=&quot;Colorful List Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;73&quot; Name=&quot;Colorful Grid Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;19&quot; QFormat=&quot;true&quot;
   Name=&quot;Subtle Emphasis&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;21&quot; QFormat=&quot;true&quot;
   Name=&quot;Intense Emphasis&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;31&quot; QFormat=&quot;true&quot;
   Name=&quot;Subtle Reference&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;32&quot; QFormat=&quot;true&quot;
   Name=&quot;Intense Reference&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;33&quot; QFormat=&quot;true&quot; Name=&quot;Book Title&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;37&quot; SemiHidden=&quot;true&quot;
   UnhideWhenUsed=&quot;true&quot; Name=&quot;Bibliography&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;39&quot; SemiHidden=&quot;true&quot;
   UnhideWhenUsed=&quot;true&quot; QFormat=&quot;true&quot; Name=&quot;TOC Heading&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;41&quot; Name=&quot;Plain Table 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;42&quot; Name=&quot;Plain Table 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;43&quot; Name=&quot;Plain Table 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;44&quot; Name=&quot;Plain Table 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;45&quot; Name=&quot;Plain Table 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;40&quot; Name=&quot;Grid Table Light&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;46&quot; Name=&quot;Grid Table 1 Light&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;47&quot; Name=&quot;Grid Table 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;48&quot; Name=&quot;Grid Table 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;49&quot; Name=&quot;Grid Table 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;50&quot; Name=&quot;Grid Table 5 Dark&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;51&quot; Name=&quot;Grid Table 6 Colorful&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;52&quot; Name=&quot;Grid Table 7 Colorful&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;46&quot;
   Name=&quot;Grid Table 1 Light Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;47&quot; Name=&quot;Grid Table 2 Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;48&quot; Name=&quot;Grid Table 3 Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;49&quot; Name=&quot;Grid Table 4 Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;50&quot; Name=&quot;Grid Table 5 Dark Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;51&quot;
   Name=&quot;Grid Table 6 Colorful Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;52&quot;
   Name=&quot;Grid Table 7 Colorful Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;46&quot;
   Name=&quot;Grid Table 1 Light Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;47&quot; Name=&quot;Grid Table 2 Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;48&quot; Name=&quot;Grid Table 3 Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;49&quot; Name=&quot;Grid Table 4 Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;50&quot; Name=&quot;Grid Table 5 Dark Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;51&quot;
   Name=&quot;Grid Table 6 Colorful Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;52&quot;
   Name=&quot;Grid Table 7 Colorful Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;46&quot;
   Name=&quot;Grid Table 1 Light Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;47&quot; Name=&quot;Grid Table 2 Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;48&quot; Name=&quot;Grid Table 3 Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;49&quot; Name=&quot;Grid Table 4 Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;50&quot; Name=&quot;Grid Table 5 Dark Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;51&quot;
   Name=&quot;Grid Table 6 Colorful Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;52&quot;
   Name=&quot;Grid Table 7 Colorful Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;46&quot;
   Name=&quot;Grid Table 1 Light Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;47&quot; Name=&quot;Grid Table 2 Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;48&quot; Name=&quot;Grid Table 3 Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;49&quot; Name=&quot;Grid Table 4 Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;50&quot; Name=&quot;Grid Table 5 Dark Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;51&quot;
   Name=&quot;Grid Table 6 Colorful Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;52&quot;
   Name=&quot;Grid Table 7 Colorful Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;46&quot;
   Name=&quot;Grid Table 1 Light Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;47&quot; Name=&quot;Grid Table 2 Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;48&quot; Name=&quot;Grid Table 3 Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;49&quot; Name=&quot;Grid Table 4 Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;50&quot; Name=&quot;Grid Table 5 Dark Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;51&quot;
   Name=&quot;Grid Table 6 Colorful Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;52&quot;
   Name=&quot;Grid Table 7 Colorful Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;46&quot;
   Name=&quot;Grid Table 1 Light Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;47&quot; Name=&quot;Grid Table 2 Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;48&quot; Name=&quot;Grid Table 3 Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;49&quot; Name=&quot;Grid Table 4 Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;50&quot; Name=&quot;Grid Table 5 Dark Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;51&quot;
   Name=&quot;Grid Table 6 Colorful Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;52&quot;
   Name=&quot;Grid Table 7 Colorful Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;46&quot; Name=&quot;List Table 1 Light&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;47&quot; Name=&quot;List Table 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;48&quot; Name=&quot;List Table 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;49&quot; Name=&quot;List Table 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;50&quot; Name=&quot;List Table 5 Dark&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;51&quot; Name=&quot;List Table 6 Colorful&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;52&quot; Name=&quot;List Table 7 Colorful&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;46&quot;
   Name=&quot;List Table 1 Light Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;47&quot; Name=&quot;List Table 2 Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;48&quot; Name=&quot;List Table 3 Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;49&quot; Name=&quot;List Table 4 Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;50&quot; Name=&quot;List Table 5 Dark Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;51&quot;
   Name=&quot;List Table 6 Colorful Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;52&quot;
   Name=&quot;List Table 7 Colorful Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;46&quot;
   Name=&quot;List Table 1 Light Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;47&quot; Name=&quot;List Table 2 Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;48&quot; Name=&quot;List Table 3 Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;49&quot; Name=&quot;List Table 4 Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;50&quot; Name=&quot;List Table 5 Dark Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;51&quot;
   Name=&quot;List Table 6 Colorful Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;52&quot;
   Name=&quot;List Table 7 Colorful Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;46&quot;
   Name=&quot;List Table 1 Light Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;47&quot; Name=&quot;List Table 2 Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;48&quot; Name=&quot;List Table 3 Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;49&quot; Name=&quot;List Table 4 Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;50&quot; Name=&quot;List Table 5 Dark Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;51&quot;
   Name=&quot;List Table 6 Colorful Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;52&quot;
   Name=&quot;List Table 7 Colorful Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;46&quot;
   Name=&quot;List Table 1 Light Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;47&quot; Name=&quot;List Table 2 Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;48&quot; Name=&quot;List Table 3 Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;49&quot; Name=&quot;List Table 4 Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;50&quot; Name=&quot;List Table 5 Dark Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;51&quot;
   Name=&quot;List Table 6 Colorful Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;52&quot;
   Name=&quot;List Table 7 Colorful Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;46&quot;
   Name=&quot;List Table 1 Light Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;47&quot; Name=&quot;List Table 2 Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;48&quot; Name=&quot;List Table 3 Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;49&quot; Name=&quot;List Table 4 Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;50&quot; Name=&quot;List Table 5 Dark Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;51&quot;
   Name=&quot;List Table 6 Colorful Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;52&quot;
   Name=&quot;List Table 7 Colorful Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;46&quot;
   Name=&quot;List Table 1 Light Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;47&quot; Name=&quot;List Table 2 Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;48&quot; Name=&quot;List Table 3 Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;49&quot; Name=&quot;List Table 4 Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;50&quot; Name=&quot;List Table 5 Dark Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;51&quot;
   Name=&quot;List Table 6 Colorful Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;52&quot;
   Name=&quot;List Table 7 Colorful Accent 6&quot;/&gt;
 &lt;/w:LatentStyles&gt;
&lt;/xml&gt;&lt;![endif]--&gt;&lt;!--[if gte mso 10]&gt;
&lt;style&gt;
 /* Style Definitions */
 table.MsoNormalTable
 {mso-style-name:&quot;Table Normal&quot;;
 mso-tstyle-rowband-size:0;
 mso-tstyle-colband-size:0;
 mso-style-noshow:yes;
 mso-style-priority:99;
 mso-style-parent:&quot;&quot;;
 mso-padding-alt:0in 5.4pt 0in 5.4pt;
 mso-para-margin-top:0in;
 mso-para-margin-right:0in;
 mso-para-margin-bottom:8.0pt;
 mso-para-margin-left:0in;
 line-height:107%;
 mso-pagination:widow-orphan;
 font-size:11.0pt;
 font-family:&quot;Calibri&quot;,sans-serif;
 mso-ascii-font-family:Calibri;
 mso-ascii-theme-font:minor-latin;
 mso-hansi-font-family:Calibri;
 mso-hansi-theme-font:minor-latin;}
&lt;/style&gt;
&lt;![endif]--&gt;

&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt;&quot;&gt;IF&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt; &lt;span style=&quot;color: magenta;&quot;&gt;OBJECT_ID&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;&#39;tempdb..#tbl&#39;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;IS&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;NOT&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;NULL&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;BEGIN&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;span style=&quot;mso-tab-count: 1;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;DROP&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;TABLE&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;#tbl&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt;&quot;&gt;END&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt;&quot;&gt;CREATE&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt; &lt;span style=&quot;color: blue;&quot;&gt;TABLE&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;#tbl&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;span style=&quot;mso-tab-count: 1;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;Dt&lt;/span&gt;&lt;span style=&quot;mso-tab-count: 2;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;DATE&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;span style=&quot;mso-tab-count: 1;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;Acnt&lt;/span&gt;&lt;span style=&quot;mso-tab-count: 1;&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;INT&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;span style=&quot;mso-tab-count: 1;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;BCnt&lt;/span&gt;&lt;span style=&quot;mso-tab-count: 1;&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;INT&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;span style=&quot;mso-tab-count: 1;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;CCnt&lt;/span&gt;&lt;span style=&quot;mso-tab-count: 1;&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;INT&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;color: grey; font-family: Consolas; font-size: 9.5pt;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt;&quot;&gt;DECLARE&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt; &lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;span style=&quot;mso-tab-count: 1;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;@coldata&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;VARCHAR&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;500&lt;span style=&quot;color: grey;&quot;&gt;),&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;span style=&quot;mso-tab-count: 1;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;@sql&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;varchar&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;max&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt;&quot;&gt;INSERT&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt; &lt;span style=&quot;color: blue;&quot;&gt;INTO&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;#tbl&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt;&quot;&gt;VALUES&lt;/span&gt;&lt;span style=&quot;color: grey; font-family: Consolas; font-size: 9.5pt;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: red; font-family: Consolas; font-size: 9.5pt;&quot;&gt;&#39;2016-01-01&#39;&lt;/span&gt;&lt;span style=&quot;color: grey; font-family: Consolas; font-size: 9.5pt;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;10&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;20&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;30&lt;span style=&quot;color: grey;&quot;&gt;),&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;color: grey; font-family: Consolas; font-size: 9.5pt;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: red; font-family: Consolas; font-size: 9.5pt;&quot;&gt;&#39;2016-01-02&#39;&lt;/span&gt;&lt;span style=&quot;color: grey; font-family: Consolas; font-size: 9.5pt;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;40&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;50&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;60&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt;&quot;&gt;select&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt; &lt;span style=&quot;color: grey;&quot;&gt;*&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;from&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;#tbl&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt; &lt;span style=&quot;color: teal;&quot;&gt;@coldata&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: magenta;&quot;&gt;COALESCE&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;@coldata&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;&#39;], [&#39;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;&#39;&#39;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: magenta;&quot;&gt;FORMAT&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;Dt&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;&#39;yyyy-MM-dd&#39;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;FROM&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;#tbl&lt;/span&gt; &lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt;&quot;&gt;ORDER&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt; &lt;span style=&quot;color: blue;&quot;&gt;BY&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;dt&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;desc&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt; &lt;span style=&quot;color: teal;&quot;&gt;@coldata&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;&#39;[&#39;&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@coldata&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;&#39;]&#39;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt;&quot;&gt;SET&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt; &lt;span style=&quot;color: teal;&quot;&gt;@sql&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;&#39;SELECT Dt=col, &#39;&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@coldata&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;&#39;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;color: red; font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;span style=&quot;mso-tab-count: 2;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;FROM
&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;color: red; font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;span style=&quot;mso-tab-count: 2;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;(
SELECT FORMAT(Dt, &#39;&#39;yyyy-MM-dd&#39;&#39;) AS Dt, col, value FROM #tbl&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;color: red; font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;span style=&quot;mso-tab-count: 2;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp; &lt;/span&gt;CROSS APPLY &lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;color: red; font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;span style=&quot;mso-tab-count: 2;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp; &lt;/span&gt;( &lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;color: red; font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;span style=&quot;mso-tab-count: 3;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;SELECT
&#39;&#39;Acnt&#39;&#39;,cast(Acnt as varchar(10)) UNION ALL&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;color: red; font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;span style=&quot;mso-tab-count: 3;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;SELECT
&#39;&#39;BCnt&#39;&#39;, cast(BCnt as varchar(10)) UNION ALL&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;color: red; font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;span style=&quot;mso-tab-count: 3;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;SELECT
&#39;&#39;CCnt&#39;&#39;, cast(CCnt as varchar(10)) &lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;color: red; font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;span style=&quot;mso-tab-count: 2;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp; &lt;/span&gt;) c (col,value)&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;color: red; font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;span style=&quot;mso-tab-count: 2;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;)
d &lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;color: red; font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;span style=&quot;mso-tab-count: 2;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;PIVOT&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;color: red; font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;span style=&quot;mso-tab-count: 2;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;(&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;color: red; font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;span style=&quot;mso-tab-count: 2;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;MAX(value)
FOR Dt IN (&#39;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt; &lt;span style=&quot;color: grey;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@coldata&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;&#39;)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;color: red; font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;span style=&quot;mso-tab-count: 2;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;)
AS piv&#39;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt;&quot;&gt;EXECUTE &lt;/span&gt;&lt;span style=&quot;color: grey; font-family: Consolas; font-size: 9.5pt;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: teal; font-family: Consolas; font-size: 9.5pt;&quot;&gt;@SQL&lt;/span&gt;&lt;span style=&quot;color: grey; font-family: Consolas; font-size: 9.5pt;&quot;&gt;);&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt;&quot;&gt;IF&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt; &lt;span style=&quot;color: magenta;&quot;&gt;OBJECT_ID&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;&#39;tempdb..#tbl&#39;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;IS&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;NOT&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;NULL&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;BEGIN&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;span style=&quot;mso-tab-count: 1;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;DROP&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;TABLE&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;#tbl&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt;&quot;&gt;END&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;i&gt;&lt;u&gt;&lt;b&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt;&quot;&gt;Result:&lt;/span&gt;&lt;/b&gt;&lt;/u&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;i&gt;&lt;u&gt;&lt;b&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/u&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;u&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;Actual result&lt;/span&gt;&lt;/u&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;i&gt;&lt;u&gt;&lt;b&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;img alt=&quot;&quot; src=&quot;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMkAAABHCAIAAAAiHvT6AAAHVklEQVR4nO1d22rbShTdH5UG1f8Sgu2iDykEeuwU8hUFc3JapwV/Qx4KAefyEjhtekl9HkITJ7YcSUbnQZcZaWakGUszY7t7MQR7PKOlvWd56+IlAhECoQfw9z+fsGHT0SCW2HQ6tatxHTAZlPkE2loyeV7U1uZx2WJU5U209fDwoG1nrMFkUOYTaGvJ5HlRW5vHZYtRlVesreujFhC4owZ3zxCEWRi5AK2ja81cuQQSOrq7Tla50XE33hRjCS8Xibbu7+85u5lPiDsqdK47OEFFURRFIxdc11WIQyJqfgKzpUy3cH3UomQ2crmLLZdklpG78QYZRbwiJNr6/ft3BV/8dqO0xQkqiqLo+qjljqKRgrgkouYnkKzjyE0WWoJVbhTDyJ3WJKOAVwjwFn4YLn9N/guC0Fv4pF2+dZy3F6TnYxdeOg4AAOT617Txg4rj6n70Fld952X/MgstQfckCbzfzXqu+lVRCxMIr4Z0MospJR8p0fEZxRtvhJHmldXW3HsOw+XP219+EM69Z9IuDh3n8Jz0XPUcpzcsdK5v4wflPZ/3nc4weeH0r+beVc+BuGfunXTA6Q0PHUh74iQUUyHHdXHokPMtp3fBppQMU6LjM4o23hAjzaugreVy+ePnbZW2Tjrwaii9E9YbPyjvqkctOHDTSvfIpV6YQHg1rMyeOh2fUUlb6ow0r6y2ZvNFuFx+/3Hr+8FsviDt/NBxDseFt4XONW7CoDon6dvLrBKPC2OyHrmohVzQ/UBzncd/F8VhinQCRt7GuZ0rMdK8zWrrsudAZ8gIbo0bN6hxz3F6l/m3J0lo88Vsnh4TG9dW+nrcc4Bs6qQD0Ok1pS3exoeNMa6iraeZF4bLm28/nv3gaeaRNu7vUkePzoe4f9gBAOi+p0euZeMFNeyA89e4EGP3fRJUGua4v+v0x9kApz+uilolgd6YOiqvRidkZDfeHCPNK6utx6d5GC6/3nxfPPuPT/OtaSaDMp9AW0sW88pqa/o4C8Pwy9dvi4U/fZxtTTMZlPkE2lqymFdWWw/TpyAM//1y4y2eH6ZPW9NMBmU+gbaWLOaV1dYlAqEIWW0FQRAEge/7wdbBZFDmE2hryXzfl9XWfQoA2Mq/iGYhKayI9kFM7qZb1pQSURMmuWwxqpISbQGAdTU02wBAT4Y5QG2xwLrVDFBbLLBuNQPUFovquvVuP/29YP9Y1DO5m07ujveg/S57O2jzxkhPX2mwYt2K/XrkTYKVbL8lXOyWa3LJM9LWxPqM5aQsKurW6cFuuqhnr1/A3mA6+fxm58Wb06Rn9/Xn5CMAALLex3sAe4NEHDsHZ2SbUtNXGqxQtzIHedFzvLJrW5R0ynzK+sJruXiFyzxyUxNz+uVpiLGMlAeF863Tg92dg7PJoE0XsFhAxVoyaEOiCabJTF9tcJ26xX/ZcNKTha3NJc2YKqkhRjlSAoi9qhLnW0ndShRGq41Zb6raCQRaOn21wSp1q5hn+uu82ldbbqWLnvk6ZaSakfcATc3Cpaat2E9YWbdOD3bjUiSprZ399g7vfMuktuTrlgFtZc/bmNFWfNSPw7OvrZK6lQlLcr2p8Um1S07J949lpisN3oi6RT/IZa5uNV0p5UgJIPYTltQtWlgTyXOgQVugiT/xfCv/hGBjZz/mz/AkSTMQbfHr1qBdvCLjXLux6529Tq8u1aavNLhG3dJ3nch52lTzdaK+K9MSUi4g9qqK6ha5vQQAkNxNwPtb8kknmwWA9NF9Y/e3Mh3Zub8Ve1XxvnxN4H15FhB7VfH3xJpAbbGA2KuKdasmUFssEk8z1q2aQG2xSDzNWLdqArXFIuf6hTWwIDf7F9E4FLS1gh43BSaDMp9AK0uG2kqA2rJLitraPC5bjKqkqK3N47LFqEparS1pS27+Z1DWVyveIGe6MjsHlYkgDk2Nnmb6Vx/iB9X6mw+bfMueZu7Hcj98MhZh6hdaev1yk8qmCwdz9keMikRcH7Wy1db3WzX7ndHtaWaTb93TXDm0yrCR/0AUgsz06sHU/ohRGtT1Uavlui1SSTR5bNi91O2xYZNv3dNcNbLSaJaz2okikJkuMbicJEHFUcMd0ZVTlzeQ+scBTXGVM7J5se87LR8nYcnN2zhdl3uga0pbRcMdD5XHKRPaIlXEkF+eTf5aa0vOkpuvW/mEJueSVKkomV45WEZYUXn285Iy8iwG598/6KpbetRcQsoF8Z2KRkhbcnMfCIOpfb4lKaxImAjqKJUdqrbpGTI2+dY9zaIdlbbk0rudU0JuvtR08WDBP6ThQuZAr/s6kYo/PTqauE7MJ9+6p1m0m8WvuNX7W9z9EUFBW0ae2W/WYbwB97cyT3MdyvUE3pe3S0o8zfp2yBZQW3ZJiadZ3w7ZAmrLLinxNOvbIVtAbdklJZ5mfTtkC6gtu6Ro/EUoQEmI5p5WQPxpQG0hdAG1hdAF1BZCF1BbCF1AbSF0AbWF0AXUFkIXUFsIXUBtIXQBtYXQBdQWQhf+Bz4uSg6613MvAAAAAElFTkSuQmCC&quot; /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/u&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;i&gt;&lt;u&gt;&lt;b&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;/span&gt;&lt;/b&gt;&lt;/u&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;i&gt;&lt;u&gt;&lt;b&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;/span&gt;&lt;/b&gt;&lt;/u&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;i&gt;&lt;u&gt;&lt;b&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;/span&gt;&lt;/b&gt;&lt;/u&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;i&gt;&lt;u&gt;&lt;b&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;/span&gt;&lt;/b&gt;&lt;/u&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;i&gt;&lt;u&gt;&lt;b&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;/span&gt;&lt;/b&gt;&lt;/u&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;i&gt;&lt;u&gt;&lt;b&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;/span&gt;&lt;/b&gt;&lt;/u&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;i&gt;&lt;u&gt;&lt;b&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/u&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;i&gt;&lt;u&gt;&lt;b&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/u&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;u&gt;&lt;b&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;With Pivot&lt;/span&gt;&lt;/b&gt;&lt;/u&gt;&lt;i&gt;&lt;u&gt;&lt;b&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/u&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;i&gt;&lt;u&gt;&lt;b&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/u&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;i&gt;&lt;u&gt;&lt;b&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;img alt=&quot;&quot; src=&quot;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAALwAAABaCAIAAACNNqtjAAAGr0lEQVR4nO2d4U7iShTHz0Mh6fIuxNgaHoTExCCb8BQm5nLX6k14hv1gQiLqF5K7667rej8YkVWBUtL7obSdTqdlhk6B6ZxfJqaMU2b+47+nZXqoMEIQQWDbA0DUA/76+x8sWIQKeNtgPB5vpd9CKaUoj6ULTSONUorydsc0r6+vW+m3UEopymPpQtNIo5SiPC7TDDs1iGj0NjQOz/N6DbrXZE1QTbwOGyXGyrW7cO9qi8pozK+LZZpaZxi9gEaPqpTAaDRKdhsISXYaboWODjX3GsGLXgNiY+TaPbUxYzzqi8pqLKIr2zTBS9mmeXl5yfjtsjfieEgchsQv0gbGs/vqxsR4VqGOKLFIk9QF87k7mTpRuf1sGJ9voppLCz4ZBgAAxOrXL667+P30H91vVO5ODLAunJv2J6N951eS25PppQWHdlAP1iXzfXh252gcjadEohiNs3XRpnHm7sdkFpWbtmG0B1HNXcswWjZVmau47uLX42+636AMTgww2oPJbHBiGCd3YWW4/TG5MOHQDuutQ9/SYF1Q77Nyd47G0XhKJIrROFuXqGkuTDi06cpcZbFYPPx6ZM4v+RfinN+g/V3LANOe2dZyrnl2X9mY0zFqiRIyja8rYRpn/v4xjcqgbRjta+olVZmvuIvFz4dHut+P6XXLALIX2wLzwt8+N8G0w5YXJljnQRujdRvuHm7z7p7ZmB5PKUSlNs7UJWSa25YBpp1wUhGmsS2glESd3rYMozVgag63g6GK7Z7eODmeEoiSZZqZM397n0Tl+qRKrNOY5369bQIAWF/IlusW113c/3ig+v1iAkm1dROrNG2isW2SIzm3WG0mvLunNGaOR3VR2Y0zdNGmmc6cP28fmyyuu/h+/3Pz/aKotXUlTDN1xn/eN1lc1/32/cfm+0VRa+uiTTOZzl7Hb5ssc9f999v95vtFUWvrok1ziyCroE0z3waO42yl30Ippaj5fO44Dm0aABiNRpv/iaiClwCensebLwDbyeMpFOb8qg7bNABb8I0+86s6GGmKRSPTYKSRhT6iMh1zdgBQbV5tIdKQeUiiaZfbYpVpYqlPSovKijSn+1DfP6gc9XndcHVc2Tv+mj/SDDs1ADpTUXrOqWzSRSWSLBUXlRFp+s29g9Pnbp3PB0KmyYw0w06t1mgEc5mZiLlTCEQaxUWlR5qr48p+9+m539wLz1DdehBT62dLizT3w5p+cw8AADh8kzW/vQY0emQmdHgk7vhRyW8a1UWlRpqvR9X62XKjctR/eu4398CveXru1qHaPDuuQFDjxxgJkWY5s2iaHUEo0gRhA4LgkTQEWSNomrT5TXpF9fklKJFpMs9NoYGqzTOZpkmJNPEv6vnXwoqf/gnKfk0TnJLIl13G6Ul2pAlhfbzY8WNSxDSKi2JGmm6dWp65Oq7AwSnrQjhmmmWDg9P1r2mWkHOp9JIGgR7rNMUVfRZPVQfvPRWLRqbBSCMLfURhpJGGRqbBSCMLfURtJ9cTMz4VgmGa4s3KgDkU1dFHFJpGGvqIQtNIQx9RaBpp6CMqxTSxW4fxBzfKWP5On99oeT3sV+kVd5/8jw7dFqKmoe+uDTs1wj/REyjpHTluwGWaJv6uit/b83if8bmjrGua5R+ST15O0yR3VzyLgGLVMz53jnyRhumGYadW63SiByUHp69VvskyTfzkpHq+UpzltKouivuaJs00EE9Hyxlpoq+ulGR+ScLzu+qiuE9P6ZEmpj7vNQ393qrPbwh5Rai6KB7TpNuheNOofvr3iX+GUP5Cje+aJrjkpz89dSSbhug2OFEp/kHD81gfNBUXxXNNE4s5sUpGnPUXIFYcPDxLGqVJ9ySXnkJdSovCFWFp6CMKTSMNfUShaaShjyg0jTT0EYWmkYY+ojDtElkBwzTFm5UBcyiqo48oNI009BGFppGGPqLQNNLQR1SqaZiZncWnezL+j7nSK+4+yf/NrrQotmmYmZ2bSveM/x9zxe/teR6ZJBTc0lZcVNoTqbJzZ9KRloRF1KicRRAnmB3FRbFMw+8Z2emesTSeRLc7flSuNk0yr1xNUblNIzXdc/kIYeJkr/r8hvjHkz9XqouSEGkkJ2GVN0e4NKLyXdNIT/fsNRhJXSqf/inKISrfpyfZ6Z7EHJbke2WeRl+W41ynKSDds9zrNOXIYcUVYWnoIwpNIw19RKFppKGPKDSNNPQRhaaRhj6iMN0TyYLppBI+BBopGjQNIgyaBhEGTYMIg6ZBhEHTIMKgaRBh0DSIMGgaRBg0DSIMmgYR5n/lubqG1Gu/tQAAAABJRU5ErkJggg==&quot; /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/u&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;i&gt;&lt;u&gt;&lt;b&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/u&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;i&gt;&lt;u&gt;&lt;b&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/u&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://paresh4you.blogspot.com/feeds/6541290901255101786/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/3738915380073694572/6541290901255101786' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3738915380073694572/posts/default/6541290901255101786'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3738915380073694572/posts/default/6541290901255101786'/><link rel='alternate' type='text/html' href='http://paresh4you.blogspot.com/2016/03/sql-pivoting-on-multiple-columns.html' title='SQL Pivoting on multiple columns'/><author><name>Paresh Patel</name><uri>http://www.blogger.com/profile/11363011501398480384</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiEvIVhlCJ9QU8YKsM40XF4pKcctXZF93MWS7gnWlaN_B3GsyfzTJqJ3faC8xuOO4sHLP_yY_yEIh07tbqe90Sl7F0KzyqDCEBsacubT7OHu7U6zPLtjbhqiVaIMmXSKw/s1600-r/Pareshnice.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3738915380073694572.post-7364015953557880529</id><published>2013-08-08T01:49:00.000-07:00</published><updated>2013-08-08T01:49:02.477-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Split"/><category scheme="http://www.blogger.com/atom/ns#" term="Split string into column"/><category scheme="http://www.blogger.com/atom/ns#" term="Sql Server"/><title type='text'>How to Split the string value into different column value</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;MsoNormal&quot;&gt;
We have split string and populate its value into rows. For
example&amp;nbsp;&amp;nbsp; “A, B, C” is split and
converted into rows with single column value like:&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; A&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; B&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; C&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
But how can we split the string and put their values in
different columns. Suppose we have person name in single column and his name is
separated using comma for first name, last name and middle name, we need to
split that string from that column and need to populate all these three values
in individual column.&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
It can be done using the &lt;b&gt;REPLACE()&lt;/b&gt; and &lt;b&gt;PARSENAME()&lt;/b&gt;
SQL functions.&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
Here is the example that demonstrates the use of PARSE
function for splitting the string values and put that into the different column
values.&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: blue; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;&quot;&gt;DECLARE&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;&quot;&gt; @name &lt;span style=&quot;color: blue;&quot;&gt;NVARCHAR&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;100&lt;span style=&quot;color: grey;&quot;&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: blue; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;&quot;&gt;SET&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;&quot;&gt; @name&lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;&#39;FName,MName,LName&#39;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
Now we replace the comma value with &lt;b&gt;“.”,&lt;/b&gt; that is require for parsing the string like array in C#.&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
Replace the string with “.” Instead “,” using:&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: blue; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;&quot;&gt;SET&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;&quot;&gt; @name&lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;REPLACE&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;@name&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;&#39;,&#39;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;&#39;.&#39;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
Now finally we parse the person name into different column
values by &lt;b&gt;PARSENAME() &lt;/b&gt;function.&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: blue; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;&quot;&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: magenta;&quot;&gt;PARSENAME&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;@name&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;3&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt; FName&lt;span style=&quot;color: grey;&quot;&gt;,&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: magenta;&quot;&gt;PARSENAME&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;@name&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;2&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt; MName&lt;span style=&quot;color: grey;&quot;&gt;,&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: magenta;&quot;&gt;PARSENAME&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;@name&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;1&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt; LName&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
Execute the whole query and it gives the result as:&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj7xFLmtos24vJqALrDLsIuVKosozuTjqKxmH_uZN4nW9kQA_MsoU5ZOtYCHjVvm2N2iLCXRvJO_yLZZ9Vc3Vb4DDJaRBlqUlQ1lhIjMUnRUV3_2bNLPb1iS_yhdiyo3HHyYQ3WCpRbag6p/s1600/ParseName.jpg&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;186&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj7xFLmtos24vJqALrDLsIuVKosozuTjqKxmH_uZN4nW9kQA_MsoU5ZOtYCHjVvm2N2iLCXRvJO_yLZZ9Vc3Vb4DDJaRBlqUlQ1lhIjMUnRUV3_2bNLPb1iS_yhdiyo3HHyYQ3WCpRbag6p/s320/ParseName.jpg&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://paresh4you.blogspot.com/feeds/7364015953557880529/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/3738915380073694572/7364015953557880529' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3738915380073694572/posts/default/7364015953557880529'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3738915380073694572/posts/default/7364015953557880529'/><link rel='alternate' type='text/html' href='http://paresh4you.blogspot.com/2013/08/how-to-split-string-value-into.html' title='How to Split the string value into different column value'/><author><name>Paresh Patel</name><uri>http://www.blogger.com/profile/11363011501398480384</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiEvIVhlCJ9QU8YKsM40XF4pKcctXZF93MWS7gnWlaN_B3GsyfzTJqJ3faC8xuOO4sHLP_yY_yEIh07tbqe90Sl7F0KzyqDCEBsacubT7OHu7U6zPLtjbhqiVaIMmXSKw/s1600-r/Pareshnice.JPG'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj7xFLmtos24vJqALrDLsIuVKosozuTjqKxmH_uZN4nW9kQA_MsoU5ZOtYCHjVvm2N2iLCXRvJO_yLZZ9Vc3Vb4DDJaRBlqUlQ1lhIjMUnRUV3_2bNLPb1iS_yhdiyo3HHyYQ3WCpRbag6p/s72-c/ParseName.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3738915380073694572.post-1950879003615623676</id><published>2013-06-20T23:38:00.000-07:00</published><updated>2013-06-20T23:38:09.201-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Fetch data from remote server"/><category scheme="http://www.blogger.com/atom/ns#" term="OpenRowSet"/><category scheme="http://www.blogger.com/atom/ns#" term="Sql Server"/><category scheme="http://www.blogger.com/atom/ns#" term="SQL Tips"/><title type='text'>Fetch data from remote server using OPENROWSET in SQL Server</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;MsoNormal&quot;&gt;
We are fetching the data from table in database with in
server or fetching data from different database with in server. But sometimes
we require fetching data from different database which is not in same server
but it is in different server.&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
For different database but with in same server we can get
records easily by “.(dot)” like:&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: blue; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;&quot;&gt; &lt;span style=&quot;color: grey;&quot;&gt;*&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;FROM&lt;/span&gt; DatabaseName&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;Schema&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;Table&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
Now let see how we can get the records from table from
database which is not in same server and it is situated at different server.&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
This can be possible by the Linked Server also. However if
we do not want to create link server and need to get the data then we have
option to use “&lt;b&gt;OpenRowSet”&lt;/b&gt;.&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
There are three parameters use in &lt;b&gt;OpenRowSet&lt;/b&gt; which are:&lt;/div&gt;
&lt;ul style=&quot;margin-top: 0in;&quot; type=&quot;disc&quot;&gt;
&lt;li class=&quot;MsoNormal&quot;&gt;Provider&lt;/li&gt;
&lt;li class=&quot;MsoNormal&quot;&gt;Server
     (IP Address) with credentials (username/password) and database&lt;/li&gt;
&lt;li class=&quot;MsoNormal&quot;&gt;Query
     (which is going to be executed with that server’s database)&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
Here is the syntax use to get data by &lt;b&gt;OpenRowSet&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: blue; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;&quot;&gt;OPENROWSET&lt;/span&gt;&lt;span style=&quot;color: grey; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: red; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;&quot;&gt;&#39;SQLNCLI&#39;&lt;/span&gt;&lt;span style=&quot;color: grey; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: red; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;&quot;&gt;&#39;Server=serverIP;Uid=UserName;Pwd=password;Database=DBName;&#39;&lt;/span&gt;&lt;span style=&quot;color: grey; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: red; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;&quot;&gt;&#39;SELECT
* FROM tablename&#39;&lt;/span&gt;&lt;span style=&quot;color: grey; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;&quot;&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
Before executing this query we need to set some option which
is requires to run the OpenRowSet query.&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;b&gt;Set this option:&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: maroon; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;&quot;&gt;sp_configure&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;&quot;&gt; &lt;span style=&quot;color: red;&quot;&gt;&#39;show advanced options&#39;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt; 1&lt;span style=&quot;color: grey;&quot;&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: blue; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;&quot;&gt;RECONFIGURE&lt;/span&gt;&lt;span style=&quot;color: grey; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;&quot;&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: blue; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;&quot;&gt;GO;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: maroon; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;&quot;&gt;sp_configure&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;&quot;&gt; &lt;span style=&quot;color: red;&quot;&gt;&#39;Ad Hoc Distributed Queries&#39;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt; 1&lt;span style=&quot;color: grey;&quot;&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: blue; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;&quot;&gt;RECONFIGURE&lt;/span&gt;&lt;span style=&quot;color: grey; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;&quot;&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: blue; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;&quot;&gt;GO;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
After
setting these option run the below query with proper required details:&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: blue; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;&quot;&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FS&lt;span style=&quot;color: grey;&quot;&gt;.*&lt;/span&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: blue; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;&quot;&gt;FROM&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;&quot;&gt; &lt;span style=&quot;color: blue;&quot;&gt;OPENROWSET&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;&#39;SQLNCLI&#39;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;&#39;Server=serverIP;Uid=UserName;Pwd=password;Database=DBName;&#39;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;&#39;SELECT * FROM tablename&#39;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;AS&lt;/span&gt; FS&lt;span style=&quot;color: grey;&quot;&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
This
will get the records from table which is not on same server but from remote
server which is created in database on given Server.&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
This
way it works without creating Linked Server&amp;nbsp;
or without using the Import/Export option which already given to export
the data from one server to other server by specifying the source and
destination.&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
We
can import/export the data from one database server to other database server’s
table by:&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;b&gt;Right click on database &amp;gt;&amp;gt; Go to Task
&amp;gt;&amp;gt; Go to Import/Export&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
Hope this helps…..&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://paresh4you.blogspot.com/feeds/1950879003615623676/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/3738915380073694572/1950879003615623676' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3738915380073694572/posts/default/1950879003615623676'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3738915380073694572/posts/default/1950879003615623676'/><link rel='alternate' type='text/html' href='http://paresh4you.blogspot.com/2013/06/fetch-data-from-remote-server-using.html' title='Fetch data from remote server using OPENROWSET in SQL Server'/><author><name>Paresh Patel</name><uri>http://www.blogger.com/profile/11363011501398480384</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiEvIVhlCJ9QU8YKsM40XF4pKcctXZF93MWS7gnWlaN_B3GsyfzTJqJ3faC8xuOO4sHLP_yY_yEIh07tbqe90Sl7F0KzyqDCEBsacubT7OHu7U6zPLtjbhqiVaIMmXSKw/s1600-r/Pareshnice.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3738915380073694572.post-4220089296288823217</id><published>2013-06-12T23:51:00.002-07:00</published><updated>2013-06-12T23:51:43.384-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Prevent saving changes"/><category scheme="http://www.blogger.com/atom/ns#" term="Sql Server"/><category scheme="http://www.blogger.com/atom/ns#" term="Table design SQL Server"/><category scheme="http://www.blogger.com/atom/ns#" term="Table re-creation"/><title type='text'>Allow saving changes that require table re-creation while changing table design</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;MsoNormal&quot;&gt;
Sometimes we have a situation that we need to change design
of table either changing the size of column or type of column or we need to add
new column into the existing table.&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
If we are doing table changes through wizard and we face an
issue sometimes that SQL doesn&#39;t allow us to save the changes and give the
restriction message like &lt;i&gt;“&lt;b&gt;saving changes is not permitted”&lt;/b&gt;&lt;/i&gt;
because of either tables has data and it requires to be re created or something
that not allowed with SQL rules.&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
See the below screen that comes when you change anything in
table structure and trying to save. It not comes every time but sometimes it
validates the table structure with internal mapping of type, constraints and
data.&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgrtX9qMIo6DUNl9I3Pv8mlPrZIgTnlU9hD8u2GYhBAiDIB6eAUpYzHjbSucDoUTP1v7XBpqfJWr6VckNqTAKzZUo1PBr7i9Jol1-pU1Y-K3A1lqSSNiJBLQ0NIFpSrutw5IoeDRgFiZwvg/s1600/Save1.jpg&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;180&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgrtX9qMIo6DUNl9I3Pv8mlPrZIgTnlU9hD8u2GYhBAiDIB6eAUpYzHjbSucDoUTP1v7XBpqfJWr6VckNqTAKzZUo1PBr7i9Jol1-pU1Y-K3A1lqSSNiJBLQ0NIFpSrutw5IoeDRgFiZwvg/s320/Save1.jpg&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
In above image we can see that it prevents to save table
changes and gives the validation message that it needs to be recreated and the
option to allow is not selected for this kind of message.&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
So here we should allow this by setting the option in SQL
Server &lt;b&gt;“Tool” &lt;/b&gt;menu.&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
Go to the&amp;nbsp;&lt;b&gt;Tool&lt;/b&gt;&amp;nbsp;and then go to the&amp;nbsp;&lt;b&gt;Option,&lt;/b&gt;&amp;nbsp;click on the&amp;nbsp;&lt;b&gt;Designer&amp;nbsp;&lt;/b&gt;item in left tree then select the&amp;nbsp;&lt;b&gt;Table and Database Designer&lt;/b&gt;. We will get the right side some of the option as showing in to the below screen.&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQQd36OutMSHRisxdg9Q0XQPVGHbZRxqlqrACXYC3ks66RQzls-i14ze_YtKQjaqe6aDuwU6vgo9fsY4qIplkMiLu1wH6zg-uo9gCB1DUq7WopmfubnpFOFt5tZf53d8I84501m4YflP7a/s1600/save2.jpg&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;188&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQQd36OutMSHRisxdg9Q0XQPVGHbZRxqlqrACXYC3ks66RQzls-i14ze_YtKQjaqe6aDuwU6vgo9fsY4qIplkMiLu1wH6zg-uo9gCB1DUq7WopmfubnpFOFt5tZf53d8I84501m4YflP7a/s320/save2.jpg&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
In above screen unchecked the “&lt;b&gt;Prevent saving changes that require table re-creation&lt;/b&gt;” option and
then click on OK.&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
After setting this option again try to save table structure
changes, Now that saving permission message has been removed and it allow for
the further changes.&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://paresh4you.blogspot.com/feeds/4220089296288823217/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/3738915380073694572/4220089296288823217' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3738915380073694572/posts/default/4220089296288823217'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3738915380073694572/posts/default/4220089296288823217'/><link rel='alternate' type='text/html' href='http://paresh4you.blogspot.com/2013/06/allow-saving-changes-that-require-table.html' title='Allow saving changes that require table re-creation while changing table design'/><author><name>Paresh Patel</name><uri>http://www.blogger.com/profile/11363011501398480384</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiEvIVhlCJ9QU8YKsM40XF4pKcctXZF93MWS7gnWlaN_B3GsyfzTJqJ3faC8xuOO4sHLP_yY_yEIh07tbqe90Sl7F0KzyqDCEBsacubT7OHu7U6zPLtjbhqiVaIMmXSKw/s1600-r/Pareshnice.JPG'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgrtX9qMIo6DUNl9I3Pv8mlPrZIgTnlU9hD8u2GYhBAiDIB6eAUpYzHjbSucDoUTP1v7XBpqfJWr6VckNqTAKzZUo1PBr7i9Jol1-pU1Y-K3A1lqSSNiJBLQ0NIFpSrutw5IoeDRgFiZwvg/s72-c/Save1.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3738915380073694572.post-1544395364688502927</id><published>2013-06-11T23:18:00.000-07:00</published><updated>2013-06-13T21:52:47.020-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Delete in SQL Server"/><category scheme="http://www.blogger.com/atom/ns#" term="Delete Vs Truncate"/><category scheme="http://www.blogger.com/atom/ns#" term="SQL Query"/><category scheme="http://www.blogger.com/atom/ns#" term="Sql Server"/><category scheme="http://www.blogger.com/atom/ns#" term="SQL Tips"/><category scheme="http://www.blogger.com/atom/ns#" term="Truncate in SQL Server"/><title type='text'>Delete Vs Truncate in SQL Server</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;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
We will see in this post How delete
and truncate will work with temp table.&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
We have use many times truncate and
delete command with Database Table and it works perfectly. It will allow
truncating the table if that table doesn&#39;t have any records or if it has
records then that table must not have any reference with other table.&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
If the table has reference with
other table then we can not truncate table without deleting or truncating the
reference table records. But we can delete the records from the reference
table.&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
Now here we see how the truncate and delete command works
with the &lt;b&gt;Temp Table&lt;/b&gt; and see the
difference between them.&lt;b&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
We will see with the below examples.&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;b&gt;Truncate:&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
Create one temp table with an identity field like below:&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: blue; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;&quot;&gt;CREATE&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;&quot;&gt; &lt;span style=&quot;color: blue;&quot;&gt;TABLE&lt;/span&gt; #Test&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: grey; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;&quot;&gt;(&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ID &lt;span style=&quot;color: blue;&quot;&gt;INT&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;IDENTITY&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;1&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;1&lt;span style=&quot;color: grey;&quot;&gt;),&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Name &lt;span style=&quot;color: blue;&quot;&gt;VARCHAR&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;10&lt;span style=&quot;color: grey;&quot;&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: grey; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;&quot;&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
Insert some recors into #Test Table&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: blue; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;&quot;&gt;INSERT&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;&quot;&gt; &lt;span style=&quot;color: blue;&quot;&gt;INTO&lt;/span&gt; #Test&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: blue; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;&quot;&gt;VALUES&lt;/span&gt;&lt;span style=&quot;color: grey; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: red; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;&quot;&gt;&#39;PP&#39;&lt;/span&gt;&lt;span style=&quot;color: grey; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;&quot;&gt;),(&lt;/span&gt;&lt;span style=&quot;color: red; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;&quot;&gt;&#39;AA&#39;&lt;/span&gt;&lt;span style=&quot;color: grey; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;&quot;&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
See the output using:&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: blue; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;&quot;&gt; &lt;span style=&quot;color: grey;&quot;&gt;*&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;FROM&lt;/span&gt; #Test&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjeaK4fPjBMiYxv6Jmrhf7zsNBpb1dOE0BzQR-Btk0Cjmf8MGfIEekgntKeiNWoVb9G0Nz2Hrs_AKMlRLSV3e955YbPuTS2vCBiHXLEDNw8gD-BXwwfKiU7pikQ9qI7s4B9JmX8-R8I3fne/s1600/Truncate1.jpg&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;221&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjeaK4fPjBMiYxv6Jmrhf7zsNBpb1dOE0BzQR-Btk0Cjmf8MGfIEekgntKeiNWoVb9G0Nz2Hrs_AKMlRLSV3e955YbPuTS2vCBiHXLEDNw8gD-BXwwfKiU7pikQ9qI7s4B9JmX8-R8I3fne/s320/Truncate1.jpg&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
Here you can see there two records are inserted with
identity value. Now we are truncating the temp table and inserting again these
records and sees what will happen.&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiqPIIECQCBpEODyd14uQKgbVREAgxsFOF2CByun2I-qoJBMXZqQGCO5tUWgSbEBAFnS62svJgsCVsBXT185yu24MGch-mqryUwFLwmwV5QoMwodI-qLpibawvdvNG47IgWw-X8Hu1KAyok/s1600/Truncate2.jpg&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;305&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiqPIIECQCBpEODyd14uQKgbVREAgxsFOF2CByun2I-qoJBMXZqQGCO5tUWgSbEBAFnS62svJgsCVsBXT185yu24MGch-mqryUwFLwmwV5QoMwodI-qLpibawvdvNG47IgWw-X8Hu1KAyok/s320/Truncate2.jpg&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
It has truncated the table and also reset the identity value
to its original seed.&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;b&gt;Delete:&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
Now we delete the records from temp table instead truncate and
then again insert the records into temp table and see what will happen.&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
Let see:&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjcnHywNeVVtsQghdAITE6KvNfPfmdKdfl4pWDbcGlqxA2NH2gv7YmKIm5BBqg7CMNfjYI_qUQNM2WPeX3W8p7DBGoR8I3n9NmCB0jV0vkx2fMWV8QQy6SCrWQYc6gQkJGnlLoEPoJQZ7-1/s1600/truncate3.jpg&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;320&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjcnHywNeVVtsQghdAITE6KvNfPfmdKdfl4pWDbcGlqxA2NH2gv7YmKIm5BBqg7CMNfjYI_qUQNM2WPeX3W8p7DBGoR8I3n9NmCB0jV0vkx2fMWV8QQy6SCrWQYc6gQkJGnlLoEPoJQZ7-1/s320/truncate3.jpg&quot; width=&quot;300&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
We can see in above result that after deleting the records
it has next identity value in ID field and it will insert the next increment
value into the ID field.&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
Remove the table after execution using this:&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: blue; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;&quot;&gt;DROP&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;&quot;&gt; &lt;span style=&quot;color: blue;&quot;&gt;TABLE&lt;/span&gt;
#Test&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
So here we conclude that the &lt;b&gt;Truncate&lt;/b&gt; command will delete the records from table and also reset
the identity value if any field has an identity set and reset it to the
original seed value. While &lt;b&gt;Delete&lt;/b&gt; command
just deletes the record from table and not resetting any value for identity
column.&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://paresh4you.blogspot.com/feeds/1544395364688502927/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/3738915380073694572/1544395364688502927' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3738915380073694572/posts/default/1544395364688502927'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3738915380073694572/posts/default/1544395364688502927'/><link rel='alternate' type='text/html' href='http://paresh4you.blogspot.com/2013/06/delete-vs-truncate-in-sql-server.html' title='Delete Vs Truncate in SQL Server'/><author><name>Paresh Patel</name><uri>http://www.blogger.com/profile/11363011501398480384</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiEvIVhlCJ9QU8YKsM40XF4pKcctXZF93MWS7gnWlaN_B3GsyfzTJqJ3faC8xuOO4sHLP_yY_yEIh07tbqe90Sl7F0KzyqDCEBsacubT7OHu7U6zPLtjbhqiVaIMmXSKw/s1600-r/Pareshnice.JPG'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjeaK4fPjBMiYxv6Jmrhf7zsNBpb1dOE0BzQR-Btk0Cjmf8MGfIEekgntKeiNWoVb9G0Nz2Hrs_AKMlRLSV3e955YbPuTS2vCBiHXLEDNw8gD-BXwwfKiU7pikQ9qI7s4B9JmX8-R8I3fne/s72-c/Truncate1.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3738915380073694572.post-8997567160937776203</id><published>2013-06-11T02:04:00.002-07:00</published><updated>2013-06-11T02:04:25.518-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term=".ldf .mdf file Size"/><category scheme="http://www.blogger.com/atom/ns#" term="Database file size"/><category scheme="http://www.blogger.com/atom/ns#" term="DB Size"/><category scheme="http://www.blogger.com/atom/ns#" term="Sql Server"/><category scheme="http://www.blogger.com/atom/ns#" term="SQL Server database file"/><title type='text'>Check the size of database files in SQL Server</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;MsoNormal&quot;&gt;
How can we check the size of particular database files like
.ldf and .mdf? &lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
We can check the size which is occupied by the database files
using the &lt;b&gt;sys.database_files&lt;/b&gt; view. &lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
To check the size of database files .ldf and .mdf use the
below query:&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: blue; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;&quot;&gt;use&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;&quot;&gt; databasename&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;&quot;&gt;GO&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: blue; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;&quot;&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;st1:place w:st=&quot;on&quot;&gt;&lt;st1:city w:st=&quot;on&quot;&gt;Name&lt;/st1:city&gt; &lt;st1:state w:st=&quot;on&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;AS&lt;/span&gt;&lt;/st1:state&gt;&lt;/st1:place&gt; DatabaseName&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;Physical_name
&lt;span style=&quot;color: blue;&quot;&gt;AS&lt;/span&gt; DBPath&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;,(&lt;/span&gt;size &lt;span style=&quot;color: grey;&quot;&gt;*&lt;/span&gt; 8&lt;span style=&quot;color: grey;&quot;&gt;)/&lt;/span&gt;1024 &lt;span style=&quot;color: blue;&quot;&gt;AS&lt;/span&gt; SizeMB&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: blue; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;&quot;&gt;FROM&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;&quot;&gt; &lt;span style=&quot;color: green;&quot;&gt;sys&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;database_files&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;b&gt;Output:&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg49k-XAZdyPCG2susw-DoBLoPMBXhamGA9PA7475pvVAE8m-U9c8V15feLpoPIOPJ3xYyuxYatlW-qNZgupkvjwQ3Hj8IePEApd2qKawS6u8jouZlgwKgBnZQJ09WZZo6pMCgWemB696UB/s1600/DbSize.jpg&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg49k-XAZdyPCG2susw-DoBLoPMBXhamGA9PA7475pvVAE8m-U9c8V15feLpoPIOPJ3xYyuxYatlW-qNZgupkvjwQ3Hj8IePEApd2qKawS6u8jouZlgwKgBnZQJ09WZZo6pMCgWemB696UB/s1600/DbSize.jpg&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
Here it shows the Database file name with location of file and size in MB unit.&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://paresh4you.blogspot.com/feeds/8997567160937776203/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/3738915380073694572/8997567160937776203' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3738915380073694572/posts/default/8997567160937776203'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3738915380073694572/posts/default/8997567160937776203'/><link rel='alternate' type='text/html' href='http://paresh4you.blogspot.com/2013/06/check-size-of-database-files-in-sql.html' title='Check the size of database files in SQL Server'/><author><name>Paresh Patel</name><uri>http://www.blogger.com/profile/11363011501398480384</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiEvIVhlCJ9QU8YKsM40XF4pKcctXZF93MWS7gnWlaN_B3GsyfzTJqJ3faC8xuOO4sHLP_yY_yEIh07tbqe90Sl7F0KzyqDCEBsacubT7OHu7U6zPLtjbhqiVaIMmXSKw/s1600-r/Pareshnice.JPG'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg49k-XAZdyPCG2susw-DoBLoPMBXhamGA9PA7475pvVAE8m-U9c8V15feLpoPIOPJ3xYyuxYatlW-qNZgupkvjwQ3Hj8IePEApd2qKawS6u8jouZlgwKgBnZQJ09WZZo6pMCgWemB696UB/s72-c/DbSize.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3738915380073694572.post-6377568262200388286</id><published>2013-06-09T23:20:00.001-07:00</published><updated>2013-06-09T23:28:41.729-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="default Size"/><category scheme="http://www.blogger.com/atom/ns#" term="Default varchar limit"/><category scheme="http://www.blogger.com/atom/ns#" term="Sql Server"/><category scheme="http://www.blogger.com/atom/ns#" term="Varchar datatype"/><title type='text'>Default character limit for VARCHAR DataType</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;MsoNormal&quot;&gt;
We use many time even mostly VARCHAR DataType in SQL Server.
But some time we get issue or confusion with the default limit or character
size of VARCHAR datatype, and that comes to the logical error with your queries
or in your compile code (Stored Procedure) when execute it and gives the wrong
output.&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
We will see how it works when we do not define size with
VARCHAR datatype and give us the unexpected output.&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
See the below two scenarios how&amp;nbsp;&lt;span style=&quot;color: blue; font-family: &#39;Courier New&#39;; font-size: 13px;&quot;&gt;VARCHAR&amp;nbsp;&lt;/span&gt;datatype works with query:&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;b&gt;Scenario 1:&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;&quot;&gt;1. &lt;span style=&quot;color: blue;&quot;&gt;VARCHAR&lt;/span&gt; datatype With &lt;span style=&quot;color: magenta;&quot;&gt;Variable&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;&quot;&gt;--Varchar used with variable&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: blue; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;&quot;&gt;DECLARE&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;&quot;&gt; @a &lt;span style=&quot;color: blue;&quot;&gt;VARCHAR&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: blue; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;&quot;&gt;SET&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;&quot;&gt; @a &lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;&#39;Paresh&#39;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: blue; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;&quot;&gt; @a &lt;span style=&quot;color: blue;&quot;&gt;AS&lt;/span&gt;
Value&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;b&gt;Output:&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgh2KE2UW7PYCnS-YwxmF2zzIkIGEYRf-f4netV6iMZ42kfAuOJTrV28ZqQvkT0-udnltS-PF2qtEciP3uF5Uz32OOOnases9-ZhDqLe5aE3Fh5zfVirUiMNauSizzFfGuStn2Jz443FFms/s1600/Varchar1.jpg&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgh2KE2UW7PYCnS-YwxmF2zzIkIGEYRf-f4netV6iMZ42kfAuOJTrV28ZqQvkT0-udnltS-PF2qtEciP3uF5Uz32OOOnases9-ZhDqLe5aE3Fh5zfVirUiMNauSizzFfGuStn2Jz443FFms/s1600/Varchar1.jpg&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-size: 12pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-size: 12pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-size: 12pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;
&lt;b&gt;&lt;span style=&quot;font-size: 12pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;Now here in this scenario we can see it gives output as only
1 character because when we use&amp;nbsp;&lt;span style=&quot;color: blue; font-family: &#39;Courier New&#39;; font-size: 13px;&quot;&gt;VARCHAR&lt;/span&gt;&amp;nbsp;DataType with variable and not define
any size it takes only single character size default.&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;b&gt;Scenario 2:&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;&quot;&gt;2. &lt;span style=&quot;color: blue;&quot;&gt;VARCHAR &lt;/span&gt;&lt;/span&gt;datatype&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;&quot;&gt; &lt;/span&gt;with&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;&quot;&gt; &lt;span style=&quot;color: magenta;&quot;&gt;Convert&lt;/span&gt;
&lt;span style=&quot;color: grey;&quot;&gt;and&lt;/span&gt; &lt;span style=&quot;color: magenta;&quot;&gt;Cast&lt;/span&gt; &lt;/span&gt;function&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;&quot;&gt;--Varchar used with CONVERT or CAST Fucntion&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: blue; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;&quot;&gt; &lt;span style=&quot;color: magenta;&quot;&gt;CONVERT&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;VARCHAR&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;&#39;aaaaa bbbbbb cccccc dddddd eeeee ffffff ggggg hhhhhh&#39;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;AS&lt;/span&gt; Value&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: blue; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;&quot;&gt; &lt;span style=&quot;color: magenta;&quot;&gt;CAST&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;&#39;aaaaa bbbbbb cccccc dddddd
eeeee ffffff ggggg hhhhhh&#39;&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;AS&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;VARCHAR&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;AS&lt;/span&gt; Value&lt;/span&gt;&lt;b&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-size: 12pt;&quot;&gt;Output:&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhnbNhE-VeF5Tfe_S-SjwF8hK7XpJfzZtc6IjA4bOIosLzxLYrLZkpKkAhtJ0cw1yjZY-rQO6RGjxteNMI6tdvqhyphenhyphenG_bVfMgOLonrufP-9vh6O4kz6yQvlpp5MhHv8XEsFSOYHnMTcp1oic/s1600/varchar2.jpg&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhnbNhE-VeF5Tfe_S-SjwF8hK7XpJfzZtc6IjA4bOIosLzxLYrLZkpKkAhtJ0cw1yjZY-rQO6RGjxteNMI6tdvqhyphenhyphenG_bVfMgOLonrufP-9vh6O4kz6yQvlpp5MhHv8XEsFSOYHnMTcp1oic/s1600/varchar2.jpg&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-size: 12pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-size: 12pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-size: 12pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;
&lt;b&gt;&lt;span style=&quot;font-size: 12pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
Here we can see that when&amp;nbsp;&lt;span style=&quot;color: blue; font-family: &#39;Courier New&#39;; font-size: 13px;&quot;&gt;VARCHAR &lt;/span&gt;DataType use with &lt;b&gt;Convert&lt;/b&gt; or &lt;b&gt;Cast&lt;/b&gt; function then it takes the 30 character as default size for it
and give the output with only 30 characters.&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&amp;nbsp;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
So here we need to keep in mind that when we use&amp;nbsp;&lt;span style=&quot;color: blue; font-family: &#39;Courier New&#39;; font-size: 13px;&quot;&gt;VARCHAR &lt;/span&gt;Datatype then MUST give the size whatever it requires as per the use.&lt;/div&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://paresh4you.blogspot.com/feeds/6377568262200388286/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/3738915380073694572/6377568262200388286' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3738915380073694572/posts/default/6377568262200388286'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3738915380073694572/posts/default/6377568262200388286'/><link rel='alternate' type='text/html' href='http://paresh4you.blogspot.com/2013/06/default-character-limit-for-varchar.html' title='Default character limit for VARCHAR DataType'/><author><name>Paresh Patel</name><uri>http://www.blogger.com/profile/11363011501398480384</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiEvIVhlCJ9QU8YKsM40XF4pKcctXZF93MWS7gnWlaN_B3GsyfzTJqJ3faC8xuOO4sHLP_yY_yEIh07tbqe90Sl7F0KzyqDCEBsacubT7OHu7U6zPLtjbhqiVaIMmXSKw/s1600-r/Pareshnice.JPG'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgh2KE2UW7PYCnS-YwxmF2zzIkIGEYRf-f4netV6iMZ42kfAuOJTrV28ZqQvkT0-udnltS-PF2qtEciP3uF5Uz32OOOnases9-ZhDqLe5aE3Fh5zfVirUiMNauSizzFfGuStn2Jz443FFms/s72-c/Varchar1.jpg" height="72" width="72"/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3738915380073694572.post-5322604098594295472</id><published>2013-06-07T02:25:00.000-07:00</published><updated>2013-06-07T02:25:10.947-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Drop multiple table in SQL Server"/><category scheme="http://www.blogger.com/atom/ns#" term="Drop table"/><category scheme="http://www.blogger.com/atom/ns#" term="Single DROP statement"/><category scheme="http://www.blogger.com/atom/ns#" term="SQL Server DROP"/><title type='text'>DROP multiple tables using single DROP statement</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;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
We know that how to drop a table. But we can also drop multiple tables using only single drop
statement. How? Let see using the below example:&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
Just create multiple tables like:&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: blue; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;&quot;&gt;CREATE&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;&quot;&gt; &lt;span style=&quot;color: blue;&quot;&gt;TABLE&lt;/span&gt; t1&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;ID1 &lt;span style=&quot;color: blue;&quot;&gt;INT&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: blue; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;&quot;&gt;CREATE&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;&quot;&gt; &lt;span style=&quot;color: blue;&quot;&gt;TABLE&lt;/span&gt; t2&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;ID2 &lt;span style=&quot;color: blue;&quot;&gt;INT&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;&quot;&gt;CREATE&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;&quot;&gt; &lt;span style=&quot;color: blue;&quot;&gt;TABLE&lt;/span&gt; t3&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;ID3 &lt;span style=&quot;color: blue;&quot;&gt;INT&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
Try to select the table data to
confirm that tables are created successfully by:&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: blue; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;&quot;&gt; &lt;span style=&quot;color: grey;&quot;&gt;*&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;FROM&lt;/span&gt; t1&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: blue; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;&quot;&gt; &lt;span style=&quot;color: grey;&quot;&gt;*&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;FROM&lt;/span&gt; t2&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;&quot;&gt; &lt;span style=&quot;color: grey;&quot;&gt;*&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;FROM&lt;/span&gt; t3&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;&quot;&gt;Tables are created, Now we are
going to drop those tables using single drop statement as below:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;&quot;&gt;DROP&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;&quot;&gt; &lt;span style=&quot;color: blue;&quot;&gt;TABLE&lt;/span&gt; t1&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;t2&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;t3&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;&quot;&gt;That’s work perfectly..&lt;/span&gt; &lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://paresh4you.blogspot.com/feeds/5322604098594295472/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/3738915380073694572/5322604098594295472' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3738915380073694572/posts/default/5322604098594295472'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3738915380073694572/posts/default/5322604098594295472'/><link rel='alternate' type='text/html' href='http://paresh4you.blogspot.com/2013/06/drop-multiple-tables-using-single-drop.html' title='DROP multiple tables using single DROP statement'/><author><name>Paresh Patel</name><uri>http://www.blogger.com/profile/11363011501398480384</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiEvIVhlCJ9QU8YKsM40XF4pKcctXZF93MWS7gnWlaN_B3GsyfzTJqJ3faC8xuOO4sHLP_yY_yEIh07tbqe90Sl7F0KzyqDCEBsacubT7OHu7U6zPLtjbhqiVaIMmXSKw/s1600-r/Pareshnice.JPG'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3738915380073694572.post-6899082326934482167</id><published>2013-05-31T23:24:00.001-07:00</published><updated>2013-05-31T23:24:56.277-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Add new column"/><category scheme="http://www.blogger.com/atom/ns#" term="Default values"/><category scheme="http://www.blogger.com/atom/ns#" term="Insert default"/><category scheme="http://www.blogger.com/atom/ns#" term="Paresh blog"/><category scheme="http://www.blogger.com/atom/ns#" term="Sql Server"/><title type='text'>Insert default value for newly adding column in existing records in table in SQL Server.</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;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
Here we see how we insert default values in newly added column in table which already has some records in it.&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
Sometime we are in situation that
we need to add new column and we need to assign default property to that
column. If the table in which we add new column is empty then we don’t have an
issue to set default values but if that table already having some records and
we are adding new column with default value then either we need to be empty the
table or update the records with default values.&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
Now in this case if there is lots
of record in table then it is not easy to do this. But we have one simple way
to come out of this very easily.&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;
Simply create one table with two columns,
insert some records into it:&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: blue; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;&quot;&gt;CREATE&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;&quot;&gt; &lt;span style=&quot;color: blue;&quot;&gt;TABLE&lt;/span&gt; TestTable&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: grey; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;&quot;&gt;(&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ID &lt;span style=&quot;color: blue;&quot;&gt;INT&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Name &lt;span style=&quot;color: blue;&quot;&gt;VARCHAR&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;10&lt;span style=&quot;color: grey;&quot;&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: grey; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;&quot;&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: blue; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;&quot;&gt;INSERT&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;&quot;&gt; &lt;span style=&quot;color: blue;&quot;&gt;INTO&lt;/span&gt; TestTable&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: blue; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;&quot;&gt;VALUES&lt;/span&gt;&lt;span style=&quot;color: grey; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;&quot;&gt;1&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;&#39;PP&#39;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;),(&lt;/span&gt;2&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;&#39;AA&#39;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: blue; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;&quot;&gt; &lt;span style=&quot;color: grey;&quot;&gt;*&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;FROM&lt;/span&gt; TestTable&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;b&gt;Output:&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/div&gt;
&lt;table border=&quot;1&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;MsoTableGrid&quot; style=&quot;border-collapse: collapse; border: none; mso-border-alt: solid windowtext .5pt; mso-border-insideh: .5pt solid windowtext; mso-border-insidev: .5pt solid windowtext; mso-padding-alt: 0in 5.4pt 0in 5.4pt; mso-yfti-tbllook: 480;&quot;&gt;
 &lt;tbody&gt;
&lt;tr&gt;
  &lt;td style=&quot;border: solid windowtext 1.0pt; mso-border-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 59.4pt;&quot; valign=&quot;top&quot; width=&quot;79&quot;&gt;
  &lt;div class=&quot;MsoNormal&quot;&gt;
ID&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;border-left: none; border: solid windowtext 1.0pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: .75in;&quot; valign=&quot;top&quot; width=&quot;72&quot;&gt;
  &lt;div class=&quot;MsoNormal&quot;&gt;
Name&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;tr&gt;
  &lt;td style=&quot;border-top: none; border: solid windowtext 1.0pt; mso-border-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 59.4pt;&quot; valign=&quot;top&quot; width=&quot;79&quot;&gt;
  &lt;div class=&quot;MsoNormal&quot;&gt;
1&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: .75in;&quot; valign=&quot;top&quot; width=&quot;72&quot;&gt;
  &lt;div class=&quot;MsoNormal&quot;&gt;
PP&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;tr&gt;
  &lt;td style=&quot;border-top: none; border: solid windowtext 1.0pt; mso-border-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 59.4pt;&quot; valign=&quot;top&quot; width=&quot;79&quot;&gt;
  &lt;div class=&quot;MsoNormal&quot;&gt;
2&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: .75in;&quot; valign=&quot;top&quot; width=&quot;72&quot;&gt;
  &lt;div class=&quot;MsoNormal&quot;&gt;
AA&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
Now we are adding new column with default values in existing
records using:&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: blue; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;&quot;&gt;ALTER&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;&quot;&gt; &lt;span style=&quot;color: blue;&quot;&gt;TABLE&lt;/span&gt; TestTable&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: blue; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;&quot;&gt;ADD&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;&quot;&gt; newColumn &lt;span style=&quot;color: blue;&quot;&gt;BIT&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;DEFAULT&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;0&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;WITH&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;VALUES&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: blue; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;&quot;&gt; &lt;span style=&quot;color: grey;&quot;&gt;*&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;FROM&lt;/span&gt; TestTable&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;b&gt;Output:&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/div&gt;
&lt;table border=&quot;1&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;MsoTableGrid&quot; style=&quot;border-collapse: collapse; border: none; mso-border-alt: solid windowtext .5pt; mso-border-insideh: .5pt solid windowtext; mso-border-insidev: .5pt solid windowtext; mso-padding-alt: 0in 5.4pt 0in 5.4pt; mso-yfti-tbllook: 480;&quot;&gt;
 &lt;tbody&gt;
&lt;tr&gt;
  &lt;td style=&quot;border: solid windowtext 1.0pt; mso-border-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 59.4pt;&quot; valign=&quot;top&quot; width=&quot;79&quot;&gt;
  &lt;div class=&quot;MsoNormal&quot;&gt;
ID&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;border-left: none; border: solid windowtext 1.0pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: .75in;&quot; valign=&quot;top&quot; width=&quot;72&quot;&gt;
  &lt;div class=&quot;MsoNormal&quot;&gt;
Name&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;border-left: none; border: solid windowtext 1.0pt; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: .75in;&quot; valign=&quot;top&quot; width=&quot;72&quot;&gt;
  &lt;div class=&quot;MsoNormal&quot;&gt;
newColumn&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;tr&gt;
  &lt;td style=&quot;border-top: none; border: solid windowtext 1.0pt; mso-border-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 59.4pt;&quot; valign=&quot;top&quot; width=&quot;79&quot;&gt;
  &lt;div class=&quot;MsoNormal&quot;&gt;
1&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: .75in;&quot; valign=&quot;top&quot; width=&quot;72&quot;&gt;
  &lt;div class=&quot;MsoNormal&quot;&gt;
PP&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: .75in;&quot; valign=&quot;top&quot; width=&quot;72&quot;&gt;
  &lt;div class=&quot;MsoNormal&quot;&gt;
0&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;tr&gt;
  &lt;td style=&quot;border-top: none; border: solid windowtext 1.0pt; mso-border-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: 59.4pt;&quot; valign=&quot;top&quot; width=&quot;79&quot;&gt;
  &lt;div class=&quot;MsoNormal&quot;&gt;
2&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: .75in;&quot; valign=&quot;top&quot; width=&quot;72&quot;&gt;
  &lt;div class=&quot;MsoNormal&quot;&gt;
AA&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt; padding: 0in 5.4pt 0in 5.4pt; width: .75in;&quot; valign=&quot;top&quot; width=&quot;72&quot;&gt;
  &lt;div class=&quot;MsoNormal&quot;&gt;
0&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://paresh4you.blogspot.com/feeds/6899082326934482167/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/3738915380073694572/6899082326934482167' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3738915380073694572/posts/default/6899082326934482167'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3738915380073694572/posts/default/6899082326934482167'/><link rel='alternate' type='text/html' href='http://paresh4you.blogspot.com/2013/05/insert-default-value-for-newly-adding.html' title='Insert default value for newly adding column in existing records in table in SQL Server.'/><author><name>Paresh Patel</name><uri>http://www.blogger.com/profile/11363011501398480384</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiEvIVhlCJ9QU8YKsM40XF4pKcctXZF93MWS7gnWlaN_B3GsyfzTJqJ3faC8xuOO4sHLP_yY_yEIh07tbqe90Sl7F0KzyqDCEBsacubT7OHu7U6zPLtjbhqiVaIMmXSKw/s1600-r/Pareshnice.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3738915380073694572.post-6171135241968066192</id><published>2013-03-07T23:09:00.002-08:00</published><updated>2013-03-07T23:09:25.837-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Display count for number of column in table with non zero values for each rows"/><title type='text'>Display count for number of column in table with non zero values for each rows</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
declare @t table (ID INT IDENTITY(1,1),a int,b int,c int,d int)&lt;br /&gt;
&lt;br /&gt;
insert into @t&lt;br /&gt;
values(1,0,0,0),(0,1,0,0),(1,2,0,0),(1,2,3,4),(1,2,3,0)&lt;br /&gt;
&lt;br /&gt;
;with cte as&lt;br /&gt;
(&lt;br /&gt;
select * from @t&lt;br /&gt;
unpivot&lt;br /&gt;
(colvalue for colname in(a,b,c,d)) unpvt&lt;br /&gt;
)&lt;br /&gt;
&lt;br /&gt;
select t.*,cnt from @t t&lt;br /&gt;
INNER JOIN (&lt;br /&gt;
select ID,COUNT(*) as cnt&lt;br /&gt;
from cte&lt;br /&gt;
WHERE colvalue &amp;gt; 0&lt;br /&gt;
GROUP BY ID&lt;br /&gt;
) x ON x.ID = t.ID&lt;br /&gt;
&lt;br /&gt;
Output :&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgpdKXAKVD0C88k2ouKHIgGvY77pJEJ4DU_uM_jOtVvVDvf92vLvq5kP9BZtjhkDhY-92gXWgyLMu26DfQ8vEFVGxR0sQbjLvbGHuyvezeGKbmk_sNY-ShGNw9jl7PBhIwk6wALgnmY5sSj/s1600/Count.jpg&quot; imageanchor=&quot;1&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgpdKXAKVD0C88k2ouKHIgGvY77pJEJ4DU_uM_jOtVvVDvf92vLvq5kP9BZtjhkDhY-92gXWgyLMu26DfQ8vEFVGxR0sQbjLvbGHuyvezeGKbmk_sNY-ShGNw9jl7PBhIwk6wALgnmY5sSj/s320/Count.jpg&quot; /&gt;&lt;/a&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://paresh4you.blogspot.com/feeds/6171135241968066192/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/3738915380073694572/6171135241968066192' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3738915380073694572/posts/default/6171135241968066192'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3738915380073694572/posts/default/6171135241968066192'/><link rel='alternate' type='text/html' href='http://paresh4you.blogspot.com/2013/03/display-count-for-number-of-column-in.html' title='Display count for number of column in table with non zero values for each rows'/><author><name>Paresh Patel</name><uri>http://www.blogger.com/profile/11363011501398480384</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiEvIVhlCJ9QU8YKsM40XF4pKcctXZF93MWS7gnWlaN_B3GsyfzTJqJ3faC8xuOO4sHLP_yY_yEIh07tbqe90Sl7F0KzyqDCEBsacubT7OHu7U6zPLtjbhqiVaIMmXSKw/s1600-r/Pareshnice.JPG'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgpdKXAKVD0C88k2ouKHIgGvY77pJEJ4DU_uM_jOtVvVDvf92vLvq5kP9BZtjhkDhY-92gXWgyLMu26DfQ8vEFVGxR0sQbjLvbGHuyvezeGKbmk_sNY-ShGNw9jl7PBhIwk6wALgnmY5sSj/s72-c/Count.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3738915380073694572.post-3438330677109454300</id><published>2012-11-04T22:33:00.000-08:00</published><updated>2012-11-04T22:36:16.416-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Remove non alphabetic character from string in SQL Server"/><title type='text'>Remove non alphabetic character from string in SQL Server</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Query to remove non alphabetic character from string in sql server:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
DECLARE @str varchar(100) = &#39;Paresh@#$Patel#$!@#888&#39;&lt;br /&gt;
&lt;br /&gt;
SELECT CAST(&lt;br /&gt;
&amp;nbsp; (SELECT CASE&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;WHEN SUBSTRING(@str, n, 1) LIKE &#39;[A-Z]&#39;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;THEN SUBSTRING(@str, n, 1)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ELSE &#39;&#39;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; END&lt;br /&gt;
&amp;nbsp; FROM (SELECT number&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; FROM master..spt_values&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; WHERE type = &#39;P&#39;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; AND number BETWEEN 1 AND 50) AS Number(n)&lt;br /&gt;
&amp;nbsp; WHERE n &amp;lt;= LEN(@str)&lt;br /&gt;
&amp;nbsp; FOR XML PATH(&#39;&#39;)) AS NVARCHAR(100))&lt;br /&gt;
&lt;br /&gt;
Run this query you will get the output like :&lt;br /&gt;
&lt;br /&gt;
PareshPatel&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://paresh4you.blogspot.com/feeds/3438330677109454300/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/3738915380073694572/3438330677109454300' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3738915380073694572/posts/default/3438330677109454300'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3738915380073694572/posts/default/3438330677109454300'/><link rel='alternate' type='text/html' href='http://paresh4you.blogspot.com/2012/11/here-is-query-to-remove-non-alphabetic.html' title='Remove non alphabetic character from string in SQL Server'/><author><name>Paresh Patel</name><uri>http://www.blogger.com/profile/11363011501398480384</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiEvIVhlCJ9QU8YKsM40XF4pKcctXZF93MWS7gnWlaN_B3GsyfzTJqJ3faC8xuOO4sHLP_yY_yEIh07tbqe90Sl7F0KzyqDCEBsacubT7OHu7U6zPLtjbhqiVaIMmXSKw/s1600-r/Pareshnice.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3738915380073694572.post-4353890177953117368</id><published>2012-09-03T23:42:00.003-07:00</published><updated>2012-09-03T23:43:09.220-07:00</updated><title type='text'>Find sequential discharge date from multiple discharge date</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Create one table variable and insert the data as need :&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
DECLARE @table table(patID INT,AdmDate Datetime,DisDate Datetime)&lt;br /&gt;
&lt;br /&gt;
INSERT INTO @table&lt;br /&gt;
values(1,&#39;2012-01-10&#39;,&#39;2012-01-15&#39;),&lt;br /&gt;
(1,&#39;2012-01-16&#39;,&#39;2012-01-20&#39;),&lt;br /&gt;
(1,&#39;2012-01-21&#39;,&#39;2012-01-25&#39;),&lt;br /&gt;
(2,&#39;2012-01-10&#39;,&#39;2012-01-15&#39;),&lt;br /&gt;
(2,&#39;2012-01-17&#39;,&#39;2012-01-20&#39;)&lt;br /&gt;
&lt;br /&gt;
After inserting data here is the query to find the sequential discharge date.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;WITH cte (PatientId, AdmDt, Disdt, AdmDt2, Rnk) AS&lt;br /&gt;
(&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;SELECT t1.PatientID, t1.AdmissionDate, t1.DischargeDate, t2.AdmissionDate, ROW_NUMBER() OVER(PARTITION BY t1.PatientId ORDER BY t1.PatientId, t1.AdmissionDate, t1.DischargeDate) AS Rnk&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;FROM @table t1&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;LEFT JOIN @table t2 ON (t1.PatientID = t2.PatientID AND DATEADD(DAY, 1, t1.DischargeDate) = t2.AdmissionDate)&lt;br /&gt;
),&lt;br /&gt;
cte1 (PatientId, AdmDt, DisDt, NextRnk) AS&lt;br /&gt;
(&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;SELECT D1.PatientId, D1.AdmDt, D1.Disdt,&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;CASE WHEN D1.AdmDt2 IS NULL THEN D1.Rnk ELSE &amp;nbsp;MIN(D2.Rnk) End AS NextRnk&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;FROM cte D1&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;LEFT JOIN cte D2 ON (D1.PatientId = D2.PatientId AND D2.Rnk &amp;gt; D1.Rnk AND D2.AdmDt2 IS NULL)&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;GROUP BY D1.PatientId, D1.AdmDt, D1.Disdt,D1.AdmDt2, D1.Rnk&lt;br /&gt;
)&lt;br /&gt;
SELECT D1.PatientId, MIN(D1.AdmDt) AS AdminssionDate, MAX(D1.DisDt) AS DischargeDate&lt;br /&gt;
FROM cte1 D1&lt;br /&gt;
GROUP BY D1.PatientId, D1.NextRnk&lt;br /&gt;
ORDER BY D1.PatientId, D1.NextRnk&lt;br /&gt;
&lt;br /&gt;
This will gives the output as :&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiZ5945RjcLjHLEgsHvWl1cJdS5iX0mkhADe9jQ6PRmjdXqmoD0SE_r8yKTiOW9n-JeO6QPt0YKXibazEJvshtIN7sLMjtLmHvTD3ZD9OIrwSH_6aWv8-IfuhuK0pPeocvHg23BStPpgiha/s1600/SeqDate.jpg&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;116&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiZ5945RjcLjHLEgsHvWl1cJdS5iX0mkhADe9jQ6PRmjdXqmoD0SE_r8yKTiOW9n-JeO6QPt0YKXibazEJvshtIN7sLMjtLmHvTD3ZD9OIrwSH_6aWv8-IfuhuK0pPeocvHg23BStPpgiha/s320/SeqDate.jpg&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://paresh4you.blogspot.com/feeds/4353890177953117368/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/3738915380073694572/4353890177953117368' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3738915380073694572/posts/default/4353890177953117368'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3738915380073694572/posts/default/4353890177953117368'/><link rel='alternate' type='text/html' href='http://paresh4you.blogspot.com/2012/09/find-sequential-discharge-date-from.html' title='Find sequential discharge date from multiple discharge date'/><author><name>Paresh Patel</name><uri>http://www.blogger.com/profile/11363011501398480384</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiEvIVhlCJ9QU8YKsM40XF4pKcctXZF93MWS7gnWlaN_B3GsyfzTJqJ3faC8xuOO4sHLP_yY_yEIh07tbqe90Sl7F0KzyqDCEBsacubT7OHu7U6zPLtjbhqiVaIMmXSKw/s1600-r/Pareshnice.JPG'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiZ5945RjcLjHLEgsHvWl1cJdS5iX0mkhADe9jQ6PRmjdXqmoD0SE_r8yKTiOW9n-JeO6QPt0YKXibazEJvshtIN7sLMjtLmHvTD3ZD9OIrwSH_6aWv8-IfuhuK0pPeocvHg23BStPpgiha/s72-c/SeqDate.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3738915380073694572.post-629585052398739302</id><published>2012-05-07T06:13:00.001-07:00</published><updated>2012-05-07T06:13:56.380-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Find physical path for Database backup file in SQL Server"/><title type='text'>Find physical path for Database backup file in SQL Server</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
This is the query to find the physical location for&amp;nbsp;backed up&amp;nbsp;database file.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
SELECT &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;physical_device_name,&lt;br /&gt;
&amp;nbsp; &amp;nbsp; backup_start_date,&lt;br /&gt;
&amp;nbsp; &amp;nbsp; backup_finish_date,&lt;br /&gt;
&amp;nbsp; &amp;nbsp; backup_size/1024.0 AS BackupSizeKB&lt;br /&gt;
FROM msdb.dbo.backupset bs&lt;br /&gt;
INNER JOIN msdb.dbo.backupmediafamily bm ON bs.media_set_id = bm.media_set_id&lt;br /&gt;
WHERE database_name = &#39;Testdb&#39;&lt;br /&gt;
ORDER BY backup_finish_date DESC&lt;br /&gt;
&lt;br /&gt;
Output :&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjbwFvbsDl6li1lNoXF3vY0USqU6xIKBVhLBrLRtSbYZq0BcBmfIiNrbgsTlN5lApmRQ634j1Bnu4tSZIvbGEP1NGz4EXjvb23Z1KhPTmFdfHh8UvyDxW9FHqI2GQ49WOaOG4iDwh8FNgZx/s1600/PhysicalLocation.jpg&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;47&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjbwFvbsDl6li1lNoXF3vY0USqU6xIKBVhLBrLRtSbYZq0BcBmfIiNrbgsTlN5lApmRQ634j1Bnu4tSZIvbGEP1NGz4EXjvb23Z1KhPTmFdfHh8UvyDxW9FHqI2GQ49WOaOG4iDwh8FNgZx/s400/PhysicalLocation.jpg&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://paresh4you.blogspot.com/feeds/629585052398739302/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/3738915380073694572/629585052398739302' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3738915380073694572/posts/default/629585052398739302'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3738915380073694572/posts/default/629585052398739302'/><link rel='alternate' type='text/html' href='http://paresh4you.blogspot.com/2012/05/find-physical-path-for-database-backup.html' title='Find physical path for Database backup file in SQL Server'/><author><name>Paresh Patel</name><uri>http://www.blogger.com/profile/11363011501398480384</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiEvIVhlCJ9QU8YKsM40XF4pKcctXZF93MWS7gnWlaN_B3GsyfzTJqJ3faC8xuOO4sHLP_yY_yEIh07tbqe90Sl7F0KzyqDCEBsacubT7OHu7U6zPLtjbhqiVaIMmXSKw/s1600-r/Pareshnice.JPG'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjbwFvbsDl6li1lNoXF3vY0USqU6xIKBVhLBrLRtSbYZq0BcBmfIiNrbgsTlN5lApmRQ634j1Bnu4tSZIvbGEP1NGz4EXjvb23Z1KhPTmFdfHh8UvyDxW9FHqI2GQ49WOaOG4iDwh8FNgZx/s72-c/PhysicalLocation.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3738915380073694572.post-1240552964248760424</id><published>2012-04-19T05:48:00.003-07:00</published><updated>2012-04-19T05:50:19.537-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="How to Get XML Response From Web URL In SQL Server"/><title type='text'>Get XML Response From Web URL</title><content type='html'>First set the following option in sql :&lt;br /&gt;  sp_configure &#39;show advanced option&#39;,1&lt;br /&gt;  reconfigure&lt;br /&gt;    &lt;br /&gt;  Sp_configure &#39;Ole Automation Procedures&#39;,1&lt;br /&gt;  Reconfigure&lt;br /&gt;&lt;br /&gt;Then after run the following script by passing your web URL to get the XML response.&lt;br /&gt;    &lt;br /&gt;    DECLARE @Object as Int; &lt;br /&gt;    Declare @ResponseText as Varchar(8000); &lt;br /&gt;    Declare @Url as Varchar(MAX); &lt;br /&gt;    select @Url = &#39;http://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml&#39; &lt;br /&gt; &lt;br /&gt;    Exec sp_OACreate &#39;MSXML2.XMLHTTP&#39;, @Object OUT; &lt;br /&gt;    Exec sp_OAMethod @Object, &#39;open&#39;, NULL, &#39;get&#39;, @Url, &#39;false&#39; &lt;br /&gt;    Exec sp_OAMethod @Object, &#39;send&#39; &lt;br /&gt;    Exec sp_OAMethod @Object, &#39;responseText&#39;, @ResponseText OUTPUT      &lt;br /&gt;    Exec sp_OADestroy @Object &lt;br /&gt;&lt;br /&gt;    --load into Xml &lt;br /&gt;    Declare @XmlResponse as xml; &lt;br /&gt;    &lt;br /&gt;    &lt;br /&gt;    select @XmlResponse = CAST(@ResponseText as xml) &lt;br /&gt;    select @XmlResponse</content><link rel='replies' type='application/atom+xml' href='http://paresh4you.blogspot.com/feeds/1240552964248760424/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/3738915380073694572/1240552964248760424' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3738915380073694572/posts/default/1240552964248760424'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3738915380073694572/posts/default/1240552964248760424'/><link rel='alternate' type='text/html' href='http://paresh4you.blogspot.com/2012/04/get-xml-response-from-web-url.html' title='Get XML Response From Web URL'/><author><name>Paresh Patel</name><uri>http://www.blogger.com/profile/11363011501398480384</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiEvIVhlCJ9QU8YKsM40XF4pKcctXZF93MWS7gnWlaN_B3GsyfzTJqJ3faC8xuOO4sHLP_yY_yEIh07tbqe90Sl7F0KzyqDCEBsacubT7OHu7U6zPLtjbhqiVaIMmXSKw/s1600-r/Pareshnice.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3738915380073694572.post-3051780063199742636</id><published>2012-03-27T01:16:00.002-07:00</published><updated>2012-03-27T01:19:26.625-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="How to find an exact Age using Birth date in SQL Server"/><title type='text'>Find exact Age using Birth date</title><content type='html'>Create this scalar function to get the exact Age.&lt;br /&gt;&lt;br /&gt;ALTER FUNCTION GetAgeByBirthDate(&lt;br /&gt; @BirthDate DATETIME,&lt;br /&gt; @CurrentDate DATE&lt;br /&gt;)&lt;br /&gt;RETURNS VARCHAR(200)&lt;br /&gt;BEGIN&lt;br /&gt; DECLARE @Year INT,&lt;br /&gt;   @Month INT,&lt;br /&gt;   @Day INT,&lt;br /&gt;   @Age VARCHAR(200)&lt;br /&gt;   &lt;br /&gt;&lt;br /&gt;&lt;br /&gt; IF MONTH(@BirthDate) &lt;&gt; MONTH(@CurrentDate) BEGIN&lt;br /&gt;  SELECT @Year = DATEDIFF(yy,@BirthDate,@CurrentDate)-1&lt;br /&gt;  SELECT @Month = DATEDIFF(mm,DATEADD(yy,@Year,@BirthDate),@CurrentDate)&lt;br /&gt;  &lt;br /&gt; END ELSE BEGIN&lt;br /&gt;  SELECT @Year = DATEDIFF(yy,@BirthDate,@CurrentDate)&lt;br /&gt;  SELECT @Month = 0&lt;br /&gt; END&lt;br /&gt;&lt;br /&gt; IF DAY(@BirthDate) &lt;= DAY(@CurrentDate) BEGIN&lt;br /&gt;  SELECT @Day = DATEDIFF(dd,DATEADD(mm,@Month,DATEADD(yy,@year,@BirthDate)),@CurrentDate)&lt;br /&gt; END ELSE BEGIN&lt;br /&gt;  SELECT @Day = DATEDIFF(dd,DATEADD(mm,@Month-1,DATEADD(yy,@year,@BirthDate)),@CurrentDate)&lt;br /&gt; END&lt;br /&gt;  &lt;br /&gt; SELECT @Age = &#39;Your age is &#39; + CAST(@Year AS VARCHAR(4)) + &#39; YEARS &#39; + CAST(@Month AS VARCHAR(4)) + &#39; MONTHS and &#39; + CAST(@Day AS VARCHAR(4)) + &#39; DAYS.&#39;&lt;br /&gt; &lt;br /&gt; RETURN @Age&lt;br /&gt;END&lt;br /&gt;&lt;br /&gt;After creating this function run this query :&lt;br /&gt;SELECT dbo.GetAgeByBirthDate(&#39;1981-12-19&#39;,GETDATE())&lt;br /&gt;&lt;br /&gt;First argument is the birth date and second is the current date.</content><link rel='replies' type='application/atom+xml' href='http://paresh4you.blogspot.com/feeds/3051780063199742636/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/3738915380073694572/3051780063199742636' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3738915380073694572/posts/default/3051780063199742636'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3738915380073694572/posts/default/3051780063199742636'/><link rel='alternate' type='text/html' href='http://paresh4you.blogspot.com/2012/03/find-exact-age-using-birth-date.html' title='Find exact Age using Birth date'/><author><name>Paresh Patel</name><uri>http://www.blogger.com/profile/11363011501398480384</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiEvIVhlCJ9QU8YKsM40XF4pKcctXZF93MWS7gnWlaN_B3GsyfzTJqJ3faC8xuOO4sHLP_yY_yEIh07tbqe90Sl7F0KzyqDCEBsacubT7OHu7U6zPLtjbhqiVaIMmXSKw/s1600-r/Pareshnice.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3738915380073694572.post-2894370116960802203</id><published>2011-10-05T03:01:00.001-07:00</published><updated>2011-10-05T03:01:20.017-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="How to use Recursive CTE in SQL SERVER"/><title type='text'>Recursive CTE in SQL SERVER</title><content type='html'>This shows the use of recursive cte that displays a next six month based on passing the values (Year and Month).&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;DECLARE @year int,&lt;br /&gt;  @month int&lt;br /&gt;&lt;br /&gt;SELECT @year = 2010,&lt;br /&gt;  @month = 9&lt;br /&gt;&lt;br /&gt;;WITH cte AS (&lt;br /&gt;  SELECT &lt;br /&gt;   DATEADD(MONTH,@month-1,DATEADD(year,@year-1,cast(&#39;00010101&#39; as date))) as  date1&lt;br /&gt;  UNION ALL&lt;br /&gt;  SELECT DATEADD(month,1,date1)&lt;br /&gt;  FROM cte&lt;br /&gt;  WHERE date1 &lt; DATEADD(MONTH,@month + 4,DATEADD(year,@year-1,cast(&#39;00010101&#39; as date)))&lt;br /&gt;)&lt;br /&gt;&lt;br /&gt;SELECT * FROM cte&lt;br /&gt;GO&lt;br /&gt;&lt;br /&gt;And Output will be :&lt;br /&gt;&lt;br /&gt;date1&lt;br /&gt;-------------&lt;br /&gt;2010-09-01&lt;br /&gt;2010-10-01&lt;br /&gt;2010-11-01&lt;br /&gt;2010-12-01&lt;br /&gt;2011-01-01&lt;br /&gt;2011-02-01</content><link rel='replies' type='application/atom+xml' href='http://paresh4you.blogspot.com/feeds/2894370116960802203/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/3738915380073694572/2894370116960802203' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3738915380073694572/posts/default/2894370116960802203'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3738915380073694572/posts/default/2894370116960802203'/><link rel='alternate' type='text/html' href='http://paresh4you.blogspot.com/2011/10/recursive-cte-in-sql-server.html' title='Recursive CTE in SQL SERVER'/><author><name>Paresh Patel</name><uri>http://www.blogger.com/profile/11363011501398480384</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiEvIVhlCJ9QU8YKsM40XF4pKcctXZF93MWS7gnWlaN_B3GsyfzTJqJ3faC8xuOO4sHLP_yY_yEIh07tbqe90Sl7F0KzyqDCEBsacubT7OHu7U6zPLtjbhqiVaIMmXSKw/s1600-r/Pareshnice.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3738915380073694572.post-3958872666863932401</id><published>2011-10-04T03:58:00.000-07:00</published><updated>2011-10-04T04:03:23.127-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="UNPIVOT in SQL SERVER with Example"/><title type='text'>UNPIVOT in SQL SERVER with Example</title><content type='html'>Here in this example it shows the Max column value for the specific ID&lt;br /&gt;how it is get by UnPIVOT let see :&lt;br /&gt;&lt;br /&gt;DECLARE @Test AS TABLE(id INT, col1 INT, col2 INT, col3 INT, col4 INT)&lt;br /&gt;INSERT INTO @Test VALUES(1, 100, 500, 300, 200)&lt;br /&gt;INSERT INTO @Test VALUES(2, 600, 300, 500, 400)&lt;br /&gt;INSERT INTO @Test VALUES(3, 400, 100, 800, 300)&lt;br /&gt;&lt;br /&gt;SELECT ID,MAX(data) AS MaxValue&lt;br /&gt;FROM&lt;br /&gt;(&lt;br /&gt; SELECT ID,Data&lt;br /&gt; FROM &lt;br /&gt; (SELECT ID, col1, col2, col3, col4&lt;br /&gt;    FROM @Test &lt;br /&gt;    ) p &lt;br /&gt; UNPIVOT&lt;br /&gt;    (Data FOR Datavalue IN &lt;br /&gt;    (col1, col2, col3, col4)&lt;br /&gt; )AS unpvt&lt;br /&gt;) AS x&lt;br /&gt;GROUP BY ID&lt;br /&gt;GO&lt;br /&gt;&lt;br /&gt;The output will be :&lt;br /&gt;-------------&lt;br /&gt;ID MaxValue&lt;br /&gt;-----  ------------&lt;br /&gt;1 500&lt;br /&gt;2 600&lt;br /&gt;3 800</content><link rel='replies' type='application/atom+xml' href='http://paresh4you.blogspot.com/feeds/3958872666863932401/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/3738915380073694572/3958872666863932401' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3738915380073694572/posts/default/3958872666863932401'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3738915380073694572/posts/default/3958872666863932401'/><link rel='alternate' type='text/html' href='http://paresh4you.blogspot.com/2011/10/unpivot-in-sql-server-with-example.html' title='UNPIVOT in SQL SERVER with Example'/><author><name>Paresh Patel</name><uri>http://www.blogger.com/profile/11363011501398480384</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiEvIVhlCJ9QU8YKsM40XF4pKcctXZF93MWS7gnWlaN_B3GsyfzTJqJ3faC8xuOO4sHLP_yY_yEIh07tbqe90Sl7F0KzyqDCEBsacubT7OHu7U6zPLtjbhqiVaIMmXSKw/s1600-r/Pareshnice.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3738915380073694572.post-660637339077356937</id><published>2011-09-18T22:10:00.000-07:00</published><updated>2011-09-18T22:11:28.719-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Count the difference of character in two string in SQL Server"/><title type='text'>Count the difference of character in two string in SQL Server</title><content type='html'>Create the sql function and use it like below :&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;--Select dbo.DiffCount(&#39;BOB&#39;, &#39;BOB&#39;)&lt;br /&gt;CREATE FUNCTION dbo.DiffCount(@Str1 varchar(500), @Str2 varchar(500))&lt;br /&gt;Returns int As&lt;br /&gt;BEGIN&lt;br /&gt; DECLARE @len1 INT,&lt;br /&gt;   @len2 INT,&lt;br /&gt;   @DiffLen INT,&lt;br /&gt;   @CharIndex INT,&lt;br /&gt;   @Inc INT,&lt;br /&gt;   @diffcount INT&lt;br /&gt;   &lt;br /&gt; SELECT @len1 = DATALENGTH(@str1),&lt;br /&gt;   @len2 = DATALENGTH(@str2),&lt;br /&gt;   @DiffLen = @len1 - @len2,&lt;br /&gt;   @diffcount = 0,&lt;br /&gt;   @Inc = 1&lt;br /&gt;   &lt;br /&gt; IF  @len1 &lt;= @len2 BEGIN &lt;br /&gt;&lt;br /&gt;  WHILE @Inc &lt;= @len2 BEGIN&lt;br /&gt;  &lt;br /&gt;   IF SUBSTRING(@str1,@inc,1) = NULLIF(SUBSTRING(@str2,@inc,1),&#39; &#39;) BEGIN&lt;br /&gt;    set @diffcount = @diffcount &lt;br /&gt;   END ELSE BEGIN&lt;br /&gt;    SET @diffcount = @diffcount + 1&lt;br /&gt;   END&lt;br /&gt;   SET @Inc = @Inc + 1&lt;br /&gt;  END&lt;br /&gt; END ELSE IF @len1 &gt; @len2 BEGIN &lt;br /&gt;  WHILE @Inc &lt;= @len1 BEGIN&lt;br /&gt;  &lt;br /&gt;   IF NULLIF(SUBSTRING(@str1,@inc,1),&#39; &#39;) = SUBSTRING(@str2,@inc,1) BEGIN&lt;br /&gt;    set @diffcount = @diffcount &lt;br /&gt;   END ELSE BEGIN&lt;br /&gt;    SET @diffcount = @diffcount + 1&lt;br /&gt;   END&lt;br /&gt;   SET @Inc = @Inc + 1&lt;br /&gt;  END&lt;br /&gt;  &lt;br /&gt; END&lt;br /&gt; RETURN @diffcount&lt;br /&gt;END</content><link rel='replies' type='application/atom+xml' href='http://paresh4you.blogspot.com/feeds/660637339077356937/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/3738915380073694572/660637339077356937' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3738915380073694572/posts/default/660637339077356937'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3738915380073694572/posts/default/660637339077356937'/><link rel='alternate' type='text/html' href='http://paresh4you.blogspot.com/2011/09/count-difference-of-character-in-two.html' title='Count the difference of character in two string in SQL Server'/><author><name>Paresh Patel</name><uri>http://www.blogger.com/profile/11363011501398480384</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiEvIVhlCJ9QU8YKsM40XF4pKcctXZF93MWS7gnWlaN_B3GsyfzTJqJ3faC8xuOO4sHLP_yY_yEIh07tbqe90Sl7F0KzyqDCEBsacubT7OHu7U6zPLtjbhqiVaIMmXSKw/s1600-r/Pareshnice.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3738915380073694572.post-4832941261977588293</id><published>2011-09-14T21:49:00.001-07:00</published><updated>2011-10-05T08:31:08.941-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Retrieve comma seperated values in to a table in SQL Server"/><title type='text'>Retrieve comma separated values into a table</title><content type='html'>Hi ,&lt;br /&gt;&lt;br /&gt;You can use this table vale function to get the comma separated string into form of table retrieve value.&lt;br /&gt;&lt;br /&gt;just create this function and select result from that .&lt;br /&gt;&lt;br /&gt;--SELECT * from dbo.CommaSeparatedToTableVale(&#39;app,birds,cow,paresh,dhaval&#39;)&lt;br /&gt;CREATE FUNCTION CommaSeparatedToTableVale&lt;br /&gt;(&lt;br /&gt; @str VARCHAR(100)&lt;br /&gt;)&lt;br /&gt;RETURNS @Table&lt;br /&gt;TABLE(rec VARCHAR(50))&lt;br /&gt;AS&lt;br /&gt;BEGIN&lt;br /&gt; DECLARE @len INT&lt;br /&gt; DECLARE @inc int&lt;br /&gt; DECLARE @offset INT&lt;br /&gt; DECLARE @newstr VARCHAR(100)&lt;br /&gt;&lt;br /&gt; select @len = DATALENGTH(@str),&lt;br /&gt;   @inc = 0,&lt;br /&gt;   @offset = 0&lt;br /&gt;&lt;br /&gt; while @inc &lt;= @len+1 begin&lt;br /&gt;   &lt;br /&gt;   IF ISNULL(@newstr,&#39;&#39;) = &#39;&#39; BEGIN&lt;br /&gt;   SELECT @offset = charindex(&#39;,&#39;,@str)&lt;br /&gt;   INSERT INTO @Table&lt;br /&gt;   SELECT SUBSTRING(@str,0,@offset)&lt;br /&gt;   SELECT @newstr  = SUBSTRING(@str,@offset+1,@len)&lt;br /&gt;  END ELSE BEGIN&lt;br /&gt;   SELECT @offset = charindex(&#39;,&#39;,@newstr)&lt;br /&gt;   if @offset = 0 begin&lt;br /&gt;    INSERT INTO @Table&lt;br /&gt;    SELECT @newstr&lt;br /&gt;    break&lt;br /&gt;   end else begin&lt;br /&gt;    INSERT INTO @Table&lt;br /&gt;    SELECT SUBSTRING(@newstr,0,@offset)&lt;br /&gt;   end &lt;br /&gt;   SELECT @newstr  = SUBSTRING(@newstr,@offset+1,@len)&lt;br /&gt;  END&lt;br /&gt;   SET @len = @len - @offset &lt;br /&gt;   SET @inc = @inc + 1&lt;br /&gt; end&lt;br /&gt; --RETURN @table&lt;br /&gt; return&lt;br /&gt;END&lt;br /&gt;&lt;br /&gt;And you may also refer this for using XML :&lt;br /&gt;&lt;br /&gt;http://sqlyoga.com/2009/05/sql-server-get-comma-separated-values.html</content><link rel='replies' type='application/atom+xml' href='http://paresh4you.blogspot.com/feeds/4832941261977588293/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/3738915380073694572/4832941261977588293' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3738915380073694572/posts/default/4832941261977588293'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3738915380073694572/posts/default/4832941261977588293'/><link rel='alternate' type='text/html' href='http://paresh4you.blogspot.com/2011/09/retreive-comma-seperated-values-in-to.html' title='Retrieve comma separated values into a table'/><author><name>Paresh Patel</name><uri>http://www.blogger.com/profile/11363011501398480384</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiEvIVhlCJ9QU8YKsM40XF4pKcctXZF93MWS7gnWlaN_B3GsyfzTJqJ3faC8xuOO4sHLP_yY_yEIh07tbqe90Sl7F0KzyqDCEBsacubT7OHu7U6zPLtjbhqiVaIMmXSKw/s1600-r/Pareshnice.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3738915380073694572.post-8592457631976028084</id><published>2010-05-26T03:53:00.000-07:00</published><updated>2010-05-26T04:09:48.412-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Query to search text of all sql server database objects"/><title type='text'>Query to search text of all sql server database objects</title><content type='html'>here the sql query to search releated objects those includes this text:&lt;br /&gt;&lt;br /&gt;select &lt;br /&gt; ss.name as [schema],&lt;br /&gt; so.name as [Object],&lt;br /&gt; so.type_desc as [objectType]&lt;br /&gt;FROM sys.objects so&lt;br /&gt;Inner join sys.schemas ss on ss.schema_ID = so.schema_Id&lt;br /&gt;inner join syscomments sc On sc.Id = so.object_ID&lt;br /&gt;where is_ms_shipped =0 ANd sc.text like &#39;%test%&#39;</content><link rel='replies' type='application/atom+xml' href='http://paresh4you.blogspot.com/feeds/8592457631976028084/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/3738915380073694572/8592457631976028084' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3738915380073694572/posts/default/8592457631976028084'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3738915380073694572/posts/default/8592457631976028084'/><link rel='alternate' type='text/html' href='http://paresh4you.blogspot.com/2010/05/search-sql-objects-by-text.html' title='Query to search text of all sql server database objects'/><author><name>Paresh Patel</name><uri>http://www.blogger.com/profile/11363011501398480384</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiEvIVhlCJ9QU8YKsM40XF4pKcctXZF93MWS7gnWlaN_B3GsyfzTJqJ3faC8xuOO4sHLP_yY_yEIh07tbqe90Sl7F0KzyqDCEBsacubT7OHu7U6zPLtjbhqiVaIMmXSKw/s1600-r/Pareshnice.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3738915380073694572.post-3496901883348513548</id><published>2008-12-19T21:26:00.000-08:00</published><updated>2008-12-19T21:31:51.156-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Read XMLColumn value and Get it in Table format"/><title type='text'>Read XMLColumn value and Get it in Table format</title><content type='html'>for Example the XML value is Like :&lt;br /&gt;&lt;br /&gt;&lt;root&gt;&lt;br /&gt;&lt;d id=&quot;a&quot;&gt;bbb&lt;/d&gt;&lt;br /&gt;&lt;d id=&quot;b&quot;&gt;vvv&lt;/d&gt;&lt;br /&gt;&lt;d id=&quot;c&quot;&gt;aaa&lt;/d&gt;&lt;br /&gt;&lt;/root&gt;&lt;br /&gt;&lt;br /&gt;SELECT r1.value (&#39;./@id&#39;, &#39;varchar(100)&#39;) as Attribute, &#39;&#39; as Value&lt;br /&gt;FROM [Table Name] CROSS APPLY [ColumnName].nodes (&#39;Root/D&#39;) AS x (r1)</content><link rel='replies' type='application/atom+xml' href='http://paresh4you.blogspot.com/feeds/3496901883348513548/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/3738915380073694572/3496901883348513548' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3738915380073694572/posts/default/3496901883348513548'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3738915380073694572/posts/default/3496901883348513548'/><link rel='alternate' type='text/html' href='http://paresh4you.blogspot.com/2008/12/read-xmlcolumn-value-and-get-it-in.html' title='Read XMLColumn value and Get it in Table format'/><author><name>Paresh Patel</name><uri>http://www.blogger.com/profile/11363011501398480384</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiEvIVhlCJ9QU8YKsM40XF4pKcctXZF93MWS7gnWlaN_B3GsyfzTJqJ3faC8xuOO4sHLP_yY_yEIh07tbqe90Sl7F0KzyqDCEBsacubT7OHu7U6zPLtjbhqiVaIMmXSKw/s1600-r/Pareshnice.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3738915380073694572.post-4085466728945301456</id><published>2008-12-19T21:23:00.000-08:00</published><updated>2008-12-19T21:25:51.851-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="SQL Function for Comma seperator value to return in Table format"/><title type='text'>SQL Function for Comma seperator value to return in Table format</title><content type='html'>Create FUNCTION  List_to_vc_table&lt;br /&gt; (@list varchar(8000))&lt;br /&gt;RETURNS @tbl Table (number varchar(1000) not null)&lt;br /&gt;AS&lt;br /&gt;--Returns The Given Comma Specified list in Varchar Table&lt;br /&gt;BEGIN&lt;br /&gt;DECLARE @ID varchar(20), @Pos int&lt;br /&gt;&lt;br /&gt;SET @list = LTRIM (RTRIM (@list) )+ &#39;,&#39;&lt;br /&gt;SET @Pos = CHARINDEX(&#39;,&#39; , @list, 1)&lt;br /&gt;IF REPLACE (@list, &#39;,&#39;, &#39; &#39;) &lt;&gt; &#39;&#39;&lt;br /&gt;BEGIN&lt;br /&gt;WHILE @Pos &gt;0&lt;br /&gt;BEGIN&lt;br /&gt;SET @ID = LTRIM(RTRIM(LEFT(@list, @Pos - 1)))&lt;br /&gt;IF @ID &lt;&gt; &#39; &#39;&lt;br /&gt;BEGIN&lt;br /&gt;INSERT @tbl (number) values (@ID)&lt;br /&gt;END&lt;br /&gt;SET @list = RIGHT(@list, LEN (@list) - @Pos)&lt;br /&gt;SET @Pos = CHARINDEX(&#39;,&#39; , @list, 1)&lt;br /&gt;END&lt;br /&gt;END&lt;br /&gt;return&lt;br /&gt;END</content><link rel='replies' type='application/atom+xml' href='http://paresh4you.blogspot.com/feeds/4085466728945301456/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/3738915380073694572/4085466728945301456' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3738915380073694572/posts/default/4085466728945301456'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3738915380073694572/posts/default/4085466728945301456'/><link rel='alternate' type='text/html' href='http://paresh4you.blogspot.com/2008/12/sql-function-for-comma-seperator-value.html' title='SQL Function for Comma seperator value to return in Table format'/><author><name>Paresh Patel</name><uri>http://www.blogger.com/profile/11363011501398480384</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiEvIVhlCJ9QU8YKsM40XF4pKcctXZF93MWS7gnWlaN_B3GsyfzTJqJ3faC8xuOO4sHLP_yY_yEIh07tbqe90Sl7F0KzyqDCEBsacubT7OHu7U6zPLtjbhqiVaIMmXSKw/s1600-r/Pareshnice.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3738915380073694572.post-3251693771830736804</id><published>2008-11-20T01:49:00.000-08:00</published><updated>2008-11-20T02:21:54.297-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="XML Serialization/Deserialization in C#.Net with Collection of objects"/><title type='text'>XML Serialization/Deserialization of Collection of Objects</title><content type='html'>&lt;ul&gt;&lt;li&gt;Make one &lt;strong&gt;sEmployee&lt;/strong&gt; Class with their Property. And one &lt;strong&gt;Employeecollection&lt;/strong&gt; class of that sEmployee Class.&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;public class sEmployee&lt;br /&gt;{&lt;br /&gt;public string FirstName;&lt;br /&gt;public string LastName;&lt;br /&gt;public int Age;&lt;br /&gt;public sEmployee()&lt;br /&gt;{&lt;br /&gt;}&lt;br /&gt;public sEmployee(string first, string last, int age)&lt;br /&gt;{&lt;br /&gt;this.FirstName = first;&lt;br /&gt;this.LastName = last;&lt;br /&gt;this.Age= age;&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Implement the &lt;strong&gt;CollectionBase &lt;/strong&gt;for adding multiple employee item in collection by override their Add Method.&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;br /&gt;public class EmployeeCollection : CollectionBase&lt;br /&gt;{&lt;br /&gt;public EmployeeCollection() { }&lt;br /&gt;public EmployeeCollection(EmployeeCollection value) { this.AddRange(value); }&lt;br /&gt;public EmployeeCollection(sEmployee[] value) { this.AddRange(value); }&lt;br /&gt;public sEmployee this[int index] { get { return ((sEmployee)(List[index])); } set { List[index] = value; } }&lt;br /&gt;public int Add(sEmployee value) { return List.Add(value); }&lt;br /&gt;public void AddRange(sEmployee[] value) { for (int i = 0; i &lt; i =&quot; 0;&quot;&gt; &lt;ul&gt;&lt;li&gt;Now create one sample page for serialization and Deserialization.here i have took one .aspx page and code behind i have wrote this simple code,and saving that data into XML file.&lt;/li&gt;&lt;/ul&gt;&lt;strong&gt;Serialization :&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;/strong&gt;&lt;br /&gt;EmployeeCollection empCollection = new EmployeeCollection();&lt;br /&gt;empCollection.Add(new sEmployee(&quot;Paresh0&quot;, &quot;Patel0&quot;, 20));&lt;br /&gt;empCollection.Add(new sEmployee(&quot;Paresh1&quot;, &quot;Patel1&quot;, 21));&lt;br /&gt;empCollection.Add(new sEmployee(&quot;Paresh2&quot;, &quot;Patel2&quot;, 22));&lt;br /&gt;&lt;br /&gt;string op = string.Empty;&lt;br /&gt;using (StringWriter writer = new StringWriter(new StringBuilder()))&lt;br /&gt;{&lt;br /&gt;XmlSerializer xs = new XmlSerializer(typeof(EmployeeCollection));&lt;br /&gt;xs.Serialize(writer, empCollection);&lt;br /&gt;op = writer.ToString();&lt;br /&gt;}&lt;br /&gt;File.WriteAllText(&quot;c:\\emp.xml&quot;, op);&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Deserialization :&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;string ip = string.Empty;&lt;br /&gt;EmployeeCollection collection = new EmployeeCollection();&lt;br /&gt;ip = File.ReadAllText(&quot;c:\\emp.xml&quot;);&lt;br /&gt;using (StringReader reader = new StringReader(ip))&lt;br /&gt;{&lt;br /&gt;XmlSerializer xs = new XmlSerializer(typeof(EmployeeCollection));&lt;br /&gt;collection = (EmployeeCollection)xs.Deserialize(reader);&lt;br /&gt;}</content><link rel='replies' type='application/atom+xml' href='http://paresh4you.blogspot.com/feeds/3251693771830736804/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/3738915380073694572/3251693771830736804' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3738915380073694572/posts/default/3251693771830736804'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3738915380073694572/posts/default/3251693771830736804'/><link rel='alternate' type='text/html' href='http://paresh4you.blogspot.com/2008/11/xml-serializationdeserialization.html' title='XML Serialization/Deserialization of Collection of Objects'/><author><name>Paresh Patel</name><uri>http://www.blogger.com/profile/11363011501398480384</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiEvIVhlCJ9QU8YKsM40XF4pKcctXZF93MWS7gnWlaN_B3GsyfzTJqJ3faC8xuOO4sHLP_yY_yEIh07tbqe90Sl7F0KzyqDCEBsacubT7OHu7U6zPLtjbhqiVaIMmXSKw/s1600-r/Pareshnice.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3738915380073694572.post-4108144216730719473</id><published>2008-11-20T01:47:00.000-08:00</published><updated>2008-11-20T01:49:48.870-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Multiple Record value in One Filed"/><title type='text'>Get Comma Seperator Value in one Filed</title><content type='html'>select &lt;strong&gt;STUFF&lt;/strong&gt; ( (SELECT &#39;,&#39; + [Column_name]&lt;br /&gt;FROM [TableName] WHERE [Criteria]&lt;br /&gt;&lt;strong&gt;FOR XML PATH&lt;/strong&gt;(&#39;&#39;)), 1, 1, &#39;&#39;) AS [DIsplay Name]</content><link rel='replies' type='application/atom+xml' href='http://paresh4you.blogspot.com/feeds/4108144216730719473/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/3738915380073694572/4108144216730719473' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3738915380073694572/posts/default/4108144216730719473'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3738915380073694572/posts/default/4108144216730719473'/><link rel='alternate' type='text/html' href='http://paresh4you.blogspot.com/2008/11/get-comma-seperator-value-in-one-filed.html' title='Get Comma Seperator Value in one Filed'/><author><name>Paresh Patel</name><uri>http://www.blogger.com/profile/11363011501398480384</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiEvIVhlCJ9QU8YKsM40XF4pKcctXZF93MWS7gnWlaN_B3GsyfzTJqJ3faC8xuOO4sHLP_yY_yEIh07tbqe90Sl7F0KzyqDCEBsacubT7OHu7U6zPLtjbhqiVaIMmXSKw/s1600-r/Pareshnice.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3738915380073694572.post-4770961055305929530</id><published>2008-11-13T01:22:00.000-08:00</published><updated>2008-11-13T01:56:45.222-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Automatic Restore Backup database"/><title type='text'>Automatically Restore Database ( Backup databse)</title><content type='html'>set ANSI_NULLS ON&lt;br /&gt;set QUOTED_IDENTIFIER ON&lt;br /&gt;go&lt;br /&gt;Create PROCEDURE [dbo].[DBA_Recovery_FULL]&lt;br /&gt;as&lt;br /&gt;/*&lt;br /&gt;Table Used :- master.dbo.sysdatabases&lt;br /&gt;*/&lt;br /&gt;------------------------------------------------------------------------------------------------------------------------------------------------------------------------&lt;br /&gt;----Restore Full Backup of OldDatabase Database to another Database&lt;br /&gt;------------------------------------------------------------------------------------------------------------------------------------------------------------------------&lt;br /&gt;Begin&lt;br /&gt;declare&lt;br /&gt;@spid as nvarchar(4),&lt;br /&gt;@killcommand as nvarchar(255) ,@unc as nvarchar(255)&lt;br /&gt;while (select count(*) from master.dbo.sysprocesses pc&lt;br /&gt;inner join master.dbo.sysdatabases sd on pc.dbid=sd.dbid&lt;br /&gt;where pc.loginame&lt;&gt;&#39;sa&#39; and pc.spid &lt;&gt; @@SPID and sd.name = &#39;NewDatabase&#39;)&lt;&gt;0&lt;br /&gt;BEGIN&lt;br /&gt;set @spid = (select top 1 pc.spid from master.dbo.sysprocesses pc&lt;br /&gt;inner join master.dbo.sysdatabases sd on pc.dbid=sd.dbid&lt;br /&gt;where pc.loginame &lt;&gt; &#39;sa&#39; and pc.spid &lt;&gt; @@SPID and sd.name = &#39;NewDatabase&#39;)&lt;br /&gt;set @killcommand = &#39;kill &#39; + @spid&lt;br /&gt;--print &#39;Killing &#39; + @spid&lt;br /&gt;exec(@killcommand)&lt;br /&gt;END&lt;br /&gt;&lt;br /&gt;SELECT top 1 @unc = M.physical_device_name&lt;br /&gt;FROM [msdb].[dbo].[backupset] S&lt;br /&gt;JOIN [msdb].[dbo].[backupmediafamily] M ON M.media_set_id=S.media_set_id&lt;br /&gt;WHERE S.database_name = &#39;OldDatabse&#39;&lt;br /&gt;and S.type =&#39;D&#39;&lt;br /&gt;and M.physical_device_name like &#39;S:\TempBackup\Full_Backup%&#39;&lt;br /&gt;and convert(char(10),S.backup_start_date,120) = convert(char(10),getdate() ,120)&lt;br /&gt;order by s.backup_finish_date desc&lt;br /&gt;&lt;br /&gt;restore database NewDatabase&lt;br /&gt;from disk = @unc&lt;br /&gt;with replace,&lt;br /&gt;move &#39;oldDatabase&#39; to &#39;C:\Program Files\Microsoft SQL Server\MSSQL.2\MSSQL\DATA\NewDatabse.mdf&#39;,&lt;br /&gt;move &#39;oldDatabase_log&#39; to &#39;C:\Program Files\Microsoft SQL Server\MSSQL.2\MSSQL\DATA\NewDatabase_log.ldf&#39;&lt;br /&gt;&lt;br /&gt;ENd</content><link rel='replies' type='application/atom+xml' href='http://paresh4you.blogspot.com/feeds/4770961055305929530/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/3738915380073694572/4770961055305929530' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3738915380073694572/posts/default/4770961055305929530'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3738915380073694572/posts/default/4770961055305929530'/><link rel='alternate' type='text/html' href='http://paresh4you.blogspot.com/2008/11/automatically-restore-database-backup.html' title='Automatically Restore Database ( Backup databse)'/><author><name>Paresh Patel</name><uri>http://www.blogger.com/profile/11363011501398480384</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiEvIVhlCJ9QU8YKsM40XF4pKcctXZF93MWS7gnWlaN_B3GsyfzTJqJ3faC8xuOO4sHLP_yY_yEIh07tbqe90Sl7F0KzyqDCEBsacubT7OHu7U6zPLtjbhqiVaIMmXSKw/s1600-r/Pareshnice.JPG'/></author><thr:total>0</thr:total></entry></feed>