<?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: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-12477822</id><updated>2012-02-02T19:56:40.475+05:30</updated><category term='microsoft'/><category term='best practices'/><category term='.net'/><category term='programming'/><title type='text'>SQL</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://sqlspot.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/12477822/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://sqlspot.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Guru Prasath</name><uri>http://www.blogger.com/profile/12526328340671913020</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://static.flickr.com/58/182619041_c436d0c787.jpg?v=0'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>5</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-12477822.post-8435939728027683411</id><published>2008-05-29T00:18:00.004+05:30</published><updated>2008-05-29T01:19:23.346+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='best practices'/><category scheme='http://www.blogger.com/atom/ns#' term='.net'/><category scheme='http://www.blogger.com/atom/ns#' term='programming'/><category scheme='http://www.blogger.com/atom/ns#' term='microsoft'/><title type='text'>Best Practices - Exception Handling</title><content type='html'>&lt;p&gt;The developer develops the code by sitting day and night but at the end if the code fails because of some exception which he/she failed to handle during the development then everything goes for a toss. I thought of sharing the best practices on Exception Handling which can help you all to write good code.&lt;/p&gt;    &lt;h4&gt;Only throw exceptions in exceptional situations&lt;/h4&gt;    &lt;p&gt;Do not throw exceptions in situations that are normal or expected (e.g. end-of-file). Use return values or status enumerations instead. In general, try to design classes that do not throw exceptions in the normal flow of control. However, do throw exceptions that a user is not allowed to catch when a situation occurs that may indicate a design error in the way your class is used.&lt;/p&gt;    &lt;h4&gt;Do not throw exceptions from inside destructors &lt;/h4&gt;    &lt;p&gt;When you call an exception from inside a destructor, the CLR will stop executing the destructor, and pass the exception to the base class destructor (if any). If there is no base class, then the destructor is discarded.&lt;/p&gt;    &lt;h4&gt;Re-throwing of exceptions&lt;/h4&gt;    &lt;p&gt;Exceptions should be re-thrown in one of two situations:&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;You want to specialize the exception and possibly provide further information. &lt;/li&gt;    &lt;li&gt;You need to perform some error correction due to the exception but are then also required to allow the exception to propagate back to the caller &lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;To specialize the exception, you must set the &lt;span style="font-family:courier;"&gt;innerException&lt;/span&gt; property of the new exception you are throwing like so: - &lt;/p&gt;    &lt;pre&gt;try&lt;br /&gt;{&lt;br /&gt;//code…&lt;br /&gt;}&lt;br /&gt;catch(SOAPException e)&lt;br /&gt;{&lt;br /&gt;Throw new RemapUIException("Unable to communicate with SSF", e)&lt;br /&gt;}&lt;/pre&gt;&lt;p&gt;This will ensure the stack trace of where the original exception occurred is preserved. To perform error correction code and then propagate the exception higher up the call stack, issue the throw statement on its own. Never re-throw the same exception as this will create a new exception stack trace and destroy the original stack info:-&lt;/p&gt;&lt;p&gt;WRONG:-&lt;/p&gt;&lt;pre&gt;try&lt;br /&gt;{&lt;br /&gt;//code…&lt;br /&gt;}&lt;br /&gt;catch([ExceptionType] e)&lt;br /&gt;{&lt;br /&gt;//perform catch and error handling code..&lt;br /&gt;throw e;&lt;br /&gt;}&lt;/pre&gt;&lt;p&gt;CORRECT:-&lt;/p&gt;&lt;pre&gt;try&lt;br /&gt;{&lt;br /&gt;//code…&lt;br /&gt;}&lt;br /&gt;catch([ExceptionType] e)&lt;br /&gt;{&lt;br /&gt;//perform catch and error handling code..&lt;br /&gt;throw;&lt;br /&gt;}&lt;/pre&gt;&lt;h4&gt;List the explicit exceptions a method or property can throw. &lt;/h4&gt;&lt;p&gt;Describe the recoverable exceptions using the &lt;span style="font-family:courier;"&gt;&amp;lt;exception&amp;gt;&lt;/span&gt; tag. Explicit exceptions are the ones that a method or property explicitly throws from its implementation and which users are allowed to catch. Exceptions thrown by .NET framework classes and methods used by this implementation do not have to be listed here. &lt;/p&gt;&lt;h4&gt;Always log that an exception is thrown&lt;/h4&gt;&lt;p&gt;Logging ensures that if the caller catches your exception and discards it, traces of this exception can be recovered at a later stage. &lt;/p&gt;&lt;h4&gt;Allow callers to prevent exceptions by providing a method or property that returns the objects state&lt;/h4&gt;&lt;p&gt;For example, consider a communication layer that will throw an &lt;span style="font-family:courier;"&gt;InvalidOperationException&lt;/span&gt; when an attempt is made to call &lt;span style="font-family:courier;"&gt;Send()&lt;/span&gt; when no connection is available. To allow preventing such a situation, provide a property such as Connected to allow the caller to determine if a connection is available before attempting an operation.&lt;/p&gt;&lt;h4&gt;Use standard exceptions&lt;/h4&gt;&lt;p&gt;The .NET framework already provides a set of common exceptions. The table below summarizes the most common exceptions that are available for applications.&lt;/p&gt;&lt;div&gt;&lt;table&gt;&lt;br /&gt; &lt;tbody&gt;&lt;tr&gt;&lt;br /&gt;   &lt;td&gt;&lt;strong&gt;Exception&lt;/strong&gt;&lt;/td&gt;&lt;br /&gt;   &lt;td&gt;&lt;strong&gt;Condition&lt;/strong&gt;&lt;/td&gt;&lt;br /&gt; &lt;/tr&gt;&lt;br /&gt; &lt;tr&gt;&lt;br /&gt;   &lt;td&gt;IndexOutOfRangeException&lt;/td&gt;&lt;br /&gt;   &lt;td&gt;Indexing an array or indexable collection outside its valid range.&lt;/td&gt;&lt;br /&gt; &lt;/tr&gt;&lt;br /&gt; &lt;tr&gt;&lt;br /&gt;   &lt;td&gt;InvalidOperationException&lt;/td&gt;&lt;br /&gt;   &lt;td&gt;An action is performed which is not valid considering the object's current state.&lt;/td&gt;&lt;br /&gt; &lt;/tr&gt;&lt;br /&gt; &lt;tr&gt;&lt;br /&gt;   &lt;td&gt;NotSupportedException&lt;/td&gt;&lt;br /&gt;   &lt;td&gt;An action is performed which is may be valid in the future, but is not supported.&lt;/td&gt;&lt;br /&gt; &lt;/tr&gt;&lt;br /&gt; &lt;tr&gt;&lt;br /&gt;   &lt;td&gt;ArgumentException&lt;/td&gt;&lt;br /&gt;   &lt;td&gt;An incorrect argument is supplied.&lt;/td&gt;&lt;br /&gt; &lt;/tr&gt;&lt;br /&gt; &lt;tr&gt;&lt;br /&gt;   &lt;td&gt;ArgumentNullException&lt;/td&gt;&lt;br /&gt;   &lt;td&gt;An null reference is supplied as a method's parameter that does not allow null.&lt;/td&gt;&lt;br /&gt; &lt;/tr&gt;&lt;br /&gt; &lt;tr&gt;&lt;br /&gt;   &lt;td&gt;ArgumentOutOfRangeException&lt;/td&gt;&lt;br /&gt;   &lt;td&gt;An argument is not within the required range.&lt;/td&gt;&lt;br /&gt; &lt;/tr&gt;&lt;br /&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;br /&gt;&lt;h4&gt;Throw informational exceptions&lt;/h4&gt;&lt;p&gt;When you instantiate a new exception, set its Message property to a descriptive message that will help the caller to diagnose the problem. For example, if an argument was incorrect, indicate which argument was the cause of the problem. Also mention the name (if available) of the object involved.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;Also, if you design a new exception class, note that it is possible to add custom properties that can provide additional details to the caller.&lt;/p&gt;&lt;h4&gt;Throw the most specific exception possible&lt;/h4&gt;&lt;p&gt;Do not throw a generic exception if a more specific one is available. &lt;/p&gt;&lt;h4&gt;Only catch the exceptions explicitly mentioned in the documentation&lt;/h4&gt;&lt;p&gt;Moreover, do not catch the base class Exception or &lt;span style="font-family:courier;"&gt;ApplicationException&lt;/span&gt; or &lt;span style="font-family:courier;"&gt;System.SystemException&lt;/span&gt;. Exceptions of those classes generally mean that a non-recoverable problem has occurred.&lt;/p&gt;&lt;p&gt;Exception:&lt;/p&gt;&lt;p&gt;On system-level or in a thread-routine, it is allowed to catch the Exception class directly, but only when approval by the Senior Designer has been obtained.&lt;/p&gt;&lt;h4&gt;Derive custom exceptions from ApplicationException&lt;/h4&gt;&lt;p&gt;All exceptions derived from &lt;span style="font-family:courier;"&gt;SystemException&lt;/span&gt; are reserved for usage by the CLR only.&lt;/p&gt;&lt;h4&gt;Provide common constructors for custom exceptions&lt;/h4&gt;&lt;p&gt;It is advised to provide the three common constructors that all standard exceptions provide as well.&lt;/p&gt;&lt;p&gt;These include: &lt;/p&gt;&lt;p&gt;&lt;span style="font-family:courier;"&gt;XxxException()&lt;br /&gt;XxxException(string message)&lt;br /&gt;XxxException(string message, Exception innerException)&lt;/span&gt;&lt;/p&gt;&lt;h4&gt;Avoid side-effects when throwing recoverable exceptions&lt;/h4&gt;&lt;p&gt;When you throw a recoverable exception, make sure that the object involved stays in a usable and predictable state. With usable it is meant that the caller can catch the exception, take any necessary actions, and continue to use the object again. With predictable is meant that the caller can make logical assumptions on the state of the object. &lt;/p&gt;&lt;p&gt;For instance, if during the process of adding a new item to a list, an exception is raised, then the caller may safely assume that the item has not been added, and another attempt to re-add it is possible. &lt;/p&gt;&lt;h4&gt;Do not throw an exception from inside an exception constructor&lt;/h4&gt;Throwing an exception from inside an exception's constructor will stop the construction of the exception being built, and hence, preventing the exception from getting thrown. The other exception is thrown, but this can be confusing to the user of the class or method concerned.&lt;br /&gt;&lt;h4&gt;Custom Exceptions&lt;/h4&gt;&lt;p&gt;To avoid ambiguity, all custom exceptions should descend from a new base exception and create a new set of exception hierarchies specific to the application or Framework. This will then allow all custom application/framework exceptions to be caught by one catch if required (and totally removes the requirement of catching ApplicationException in such situations).&lt;/p&gt;&lt;p&gt;Performing the above provides the following advantages:-&lt;br /&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;No custom exceptions directly fall under &lt;span style="font-family:courier;"&gt;ApplicationException&lt;/span&gt;. This is important as certain reflection exceptions 'appear' under the &lt;span style="font-family:courier;"&gt;ApplicationException&lt;/span&gt; class tree so these could inadvertently be caught if &lt;span style="font-family:courier;"&gt;ApplicationException&lt;/span&gt; is used to 'catch' any 'application error' that has occurred. &lt;/li&gt;  &lt;li&gt;Provides an easy mechanism to separate out different custom exception hierarchies, based on each application/framework. &lt;/li&gt;  &lt;li&gt;Provides an easy way to catch 'related' exceptions without having to determine the except type. &lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;span style="font-weight: bold;"&gt;Article courtesy&lt;/span&gt;: Ashok Kumara Purlehalli from Microsoft&lt;/p&gt;&lt;p&gt;Some other best practices articles:&lt;br /&gt;&lt;/p&gt;&lt;ol&gt;&lt;li&gt;&lt;a title="Java - Best Practices for Exception Handling" href="http://www.onjava.com/pub/a/onjava/2003/11/19/exceptions.html" target="_blank" rel="nofollow"&gt;Java - Best practices for Exception Handling&lt;/a&gt; &lt;/li&gt;  &lt;li&gt;&lt;a title="EJB - Best practices in EJB Exception Handling" href="http://www.ibm.com/developerworks/library/j-ejbexcept.html" target="_blank" rel="nofollow"&gt;EJB - Best practices in EJB Exception Handling&lt;/a&gt; &lt;/li&gt;  &lt;li&gt;&lt;a title="Exception Handling Best Practices in .NET" href="http://dturini.blogspot.com/2005/02/exception-handling-best-practices-in.html" target="_blank" rel="nofollow"&gt;Exception Handling Best Practices in .NET&lt;/a&gt; &lt;/li&gt;&lt;/ol&gt;&lt;br /&gt;Technorati Tags: &lt;a href="http://technorati.com/tags/.net" rel="tag"&gt;.net&lt;/a&gt;,&lt;a href="http://technorati.com/tags/best%20practices" rel="tag"&gt;best practices&lt;/a&gt;,&lt;a href="http://technorati.com/tags/microsoft" rel="tag"&gt;microsoft&lt;/a&gt;,&lt;a href="http://technorati.com/tags/programming" rel="tag"&gt;programming&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/12477822-8435939728027683411?l=sqlspot.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sqlspot.blogspot.com/feeds/8435939728027683411/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=12477822&amp;postID=8435939728027683411' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/12477822/posts/default/8435939728027683411'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/12477822/posts/default/8435939728027683411'/><link rel='alternate' type='text/html' href='http://sqlspot.blogspot.com/2008/05/best-practices-exception-handling.html' title='Best Practices - Exception Handling'/><author><name>Guru Prasath</name><uri>http://www.blogger.com/profile/12526328340671913020</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://static.flickr.com/58/182619041_c436d0c787.jpg?v=0'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-12477822.post-7511511384661951166</id><published>2007-05-30T17:38:00.001+05:30</published><updated>2007-05-30T17:38:34.789+05:30</updated><title type='text'>Cloning an Oracle Database in 10 steps</title><content type='html'>&lt;p&gt;&lt;/p&gt; &lt;p&gt;Here the author explains how to clone an Oracle database in 10 simple steps. &lt;a title="10 steps for cloning a database" href="http://www.samoratech.com/TopicOfInterest/swCloneDB.htm" target="_blank" rel="tag"&gt;10 steps for cloning a database&lt;/a&gt;&lt;/p&gt; &lt;p&gt;&lt;/p&gt; &lt;div class="wlWriterSmartContent" id="0767317B-992E-4b12-91E0-4F059A8CECA8:fc066050-b64e-4387-a5f0-e2ff95d34bde" contenteditable="false" style="padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;Technorati tags: &lt;a href="http://technorati.com/tags/oracle" rel="tag"&gt;oracle&lt;/a&gt;, &lt;a href="http://technorati.com/tags/cloning" rel="tag"&gt;cloning&lt;/a&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/12477822-7511511384661951166?l=sqlspot.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sqlspot.blogspot.com/feeds/7511511384661951166/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=12477822&amp;postID=7511511384661951166' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/12477822/posts/default/7511511384661951166'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/12477822/posts/default/7511511384661951166'/><link rel='alternate' type='text/html' href='http://sqlspot.blogspot.com/2007/05/cloning-oracle-database-in-10-steps.html' title='Cloning an Oracle Database in 10 steps'/><author><name>Guru Prasath</name><uri>http://www.blogger.com/profile/12526328340671913020</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://static.flickr.com/58/182619041_c436d0c787.jpg?v=0'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-12477822.post-113320758475135956</id><published>2005-11-29T01:23:00.000+05:30</published><updated>2005-11-29T01:25:38.606+05:30</updated><title type='text'>VBScript Editing in Visual Studio</title><content type='html'>&lt;span style=";font-family:Verdana;font-size:85%;"  &gt;After much frustration with Notepad I have worked out this solution. It provides color coding of VBScript commands but not IntelliSense for the Wscript object. (need the equivalent of references in VB)When you open a .vbs file in Visual InterDev it is treated as a text file. To force VI to use the HTML editor (used for ASP and client side code color editing) you must make some changes to the registry. First delete the value 'vbs' from this key (if it exists)&lt;/span&gt;&lt;br /&gt;&lt;span style=";font-family:Verdana;font-size:85%;"  &gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=";font-family:Courier New;font-size:85%;"  &gt;HKEY_LOCAL_MACHINE\Software\Microsoft\VisualStudio\6.0\Editors{8B382828-6202-11d1-8870-0000F87579D2}\Extensions&lt;/span&gt;&lt;br /&gt;&lt;span style=";font-family:Courier New;font-size:85%;"  &gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=";font-family:Verdana;font-size:85%;"  &gt;and add a new DWORD value called &lt;/span&gt;&lt;span style=";font-family:Courier New;font-size:85%;"  &gt;'vbs' &lt;/span&gt;&lt;span style=";font-family:Verdana;font-size:85%;"  &gt;with hex value &lt;/span&gt;&lt;span style=";font-family:Courier New;font-size:85%;"  &gt;28 &lt;/span&gt;&lt;span style=";font-family:Verdana;font-size:85%;"  &gt;to this key&lt;/span&gt;&lt;br /&gt;&lt;span style=";font-family:Arial;font-size:85%;"  &gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=";font-family:Courier New;font-size:85%;"  &gt;HKEY_LOCAL_MACHINE\Software\Microsoft\VisualStudio\6.0\Editors{C76D83F8-A489-11D0-8195-00A0C91BBEE3}\Extensions&lt;/span&gt;&lt;br /&gt;&lt;span style=";font-family:Courier New;font-size:85%;"  &gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=";font-family:Verdana;font-size:85%;"  &gt;Now to create an option for creating a new vbs file in the 'File', 'New File' menu, edit the file&lt;/span&gt;&lt;br /&gt;&lt;span style=";font-family:Courier New;font-size:85%;"  &gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=";font-family:Courier New;font-size:85%;"  &gt;{$Install_Drive}\Program Files\Microsoft Visual Studio\VIntDev98\Templates\NewFileItems\NewFileItems.vsdir&lt;/span&gt;&lt;br /&gt;&lt;span style=";font-family:Arial;font-size:85%;"  &gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=";font-family:Verdana;font-size:85%;"  &gt;and add a new line at the end of the file (it is a long line that may wrap over several lines)&lt;/span&gt;&lt;br /&gt;&lt;span style=";font-family:Arial;font-size:85%;"  &gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=";font-family:Courier New;font-size:85%;"  &gt;New vbs File.vbs|{164B10B9-B200-11D0-8C61-00A0C91E29D5}|VBS File|60|Create a new vbs file and add open it in the editor|c:\WINDOWS\Wscript.exe|3| |VBS File &lt;/span&gt;&lt;br /&gt;&lt;span style=";font-family:Arial;font-size:85%;"  &gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=";font-family:Verdana;font-size:85%;"  &gt;Confirm the path to Wscript.exe which is used to get the icon to display in the dialog box. You MUST add an additional &lt;/span&gt;&lt;strong&gt;&lt;span style=";font-family:Verdana;font-size:85%;"  &gt;CRLF &lt;/span&gt;&lt;/strong&gt;&lt;span style=";font-family:Verdana;font-size:85%;"  &gt;at the end of this file otherwise VI will hang (there is one blank line for each entry). Now create a file in the same directory called New vbs File.vbs with the following lines...&lt;/span&gt;&lt;br /&gt;&lt;span style=";font-family:Courier New;font-size:85%;"  &gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=";font-family:Courier New;font-size:85%;"  &gt;'&amp;lt;% This line will turn on the color coding' add any standard commands you want to make this a template vbs fileSet WshShell = WScript.CreateObject("WScript.Shell")Set oFS = WScript.CreateObject(Scripting.FileSystemObject)&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/12477822-113320758475135956?l=sqlspot.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='related' href='http://groups.msn.com/windowsscript/wshgeneralquestions.msnw?action=view_list&amp;row=17&amp;viewtype=2&amp;sortstring=' title='VBScript Editing in Visual Studio'/><link rel='replies' type='application/atom+xml' href='http://sqlspot.blogspot.com/feeds/113320758475135956/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=12477822&amp;postID=113320758475135956' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/12477822/posts/default/113320758475135956'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/12477822/posts/default/113320758475135956'/><link rel='alternate' type='text/html' href='http://sqlspot.blogspot.com/2005/11/vbscript-editing-in-visual-studio.html' title='VBScript Editing in Visual Studio'/><author><name>Guru Prasath</name><uri>http://www.blogger.com/profile/12526328340671913020</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://static.flickr.com/58/182619041_c436d0c787.jpg?v=0'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-12477822.post-111462646872016606</id><published>2005-04-27T23:55:00.000+05:30</published><updated>2005-04-27T23:58:30.096+05:30</updated><title type='text'>Sort randomly</title><content type='html'>To sort radomly every time you run the query, use this method,&lt;br /&gt;&lt;blockquote&gt;&lt;span style="font-family:courier new;"&gt;SELECT columnname1, columnname2 FROM YOURTABLE ORDER BY NEWID()&lt;/span&gt;&lt;br /&gt;&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/12477822-111462646872016606?l=sqlspot.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sqlspot.blogspot.com/feeds/111462646872016606/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=12477822&amp;postID=111462646872016606' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/12477822/posts/default/111462646872016606'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/12477822/posts/default/111462646872016606'/><link rel='alternate' type='text/html' href='http://sqlspot.blogspot.com/2005/04/sort-randomly.html' title='Sort randomly'/><author><name>Guru Prasath</name><uri>http://www.blogger.com/profile/12526328340671913020</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://static.flickr.com/58/182619041_c436d0c787.jpg?v=0'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-12477822.post-111461514656779119</id><published>2005-04-27T20:29:00.000+05:30</published><updated>2005-04-27T20:49:06.566+05:30</updated><title type='text'>Days of the month using SQL</title><content type='html'>&lt;span style="color:#000080;"&gt;&lt;span style="font-family:Verdana;"&gt;&lt;span style="font-size:85%;"&gt;To find the days in a month using SQL, use the following method. Here TSQL syntax is used for example.&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#000080;"&gt;&lt;span style="font-family:Verdana;"&gt;&lt;span style="font-size:85%;"&gt;&lt;strong&gt;&lt;br /&gt;--------------------&lt;/strong&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#000080;"&gt;&lt;span style="font-family:Verdana;"&gt;&lt;span style="font-size:85%;"&gt;DECLARE @Date datetime&lt;br /&gt;       SET @Date = '2000/02/1'&lt;br /&gt;       SELECT DATEADD(dd,-(DATEPART(dw, @Date) - 1),@Date) AS &lt;strong&gt;'First day of the          week'&lt;/strong&gt;&lt;br /&gt;       SELECT DATEADD(dd,-(DATEPART(dw, @Date) - 7),@Date) AS &lt;strong&gt;'Last day of the          week'&lt;/strong&gt;        &lt;br /&gt;       SELECT DAY(DATEADD(d, -DAY(DATEADD(m,1,@Date)),DATEADD(m,1,@Date))) AS &lt;strong&gt;'Last          day of the month'&lt;br /&gt;--------------------&lt;br /&gt;&lt;span style="font-weight: normal;"&gt;&lt;br /&gt;for more sql tricks goto.. &lt;a href="http://www.extremeexperts.com/SQL/Tips/DateTrick.aspx"&gt;Extremeexperts&lt;/a&gt;&lt;br /&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/12477822-111461514656779119?l=sqlspot.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sqlspot.blogspot.com/feeds/111461514656779119/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=12477822&amp;postID=111461514656779119' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/12477822/posts/default/111461514656779119'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/12477822/posts/default/111461514656779119'/><link rel='alternate' type='text/html' href='http://sqlspot.blogspot.com/2005/04/days-of-month-using-sql.html' title='Days of the month using SQL'/><author><name>Guru Prasath</name><uri>http://www.blogger.com/profile/12526328340671913020</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://static.flickr.com/58/182619041_c436d0c787.jpg?v=0'/></author><thr:total>6</thr:total></entry></feed>
