<?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-7856726257089876870</id><updated>2024-08-30T07:26:15.267-07:00</updated><category term="SQL Server"/><category term="Oracle"/><title type='text'>ProgrammingOcean</title><subtitle type='html'>Sharing knowledge among IT Professionals</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://programmingocean.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7856726257089876870/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://programmingocean.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/7856726257089876870/posts/default?start-index=26&amp;max-results=25&amp;redirect=false'/><author><name>murukan</name><uri>http://www.blogger.com/profile/07265681234394455890</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='27' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh5PYOrtR0a6mNzWkDDqOsFHzJgR5cDoeSWXyw03RsMIEm3TiAOVu77g7C8pWSur1HVFQ99RfM6m2Qng0fygNfqEjtg4hpiPvx1mMtRNnzED2ztg7GTyD8wezgTR7BBqw/s220/DSCF2627[1]c.JPG'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>39</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-7856726257089876870.post-6694653329555411483</id><published>2011-01-10T02:01:00.000-08:00</published><updated>2011-01-10T02:02:18.104-08:00</updated><title type='text'>Recover the Database in SQL SERVER</title><content type='html'>1.create the Database with same Name,MDF Name,LDF Name.&lt;br /&gt;2.Stop the Sql Server and then Replace the only new MDF file by old database (Corrupted database) MDF file and delete the LDF File of newly created database.&lt;br /&gt;3.Now Start the Sql Server again.&lt;br /&gt;4.you can notice that database status became &#39;Suspect&#39; as expected.&lt;br /&gt;&lt;br /&gt;5.Then run the given script to know the current status of your newly created datatbase.&lt;br /&gt;(Better you note it down the current status)&lt;br /&gt;&lt;br /&gt;&lt;pre class=&quot;brush: sql&quot;&gt;&lt;br /&gt;SELECT *&lt;br /&gt;FROM sysdatabases&lt;br /&gt;WHERE name = &#39;yourDB&#39;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;6.Normally sql server would not allow you update anything in the system database.SO run the given script to enable the update to system database.&lt;br /&gt;&lt;pre class=&quot;brush: sql&quot;&gt;&lt;br /&gt;sp_CONFIGURE &#39;allow updates&#39;, 1&lt;br /&gt;RECONFIGURE WITH OVERRIDE&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;7.After run the above script, update the status of your newly database as shown below. once you updated the status, database status become &#39;Emergency/Suspect&#39;.&lt;br /&gt;&lt;pre class=&quot;brush: sql&quot;&gt;&lt;br /&gt;UPDATE sysdatabases&lt;br /&gt;SET status = 32768&lt;br /&gt;WHERE name = &#39;yourDB&#39;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;8.Restart SQL Server (This is must, if it is not done SQL Server will through an error)&lt;br /&gt;&lt;br /&gt;9.Execute this DBCC command to create the LDF file.make sure the Name of LDF file which you are giveing is same as deleted LDF file of Newly Created database.&lt;br /&gt;&lt;pre class=&quot;brush: sql&quot;&gt;&lt;br /&gt;DBCC TRACEON (3604)&lt;br /&gt;DBCC REBUILD_LOG(bmpos,&#39;D:\yourDB_Log.ldf&#39;)&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;DBCC accepts two parameters,&lt;br /&gt;1. parameter is database name and&lt;br /&gt;2. parameter is physical path (where the MDF file is located) of the log file. (*Make sure the path is physical, if you specify the logical file name it will throw an error.)&lt;br /&gt;&lt;br /&gt;10.Run the given stored procedure to reset the status of your database.&lt;br /&gt;&lt;pre class=&quot;brush: sql&quot;&gt;&lt;br /&gt;sp_RESETSTATUS yourDB&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;11.Do not forget to disable theallow update to system datatbase.&lt;br /&gt;&lt;pre class=&quot;brush: sql&quot;&gt;&lt;br /&gt;sp_CONFIGURE &#39;allow updates&#39;,0&lt;br /&gt;RECONFIGURE WITH OVERRIDE&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;12.At last, update the status which you have noted in the 5th step.&lt;br /&gt;&lt;pre class=&quot;brush: sql&quot;&gt;&lt;br /&gt;UPDATE sysdatabases&lt;br /&gt;SET status = 1073741840&lt;br /&gt;WHERE name = &#39;yourDB&#39;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Note : During steps 8, 9 , 10 you may encounter any errors if database is in use.&lt;br /&gt;in this case you Set the database to single user.&lt;br /&gt;&lt;pre class=&quot;brush: sql&quot;&gt;&lt;br /&gt;sp_DBOPTION &#39;yourDB&#39;, &#39;single user&#39;,&#39;true&#39;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Once the steps 8,9,10 are completed and database is already single user mode, then run this script.&lt;br /&gt;&lt;pre class=&quot;brush: sql&quot;&gt;&lt;br /&gt;sp_DBOPTION &#39;yourDB&#39;, &#39;single user&#39;,&#39;false&#39;&lt;br /&gt;&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://programmingocean.blogspot.com/feeds/6694653329555411483/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://programmingocean.blogspot.com/2011/01/recover-database-in-sql-server.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7856726257089876870/posts/default/6694653329555411483'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7856726257089876870/posts/default/6694653329555411483'/><link rel='alternate' type='text/html' href='http://programmingocean.blogspot.com/2011/01/recover-database-in-sql-server.html' title='Recover the Database in SQL SERVER'/><author><name>murukan</name><uri>http://www.blogger.com/profile/07265681234394455890</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='27' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh5PYOrtR0a6mNzWkDDqOsFHzJgR5cDoeSWXyw03RsMIEm3TiAOVu77g7C8pWSur1HVFQ99RfM6m2Qng0fygNfqEjtg4hpiPvx1mMtRNnzED2ztg7GTyD8wezgTR7BBqw/s220/DSCF2627[1]c.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7856726257089876870.post-8369608716975500114</id><published>2011-01-09T23:14:00.000-08:00</published><updated>2011-01-10T02:01:15.741-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="SQL Server"/><title type='text'>Reflect in the view after Edited or Newly Added column of a Table</title><content type='html'>After changed the name or add new column in the table, that changes would not reflect in the view if that field used in that view.&lt;br /&gt;For that you just run this system stored procedure with view name as parameter rather open the view and update it.&lt;br /&gt;&lt;pre class=&quot;brush: sql&quot;&gt;&lt;br /&gt;Sp_refreshview yourviewname&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;For an Example:&lt;br /&gt;I am using Table_A, Table_B and View_C&lt;br /&gt;&lt;br /&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg8Zpp2fuWWulLBLEzZPGaJUkav_zldMw4qxIriZiolYRb6K9J24pYK7YcGvRdxKL9phHBPuJrPBvjLFVhST56RuLWPF_9Y-eOTJTxP5HxKj9fawscNLiKqAuL3b42AyJLilwXZ6SiS4ghw/s1600/Table+A.JPG&quot;&gt;&lt;img style=&quot;display: block; margin: 0px auto 10px; text-align: center; cursor: pointer; width: 288px; height: 120px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg8Zpp2fuWWulLBLEzZPGaJUkav_zldMw4qxIriZiolYRb6K9J24pYK7YcGvRdxKL9phHBPuJrPBvjLFVhST56RuLWPF_9Y-eOTJTxP5HxKj9fawscNLiKqAuL3b42AyJLilwXZ6SiS4ghw/s400/Table+A.JPG&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5560493675242652898&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgy36FqeC3ruVIlyWLfEsYin7MdeY1CG-CcwiSJjFRR401Q-sYemM_JHl7q3korJdLdHwn6ZqXa5l7u3AxyYMIOXQIRULk0ke3CNy2VOtkXEFWAK7CdiowBDEdCnyakTpT4chfzh19ay9aH/s1600/Table+B.JPG&quot;&gt;&lt;img style=&quot;display: block; margin: 0px auto 10px; text-align: center; cursor: pointer; width: 400px; height: 82px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgy36FqeC3ruVIlyWLfEsYin7MdeY1CG-CcwiSJjFRR401Q-sYemM_JHl7q3korJdLdHwn6ZqXa5l7u3AxyYMIOXQIRULk0ke3CNy2VOtkXEFWAK7CdiowBDEdCnyakTpT4chfzh19ay9aH/s400/Table+B.JPG&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5560493923605686946&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;In the View C I have used Table A and Table B.&lt;br /&gt;&lt;br /&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhwC-dLGESBlYujj24kIxUHaShCmdi1oFBGWF9gChOx3ErBqYR-stRSg35P0jWRPdZpsxYXQubJpavyhDLyc2ICXBxTsmdnVP68lataXorJRAxmTYqAas3yDA_afouybd1CA27auhuTBJE5/s1600/Table+C.JPG&quot;&gt;&lt;img style=&quot;display: block; margin: 0px auto 10px; text-align: center; cursor: pointer; width: 400px; height: 63px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhwC-dLGESBlYujj24kIxUHaShCmdi1oFBGWF9gChOx3ErBqYR-stRSg35P0jWRPdZpsxYXQubJpavyhDLyc2ICXBxTsmdnVP68lataXorJRAxmTYqAas3yDA_afouybd1CA27auhuTBJE5/s400/Table+C.JPG&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5560494083762130450&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;After created the View C I added one more column call Status in the Table A and run the View C, you would not see that newly added column as view have not been refreshed yet as shown below.&lt;br /&gt;&lt;br /&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhr_IKLAbGnysxZU90F4EWZVMA-YmrLDkieMi3Im7EXtHFZmru8hERE-hCQc2FgvDsCctRrvxzmSo7gqPERyO7f-acLn_qif3KBbAAyBNNYVlU2MxtCqZwJ6bkwHfrYFyObq13AnBoFvmZ7/s1600/Table+AA.JPG&quot;&gt;&lt;img style=&quot;display: block; margin: 0px auto 10px; text-align: center; cursor: pointer; width: 400px; height: 79px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhr_IKLAbGnysxZU90F4EWZVMA-YmrLDkieMi3Im7EXtHFZmru8hERE-hCQc2FgvDsCctRrvxzmSo7gqPERyO7f-acLn_qif3KBbAAyBNNYVlU2MxtCqZwJ6bkwHfrYFyObq13AnBoFvmZ7/s400/Table+AA.JPG&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5560494445195337442&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;For this you can simply update the view just using the above stored procedure as shown below,&lt;br /&gt;&lt;pre class=&quot;brush: sql&quot;&gt;&lt;br /&gt;Sp_refreshview View_C&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;After run the script you can able to see that added column in the view as shown below,&lt;br /&gt;&lt;br /&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjcSh5RimLMfPXuN0NS77VtMl8rzpbNKphPVS6rikx41euuPqfhaN2PZOFYaACQhaVxERVoPNMME-NsJ7qJn-Ti4zhgmBCXl1wJrR8FxX6ieh1PloCjn7YRiUhZOz1_KPbH8DlTWVFwxxiP/s1600/View+CC.JPG&quot;&gt;&lt;img style=&quot;display: block; margin: 0px auto 10px; text-align: center; cursor: pointer; width: 400px; height: 59px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjcSh5RimLMfPXuN0NS77VtMl8rzpbNKphPVS6rikx41euuPqfhaN2PZOFYaACQhaVxERVoPNMME-NsJ7qJn-Ti4zhgmBCXl1wJrR8FxX6ieh1PloCjn7YRiUhZOz1_KPbH8DlTWVFwxxiP/s400/View+CC.JPG&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5560494906144063138&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;</content><link rel='replies' type='application/atom+xml' href='http://programmingocean.blogspot.com/feeds/8369608716975500114/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://programmingocean.blogspot.com/2011/01/recorver-database-in-sql-server.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7856726257089876870/posts/default/8369608716975500114'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7856726257089876870/posts/default/8369608716975500114'/><link rel='alternate' type='text/html' href='http://programmingocean.blogspot.com/2011/01/recorver-database-in-sql-server.html' title='Reflect in the view after Edited or Newly Added column of a Table'/><author><name>murukan</name><uri>http://www.blogger.com/profile/07265681234394455890</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='27' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh5PYOrtR0a6mNzWkDDqOsFHzJgR5cDoeSWXyw03RsMIEm3TiAOVu77g7C8pWSur1HVFQ99RfM6m2Qng0fygNfqEjtg4hpiPvx1mMtRNnzED2ztg7GTyD8wezgTR7BBqw/s220/DSCF2627[1]c.JPG'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg8Zpp2fuWWulLBLEzZPGaJUkav_zldMw4qxIriZiolYRb6K9J24pYK7YcGvRdxKL9phHBPuJrPBvjLFVhST56RuLWPF_9Y-eOTJTxP5HxKj9fawscNLiKqAuL3b42AyJLilwXZ6SiS4ghw/s72-c/Table+A.JPG" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7856726257089876870.post-7518328429478602298</id><published>2010-06-24T00:20:00.000-07:00</published><updated>2010-06-24T00:21:48.612-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Oracle"/><title type='text'>How get the column names from a particular Table in Oracle</title><content type='html'>In Oracle you can retreive the field names as shown below,&lt;br /&gt;&lt;br /&gt;&lt;pre class=&quot;brush: sql&quot;&gt;&lt;br /&gt;DESC Table_Name&lt;br /&gt;&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://programmingocean.blogspot.com/feeds/7518328429478602298/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://programmingocean.blogspot.com/2010/06/how-get-column-names-from-particular.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7856726257089876870/posts/default/7518328429478602298'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7856726257089876870/posts/default/7518328429478602298'/><link rel='alternate' type='text/html' href='http://programmingocean.blogspot.com/2010/06/how-get-column-names-from-particular.html' title='How get the column names from a particular Table in Oracle'/><author><name>murukan</name><uri>http://www.blogger.com/profile/07265681234394455890</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='27' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh5PYOrtR0a6mNzWkDDqOsFHzJgR5cDoeSWXyw03RsMIEm3TiAOVu77g7C8pWSur1HVFQ99RfM6m2Qng0fygNfqEjtg4hpiPvx1mMtRNnzED2ztg7GTyD8wezgTR7BBqw/s220/DSCF2627[1]c.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7856726257089876870.post-2166987451123642969</id><published>2010-06-19T10:05:00.001-07:00</published><updated>2010-06-24T00:08:17.622-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="SQL Server"/><title type='text'>How to get the position of a character from a word in SQL server.</title><content type='html'>For this there is a function call CHARINDEX(). This is very similar to InStr function of VB.NET and IndexOf in Java. This function returns the position of the first occurrence of the first argument in the record.&lt;br /&gt;&lt;pre class=&quot;brush: sql&quot;&gt;&lt;br /&gt;SELECT CHARINDEX(&#39;r&#39;,&#39;server&#39;)&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;This would return 3 as it is start from 1.</content><link rel='replies' type='application/atom+xml' href='http://programmingocean.blogspot.com/feeds/2166987451123642969/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://programmingocean.blogspot.com/2010/06/how-to-get-position-of-character-from.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7856726257089876870/posts/default/2166987451123642969'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7856726257089876870/posts/default/2166987451123642969'/><link rel='alternate' type='text/html' href='http://programmingocean.blogspot.com/2010/06/how-to-get-position-of-character-from.html' title='How to get the position of a character from a word in SQL server.'/><author><name>murukan</name><uri>http://www.blogger.com/profile/07265681234394455890</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='27' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh5PYOrtR0a6mNzWkDDqOsFHzJgR5cDoeSWXyw03RsMIEm3TiAOVu77g7C8pWSur1HVFQ99RfM6m2Qng0fygNfqEjtg4hpiPvx1mMtRNnzED2ztg7GTyD8wezgTR7BBqw/s220/DSCF2627[1]c.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7856726257089876870.post-780600001585863090</id><published>2010-06-19T10:01:00.000-07:00</published><updated>2010-06-24T00:15:59.078-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="SQL Server"/><title type='text'>Working with Cursors in SQL Server.</title><content type='html'>Cursors are useful thing in SQL as it is enable you to work with a subset of data on a row-by-row basis. All cursor functions are non-deterministic because the results might not always be consistent. A user might delete a row while you are working with your cursor. Here after a few functions that work with cursors.&lt;br /&gt;When you work with Cursor , you will Have to follow these steps .&lt;br /&gt;1. Declare Cursor&lt;br /&gt;2. Open Cursor&lt;br /&gt;3. Run through the cursor&lt;br /&gt;4. Close Cursor&lt;br /&gt;5. Deallocate the Cursor&lt;br /&gt;&lt;br /&gt;1. Declare cursor&lt;br /&gt;&lt;pre class=&quot;brush: sql&quot;&gt;&lt;br /&gt;Declare Emp_Cur Cursor For&lt;br /&gt;Select Emp_Code From Employee_Details&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Declare the cursor with select query for a Table/View as shown above.&lt;br /&gt;2. Open Cursor&lt;br /&gt;&lt;pre class=&quot;brush: sql&quot;&gt;&lt;br /&gt;Open Emp_Cur&lt;br /&gt;Fetch Next From Emp_Cur&lt;br /&gt;Into @mCardNo&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Open the Declared cursor and Fetch them into declared local variables for row-by-row basis.&lt;br /&gt;In given example, open cursor Emp_Cur and Fetch the Emp_Code records and assigned into a local Variable called @mCardNo.&lt;br /&gt;3. Run through the Cursor&lt;br /&gt;For this there is a Cursor function called @@FETCH_STATUs which is a scalar function that works with cursors.&lt;br /&gt;If @@FETCH_STATUS=0 means cursor doesn’t have more records to read otherwise it would be nonzero. Normally we would use this with while loop (While @@FETCH_STATUS=0).&lt;br /&gt;&lt;pre class=&quot;brush: sql&quot;&gt;&lt;br /&gt;While @@Fetch_Status=0&lt;br /&gt; Begin&lt;br /&gt;   ----&lt;br /&gt;   --You can write you statements here for update/Insert&lt;br /&gt;   ----&lt;br /&gt;&lt;br /&gt;   Fetch Next From Emp_Cur&lt;br /&gt;   Into @mCardNo&lt;br /&gt; End&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Another cursor function is @@CURSOR_ROWS which would returns the number rows in the most recently opened cursor.&lt;br /&gt;4. Close the Cursor.&lt;br /&gt;Once you completed the cursor run through you must close the cursor otherwise when open it again SQL would throw an error.&lt;br /&gt;&lt;pre class=&quot;brush: sql&quot;&gt;&lt;br /&gt;Close Emp_Cur&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;5. Deallocate the Cursor&lt;br /&gt;This this for erase the declared cursor from memory as it would consume considerable memory space.&lt;br /&gt;&lt;pre class=&quot;brush: sql&quot;&gt;&lt;br /&gt;Deallocate Emp_Cur&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;The full script for Cursor, ( for run this script you must have a table call Employee_Details)&lt;br /&gt;&lt;pre class=&quot;brush: sql&quot;&gt;&lt;br /&gt;Declare @mCardNo as Varchar(10)&lt;br /&gt;&lt;br /&gt;Declare Emp_Cur Cursor For&lt;br /&gt;Select Emp_Code From Employee_Details&lt;br /&gt;&lt;br /&gt;Open Emp_Cur&lt;br /&gt;Fetch Next From Emp_Cur&lt;br /&gt;Into @mCardNo&lt;br /&gt;&lt;br /&gt;While @@Fetch_Status=0&lt;br /&gt; Begin&lt;br /&gt;   ----&lt;br /&gt;   --You can write you statements here for update/Insert&lt;br /&gt;   ----&lt;br /&gt;&lt;br /&gt;   Fetch Next From Emp_Cur&lt;br /&gt;   Into @mCardNo&lt;br /&gt; End&lt;br /&gt;&lt;br /&gt;Close Emp_Cur&lt;br /&gt;Deallocate Emp_Cur&lt;br /&gt;&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://programmingocean.blogspot.com/feeds/780600001585863090/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://programmingocean.blogspot.com/2010/06/working-with-cursors-in-sql-server.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7856726257089876870/posts/default/780600001585863090'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7856726257089876870/posts/default/780600001585863090'/><link rel='alternate' type='text/html' href='http://programmingocean.blogspot.com/2010/06/working-with-cursors-in-sql-server.html' title='Working with Cursors in SQL Server.'/><author><name>murukan</name><uri>http://www.blogger.com/profile/07265681234394455890</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='27' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh5PYOrtR0a6mNzWkDDqOsFHzJgR5cDoeSWXyw03RsMIEm3TiAOVu77g7C8pWSur1HVFQ99RfM6m2Qng0fygNfqEjtg4hpiPvx1mMtRNnzED2ztg7GTyD8wezgTR7BBqw/s220/DSCF2627[1]c.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7856726257089876870.post-7245445583058570645</id><published>2010-06-19T09:50:00.000-07:00</published><updated>2010-06-19T09:51:12.718-07:00</updated><title type='text'>Working with Stored Procedures</title><content type='html'>Stored procedures are stored in SQL Server databases. The simplest implication of stored procedures is to save complicated queries to the database and call them by name, so that users won’t have to enter&lt;br /&gt;the SQL statements  more once. As you see, stored procedures have many more applications, and you can even use them to build business rules into the database.&lt;br /&gt;How to create a Stored Procedure,&lt;br /&gt;As shown given below, created a Stored Procedure for Inserting records into Table call Holiday_Details, which has Code and Description fields.&lt;br /&gt;In this Stored Procedure, passing two parametrs as INPUT Parameters and one OUTPUT parameter.&lt;br /&gt;Normally in Stored Procedure we can pass parameters as Input / Output Stored parameters. When you define output parameters, we have to implicitly specify the OUTPUT Keyword.&lt;br /&gt;Here I have shown the simple stored procedure.&lt;br /&gt;&lt;pre class=&quot;brush: sql&quot;&gt;&lt;br /&gt;CREATE PROCEDURE  [dbo].[SP_Holiday]&lt;br /&gt;&lt;br /&gt;@Code char(3),&lt;br /&gt;@Desc varchar(100),&lt;br /&gt;@flag bit,&lt;br /&gt;@Err  Varchar(MAX)=Null OUTPUT&lt;br /&gt;&lt;br /&gt;AS&lt;br /&gt;&lt;br /&gt;Begin Transaction&lt;br /&gt;if @flag=0&lt;br /&gt; begin&lt;br /&gt;  INSERT INTO Holiday_Details Values(@code,@Desc)&lt;br /&gt; end&lt;br /&gt;&lt;br /&gt;if @flag=1&lt;br /&gt; begin&lt;br /&gt;  UPDATE Holiday_Details SET Description=@Desc WHERE Code=@code&lt;br /&gt; end&lt;br /&gt; &lt;br /&gt;If @@ERROR &lt;&gt;0&lt;br /&gt; Begin&lt;br /&gt;    Set @Err=cast(@@Error as varchar(max))&lt;br /&gt;  Rollback Transaction&lt;br /&gt;  print @Err   &lt;br /&gt;  return&lt;br /&gt; End&lt;br /&gt;Else if @@ERROR&lt;&gt;0&lt;br /&gt; Begin&lt;br /&gt;  Set @Err=&#39;Successfully done!!&#39;&lt;br /&gt;  print @Err&lt;br /&gt; End &lt;br /&gt; &lt;br /&gt;Commit Transaction&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Here we are trying Insert/Update the records into Holiday_Details. For diferentiate the Insert and Update, we are using @flag input parameter. So when we execute this parameter we should specify the @flag whether it is Insert/Update.&lt;br /&gt;@Err parametr is Output parameter for get the status of execution whether it is successfully Inserted/Updated or thrown any error.&lt;br /&gt;So, if you execute this procedure, you would get the output of status.&lt;br /&gt;Execute of a Stored Procedure&lt;br /&gt;When you execute a Stored Procedure, you have to use either Execute/EXEC&lt;br /&gt;(Exec is special case, I will explain about in another article) keyword for execute the Stored Procedure.&lt;br /&gt;&lt;pre class=&quot;brush: sql&quot;&gt;&lt;br /&gt;EXEC SP_Holiday &#39;bb1&#39;,&#39;ffff&#39;,0&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class=&quot;brush: sql&quot;&gt;&lt;br /&gt;EXECUTE SP_Holiday &#39;332&#39;,&#39;ffff&#39;,0&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Here we have not pased value for OUTPUT parameter since we have assined Null as intial value which means in case if you forget topass the paraneter, Variable would take the Intialized value.&lt;br /&gt;So, once you run this stored Procedure, this would return the value of @Err parameter.&lt;br /&gt;Main purposes of Using Stored Procedures&lt;br /&gt;When as SQL statement, especially a complicated one, is stored in the database as stored procedure, its execution plan is designed once, cached, and is ready to be used again.&lt;br /&gt;Moreover, stored procedures can be designed once, tested, and used by many usres and applications. If the same stored procedure is used by more than user, the DBMS keeps only one copy of the procedure in memory, and all users share the same instance of the procedure. This means more efficient memory utilization.&lt;br /&gt;Finally, you can limit user access to database’s tables and force users to access the database throgh stored procedures. This is simple method of enforcing business rules.</content><link rel='replies' type='application/atom+xml' href='http://programmingocean.blogspot.com/feeds/7245445583058570645/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://programmingocean.blogspot.com/2010/06/working-with-stored-procedures.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7856726257089876870/posts/default/7245445583058570645'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7856726257089876870/posts/default/7245445583058570645'/><link rel='alternate' type='text/html' href='http://programmingocean.blogspot.com/2010/06/working-with-stored-procedures.html' title='Working with Stored Procedures'/><author><name>murukan</name><uri>http://www.blogger.com/profile/07265681234394455890</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='27' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh5PYOrtR0a6mNzWkDDqOsFHzJgR5cDoeSWXyw03RsMIEm3TiAOVu77g7C8pWSur1HVFQ99RfM6m2Qng0fygNfqEjtg4hpiPvx1mMtRNnzED2ztg7GTyD8wezgTR7BBqw/s220/DSCF2627[1]c.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7856726257089876870.post-2864834355477774303</id><published>2010-05-30T09:03:00.001-07:00</published><updated>2010-06-24T00:16:25.204-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="SQL Server"/><title type='text'>Use of Begin, Commit, Rollback Transactions in SQL Server</title><content type='html'>The SQL Server provides very useful feature which is Begin, Commit, Rollback Transaction.&lt;br /&gt;When we use Begin Transaction before we use DML Queries, we can Commit or Rollback that Transaction after the confirmation.  This is very useful if you update anything wrongly then you can rollback that transaction.&lt;br /&gt;For example,As shown below, I am trying to update the NodeID column data to 5 from 1.&lt;br /&gt;&lt;br /&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhL8n3tlmaqdO9JgzAOZyUf366cGla45SONtDWtTxY9roa-eilZnnMVKE-eRmyTAJa3ObLEQsFRh1qMC2r9bJxnjCzqY-tn_lczasbKWZNPYdTpBrKU4lkYjUa-lETazfaCPsa9WRAgJNVa/s1600/Before+Update.bmp&quot;&gt;&lt;img style=&quot;display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 113px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhL8n3tlmaqdO9JgzAOZyUf366cGla45SONtDWtTxY9roa-eilZnnMVKE-eRmyTAJa3ObLEQsFRh1qMC2r9bJxnjCzqY-tn_lczasbKWZNPYdTpBrKU4lkYjUa-lETazfaCPsa9WRAgJNVa/s400/Before+Update.bmp&quot; border=&quot;0&quot; alt=&quot;&quot;id=&quot;BLOGGER_PHOTO_ID_5477100186126548322&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class=&quot;brush: sql&quot;&gt;&lt;br /&gt;begin transaction&lt;br /&gt;&lt;br /&gt;update DownLoad_Data set NodeID=5&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;But after I updated, You can check whether you have been updated properly. But here, I realised I did not mention the Where clause.&lt;br /&gt;&lt;br /&gt;&lt;pre class=&quot;brush: sql&quot;&gt;&lt;br /&gt;select * from DownLoad_Data&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhF6m_mWBkJ1EDNP5nL3OrPdS6dQ6OoNw8oqFJEtfIBfazyBXu8bKMBZGbuBQMdBUdepcNEmBnsJ9kGbs1za51MMuU2fCL21FN9lymLMd0DuWChc5yEeXV4F58MCdrsoT1EmvUttkA1Rt8Y/s1600/After+Updated.bmp&quot;&gt;&lt;img style=&quot;display: block; margin: 0px auto 10px; text-align: center; cursor: pointer; width: 400px; height: 100px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhF6m_mWBkJ1EDNP5nL3OrPdS6dQ6OoNw8oqFJEtfIBfazyBXu8bKMBZGbuBQMdBUdepcNEmBnsJ9kGbs1za51MMuU2fCL21FN9lymLMd0DuWChc5yEeXV4F58MCdrsoT1EmvUttkA1Rt8Y/s400/After+Updated.bmp&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5477099140192407794&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;br /&gt;So I have to rollback this transaction. For that I can use Rollback Transaction since I used Begin Transaction.&lt;br /&gt;&lt;br /&gt;&lt;pre class=&quot;brush: sql&quot;&gt;&lt;br /&gt;Rollback transaction&lt;br /&gt;&lt;/pre&gt; &lt;br /&gt;&lt;br /&gt;So again I changed the Query and run it.&lt;br /&gt;&lt;br /&gt;&lt;pre class=&quot;brush: sql&quot;&gt;&lt;br /&gt;Begin transaction&lt;br /&gt;&lt;br /&gt;update DownLoad_Data set NodeID=5 where RecNo=1&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Still you can check whether have been updated properly. If it is updated correctly then, Run the Commit Transaction to make all updates permanently.&lt;br /&gt;&lt;br /&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjUGBZh6Jozsuy50GNR9BEZYlmBCE_pA09cH52TWWmSZHti4bkNO_Hjyler66OpqzY3_5Zbcla3YmH0aZCiG1VkMHoSNYBlGP_RpCPJxDOYeWOd4wpkKDRyCXs6Zy88tYAr3kOEDY4-Y1NO/s1600/Before+Commit.bmp&quot;&gt;&lt;img style=&quot;display: block; margin: 0px auto 10px; text-align: center; cursor: pointer; width: 400px; height: 111px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjUGBZh6Jozsuy50GNR9BEZYlmBCE_pA09cH52TWWmSZHti4bkNO_Hjyler66OpqzY3_5Zbcla3YmH0aZCiG1VkMHoSNYBlGP_RpCPJxDOYeWOd4wpkKDRyCXs6Zy88tYAr3kOEDY4-Y1NO/s400/Before+Commit.bmp&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5477097593021187650&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class=&quot;brush: sql&quot;&gt;&lt;br /&gt;Commit Transaction&lt;br /&gt;&lt;/pre&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:dontvertaligncellwithsp/&gt;    &lt;w:dontbreakconstrainedforcedtables/&gt;    &lt;w:dontvertalignintxbx/&gt;    &lt;w:word11kerningpairs/&gt;    &lt;w:cachedcolbalance/&gt;   &lt;/w:Compatibility&gt;   &lt;w:browserlevel&gt;MicrosoftInternetExplorer4&lt;/w:BrowserLevel&gt;   &lt;m:mathpr&gt;    &lt;m:mathfont val=&quot;Cambria Math&quot;&gt;    &lt;m:brkbin val=&quot;before&quot;&gt;    &lt;m:brkbinsub val=&quot;--&quot;&gt;    &lt;m:smallfrac val=&quot;off&quot;&gt;    &lt;m:dispdef/&gt;    &lt;m:lmargin val=&quot;0&quot;&gt;    &lt;m:rmargin val=&quot;0&quot;&gt;    &lt;m:defjc val=&quot;centerGroup&quot;&gt;    &lt;m:wrapindent val=&quot;1440&quot;&gt;    &lt;m:intlim val=&quot;subSup&quot;&gt;    &lt;m:narylim 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;true&quot; defsemihidden=&quot;true&quot; defqformat=&quot;false&quot; defpriority=&quot;99&quot; latentstylecount=&quot;267&quot;&gt;   &lt;w:lsdexception locked=&quot;false&quot; priority=&quot;0&quot; semihidden=&quot;false&quot; unhidewhenused=&quot;false&quot; qformat=&quot;true&quot; name=&quot;Normal&quot;&gt;   &lt;w:lsdexception locked=&quot;false&quot; priority=&quot;9&quot; semihidden=&quot;false&quot; unhidewhenused=&quot;false&quot; qformat=&quot;true&quot; name=&quot;heading 1&quot;&gt;   &lt;w:lsdexception locked=&quot;false&quot; priority=&quot;9&quot; qformat=&quot;true&quot; name=&quot;heading 2&quot;&gt;   &lt;w:lsdexception locked=&quot;false&quot; priority=&quot;9&quot; qformat=&quot;true&quot; name=&quot;heading 3&quot;&gt;   &lt;w:lsdexception locked=&quot;false&quot; priority=&quot;9&quot; qformat=&quot;true&quot; name=&quot;heading 4&quot;&gt;   &lt;w:lsdexception locked=&quot;false&quot; priority=&quot;9&quot; qformat=&quot;true&quot; name=&quot;heading 5&quot;&gt;   &lt;w:lsdexception locked=&quot;false&quot; priority=&quot;9&quot; qformat=&quot;true&quot; name=&quot;heading 6&quot;&gt;   &lt;w:lsdexception locked=&quot;false&quot; priority=&quot;9&quot; qformat=&quot;true&quot; name=&quot;heading 7&quot;&gt;   &lt;w:lsdexception locked=&quot;false&quot; priority=&quot;9&quot; qformat=&quot;true&quot; name=&quot;heading 8&quot;&gt;   &lt;w:lsdexception locked=&quot;false&quot; priority=&quot;9&quot; qformat=&quot;true&quot; name=&quot;heading 9&quot;&gt;   &lt;w:lsdexception locked=&quot;false&quot; priority=&quot;39&quot; name=&quot;toc 1&quot;&gt;   &lt;w:lsdexception locked=&quot;false&quot; priority=&quot;39&quot; name=&quot;toc 2&quot;&gt;   &lt;w:lsdexception locked=&quot;false&quot; priority=&quot;39&quot; name=&quot;toc 3&quot;&gt;   &lt;w:lsdexception locked=&quot;false&quot; priority=&quot;39&quot; name=&quot;toc 4&quot;&gt;   &lt;w:lsdexception locked=&quot;false&quot; priority=&quot;39&quot; name=&quot;toc 5&quot;&gt;   &lt;w:lsdexception locked=&quot;false&quot; priority=&quot;39&quot; name=&quot;toc 6&quot;&gt;   &lt;w:lsdexception locked=&quot;false&quot; priority=&quot;39&quot; name=&quot;toc 7&quot;&gt;   &lt;w:lsdexception locked=&quot;false&quot; priority=&quot;39&quot; name=&quot;toc 8&quot;&gt;   &lt;w:lsdexception locked=&quot;false&quot; priority=&quot;39&quot; name=&quot;toc 9&quot;&gt;   &lt;w:lsdexception locked=&quot;false&quot; priority=&quot;35&quot; qformat=&quot;true&quot; name=&quot;caption&quot;&gt;   &lt;w:lsdexception locked=&quot;false&quot; priority=&quot;10&quot; semihidden=&quot;false&quot; unhidewhenused=&quot;false&quot; qformat=&quot;true&quot; name=&quot;Title&quot;&gt;   &lt;w:lsdexception locked=&quot;false&quot; priority=&quot;1&quot; name=&quot;Default Paragraph Font&quot;&gt;   &lt;w:lsdexception locked=&quot;false&quot; priority=&quot;11&quot; semihidden=&quot;false&quot; unhidewhenused=&quot;false&quot; qformat=&quot;true&quot; name=&quot;Subtitle&quot;&gt;   &lt;w:lsdexception locked=&quot;false&quot; priority=&quot;22&quot; semihidden=&quot;false&quot; unhidewhenused=&quot;false&quot; qformat=&quot;true&quot; name=&quot;Strong&quot;&gt;   &lt;w:lsdexception locked=&quot;false&quot; priority=&quot;20&quot; semihidden=&quot;false&quot; unhidewhenused=&quot;false&quot; qformat=&quot;true&quot; name=&quot;Emphasis&quot;&gt;   &lt;w:lsdexception locked=&quot;false&quot; priority=&quot;59&quot; semihidden=&quot;false&quot; unhidewhenused=&quot;false&quot; name=&quot;Table Grid&quot;&gt;   &lt;w:lsdexception locked=&quot;false&quot; unhidewhenused=&quot;false&quot; name=&quot;Placeholder Text&quot;&gt;   &lt;w:lsdexception locked=&quot;false&quot; priority=&quot;1&quot; semihidden=&quot;false&quot; unhidewhenused=&quot;false&quot; qformat=&quot;true&quot; name=&quot;No Spacing&quot;&gt;   &lt;w:lsdexception locked=&quot;false&quot; priority=&quot;60&quot; semihidden=&quot;false&quot; unhidewhenused=&quot;false&quot; name=&quot;Light Shading&quot;&gt;   &lt;w:lsdexception locked=&quot;false&quot; priority=&quot;61&quot; semihidden=&quot;false&quot; unhidewhenused=&quot;false&quot; name=&quot;Light List&quot;&gt;   &lt;w:lsdexception locked=&quot;false&quot; priority=&quot;62&quot; semihidden=&quot;false&quot; unhidewhenused=&quot;false&quot; name=&quot;Light Grid&quot;&gt;   &lt;w:lsdexception locked=&quot;false&quot; priority=&quot;63&quot; semihidden=&quot;false&quot; unhidewhenused=&quot;false&quot; name=&quot;Medium Shading 1&quot;&gt;   &lt;w:lsdexception locked=&quot;false&quot; priority=&quot;64&quot; semihidden=&quot;false&quot; unhidewhenused=&quot;false&quot; name=&quot;Medium Shading 2&quot;&gt;   &lt;w:lsdexception locked=&quot;false&quot; priority=&quot;65&quot; semihidden=&quot;false&quot; unhidewhenused=&quot;false&quot; name=&quot;Medium List 1&quot;&gt;   &lt;w:lsdexception locked=&quot;false&quot; priority=&quot;66&quot; semihidden=&quot;false&quot; unhidewhenused=&quot;false&quot; name=&quot;Medium List 2&quot;&gt;   &lt;w:lsdexception locked=&quot;false&quot; priority=&quot;67&quot; semihidden=&quot;false&quot; unhidewhenused=&quot;false&quot; name=&quot;Medium Grid 1&quot;&gt;   &lt;w:lsdexception locked=&quot;false&quot; priority=&quot;68&quot; semihidden=&quot;false&quot; unhidewhenused=&quot;false&quot; name=&quot;Medium Grid 2&quot;&gt;   &lt;w:lsdexception locked=&quot;false&quot; priority=&quot;69&quot; semihidden=&quot;false&quot; unhidewhenused=&quot;false&quot; name=&quot;Medium Grid 3&quot;&gt;   &lt;w:lsdexception locked=&quot;false&quot; priority=&quot;70&quot; semihidden=&quot;false&quot; unhidewhenused=&quot;false&quot; name=&quot;Dark List&quot;&gt;   &lt;w:lsdexception locked=&quot;false&quot; priority=&quot;71&quot; semihidden=&quot;false&quot; unhidewhenused=&quot;false&quot; name=&quot;Colorful Shading&quot;&gt;   &lt;w:lsdexception locked=&quot;false&quot; priority=&quot;72&quot; semihidden=&quot;false&quot; unhidewhenused=&quot;false&quot; name=&quot;Colorful List&quot;&gt;   &lt;w:lsdexception locked=&quot;false&quot; priority=&quot;73&quot; semihidden=&quot;false&quot; unhidewhenused=&quot;false&quot; name=&quot;Colorful Grid&quot;&gt;   &lt;w:lsdexception locked=&quot;false&quot; priority=&quot;60&quot; semihidden=&quot;false&quot; unhidewhenused=&quot;false&quot; name=&quot;Light Shading Accent 1&quot;&gt;   &lt;w:lsdexception locked=&quot;false&quot; priority=&quot;61&quot; semihidden=&quot;false&quot; unhidewhenused=&quot;false&quot; name=&quot;Light List Accent 1&quot;&gt;   &lt;w:lsdexception locked=&quot;false&quot; priority=&quot;62&quot; semihidden=&quot;false&quot; unhidewhenused=&quot;false&quot; name=&quot;Light Grid Accent 1&quot;&gt;   &lt;w:lsdexception locked=&quot;false&quot; priority=&quot;63&quot; semihidden=&quot;false&quot; unhidewhenused=&quot;false&quot; name=&quot;Medium Shading 1 Accent 1&quot;&gt;   &lt;w:lsdexception locked=&quot;false&quot; priority=&quot;64&quot; semihidden=&quot;false&quot; unhidewhenused=&quot;false&quot; name=&quot;Medium Shading 2 Accent 1&quot;&gt;   &lt;w:lsdexception locked=&quot;false&quot; priority=&quot;65&quot; semihidden=&quot;false&quot; unhidewhenused=&quot;false&quot; name=&quot;Medium List 1 Accent 1&quot;&gt;   &lt;w:lsdexception locked=&quot;false&quot; unhidewhenused=&quot;false&quot; name=&quot;Revision&quot;&gt;   &lt;w:lsdexception locked=&quot;false&quot; priority=&quot;34&quot; semihidden=&quot;false&quot; unhidewhenused=&quot;false&quot; qformat=&quot;true&quot; name=&quot;List Paragraph&quot;&gt;   &lt;w:lsdexception locked=&quot;false&quot; priority=&quot;29&quot; semihidden=&quot;false&quot; unhidewhenused=&quot;false&quot; qformat=&quot;true&quot; name=&quot;Quote&quot;&gt;   &lt;w:lsdexception locked=&quot;false&quot; priority=&quot;30&quot; semihidden=&quot;false&quot; unhidewhenused=&quot;false&quot; qformat=&quot;true&quot; name=&quot;Intense Quote&quot;&gt;   &lt;w:lsdexception locked=&quot;false&quot; priority=&quot;66&quot; semihidden=&quot;false&quot; unhidewhenused=&quot;false&quot; name=&quot;Medium List 2 Accent 1&quot;&gt;   &lt;w:lsdexception locked=&quot;false&quot; priority=&quot;67&quot; semihidden=&quot;false&quot; unhidewhenused=&quot;false&quot; name=&quot;Medium Grid 1 Accent 1&quot;&gt;   &lt;w:lsdexception locked=&quot;false&quot; priority=&quot;68&quot; semihidden=&quot;false&quot; unhidewhenused=&quot;false&quot; name=&quot;Medium Grid 2 Accent 1&quot;&gt;   &lt;w:lsdexception locked=&quot;false&quot; priority=&quot;69&quot; semihidden=&quot;false&quot; unhidewhenused=&quot;false&quot; name=&quot;Medium Grid 3 Accent 1&quot;&gt;   &lt;w:lsdexception locked=&quot;false&quot; priority=&quot;70&quot; semihidden=&quot;false&quot; unhidewhenused=&quot;false&quot; name=&quot;Dark List Accent 1&quot;&gt;   &lt;w:lsdexception locked=&quot;false&quot; priority=&quot;71&quot; semihidden=&quot;false&quot; unhidewhenused=&quot;false&quot; name=&quot;Colorful Shading Accent 1&quot;&gt;   &lt;w:lsdexception locked=&quot;false&quot; priority=&quot;72&quot; semihidden=&quot;false&quot; unhidewhenused=&quot;false&quot; name=&quot;Colorful List Accent 1&quot;&gt;   &lt;w:lsdexception locked=&quot;false&quot; priority=&quot;73&quot; semihidden=&quot;false&quot; unhidewhenused=&quot;false&quot; name=&quot;Colorful Grid Accent 1&quot;&gt;   &lt;w:lsdexception locked=&quot;false&quot; priority=&quot;60&quot; semihidden=&quot;false&quot; unhidewhenused=&quot;false&quot; name=&quot;Light Shading Accent 2&quot;&gt;   &lt;w:lsdexception locked=&quot;false&quot; priority=&quot;61&quot; semihidden=&quot;false&quot; unhidewhenused=&quot;false&quot; name=&quot;Light List Accent 2&quot;&gt;   &lt;w:lsdexception locked=&quot;false&quot; priority=&quot;62&quot; semihidden=&quot;false&quot; unhidewhenused=&quot;false&quot; name=&quot;Light Grid Accent 2&quot;&gt;   &lt;w:lsdexception locked=&quot;false&quot; priority=&quot;63&quot; semihidden=&quot;false&quot; unhidewhenused=&quot;false&quot; name=&quot;Medium Shading 1 Accent 2&quot;&gt;   &lt;w:lsdexception locked=&quot;false&quot; priority=&quot;64&quot; semihidden=&quot;false&quot; unhidewhenused=&quot;false&quot; name=&quot;Medium Shading 2 Accent 2&quot;&gt;   &lt;w:lsdexception locked=&quot;false&quot; priority=&quot;65&quot; semihidden=&quot;false&quot; unhidewhenused=&quot;false&quot; name=&quot;Medium List 1 Accent 2&quot;&gt;   &lt;w:lsdexception locked=&quot;false&quot; priority=&quot;66&quot; semihidden=&quot;false&quot; unhidewhenused=&quot;false&quot; name=&quot;Medium List 2 Accent 2&quot;&gt;   &lt;w:lsdexception locked=&quot;false&quot; priority=&quot;67&quot; semihidden=&quot;false&quot; unhidewhenused=&quot;false&quot; name=&quot;Medium Grid 1 Accent 2&quot;&gt;   &lt;w:lsdexception locked=&quot;false&quot; priority=&quot;68&quot; semihidden=&quot;false&quot; unhidewhenused=&quot;false&quot; name=&quot;Medium Grid 2 Accent 2&quot;&gt;   &lt;w:lsdexception locked=&quot;false&quot; priority=&quot;69&quot; semihidden=&quot;false&quot; unhidewhenused=&quot;false&quot; name=&quot;Medium Grid 3 Accent 2&quot;&gt;   &lt;w:lsdexception locked=&quot;false&quot; priority=&quot;70&quot; semihidden=&quot;false&quot; unhidewhenused=&quot;false&quot; name=&quot;Dark List Accent 2&quot;&gt;   &lt;w:lsdexception locked=&quot;false&quot; priority=&quot;71&quot; semihidden=&quot;false&quot; unhidewhenused=&quot;false&quot; name=&quot;Colorful Shading Accent 2&quot;&gt;   &lt;w:lsdexception locked=&quot;false&quot; priority=&quot;72&quot; semihidden=&quot;false&quot; unhidewhenused=&quot;false&quot; name=&quot;Colorful List Accent 2&quot;&gt;   &lt;w:lsdexception locked=&quot;false&quot; priority=&quot;73&quot; semihidden=&quot;false&quot; unhidewhenused=&quot;false&quot; name=&quot;Colorful Grid Accent 2&quot;&gt;   &lt;w:lsdexception locked=&quot;false&quot; priority=&quot;60&quot; semihidden=&quot;false&quot; unhidewhenused=&quot;false&quot; name=&quot;Light Shading Accent 3&quot;&gt;   &lt;w:lsdexception locked=&quot;false&quot; priority=&quot;61&quot; semihidden=&quot;false&quot; unhidewhenused=&quot;false&quot; name=&quot;Light List Accent 3&quot;&gt;   &lt;w:lsdexception locked=&quot;false&quot; priority=&quot;62&quot; semihidden=&quot;false&quot; unhidewhenused=&quot;false&quot; name=&quot;Light Grid Accent 3&quot;&gt;   &lt;w:lsdexception locked=&quot;false&quot; priority=&quot;63&quot; semihidden=&quot;false&quot; unhidewhenused=&quot;false&quot; name=&quot;Medium Shading 1 Accent 3&quot;&gt;   &lt;w:lsdexception locked=&quot;false&quot; priority=&quot;64&quot; semihidden=&quot;false&quot; unhidewhenused=&quot;false&quot; name=&quot;Medium Shading 2 Accent 3&quot;&gt;   &lt;w:lsdexception locked=&quot;false&quot; priority=&quot;65&quot; semihidden=&quot;false&quot; unhidewhenused=&quot;false&quot; name=&quot;Medium List 1 Accent 3&quot;&gt;   &lt;w:lsdexception locked=&quot;false&quot; priority=&quot;66&quot; semihidden=&quot;false&quot; unhidewhenused=&quot;false&quot; name=&quot;Medium List 2 Accent 3&quot;&gt;   &lt;w:lsdexception locked=&quot;false&quot; priority=&quot;67&quot; semihidden=&quot;false&quot; unhidewhenused=&quot;false&quot; name=&quot;Medium Grid 1 Accent 3&quot;&gt;   &lt;w:lsdexception locked=&quot;false&quot; priority=&quot;68&quot; semihidden=&quot;false&quot; unhidewhenused=&quot;false&quot; name=&quot;Medium Grid 2 Accent 3&quot;&gt;   &lt;w:lsdexception locked=&quot;false&quot; priority=&quot;69&quot; semihidden=&quot;false&quot; unhidewhenused=&quot;false&quot; name=&quot;Medium Grid 3 Accent 3&quot;&gt;   &lt;w:lsdexception locked=&quot;false&quot; priority=&quot;70&quot; semihidden=&quot;false&quot; unhidewhenused=&quot;false&quot; name=&quot;Dark List Accent 3&quot;&gt;   &lt;w:lsdexception locked=&quot;false&quot; priority=&quot;71&quot; semihidden=&quot;false&quot; unhidewhenused=&quot;false&quot; name=&quot;Colorful Shading Accent 3&quot;&gt;   &lt;w:lsdexception locked=&quot;false&quot; priority=&quot;72&quot; semihidden=&quot;false&quot; unhidewhenused=&quot;false&quot; name=&quot;Colorful List Accent 3&quot;&gt;   &lt;w:lsdexception locked=&quot;false&quot; priority=&quot;73&quot; semihidden=&quot;false&quot; unhidewhenused=&quot;false&quot; name=&quot;Colorful Grid Accent 3&quot;&gt;   &lt;w:lsdexception locked=&quot;false&quot; priority=&quot;60&quot; semihidden=&quot;false&quot; unhidewhenused=&quot;false&quot; name=&quot;Light Shading Accent 4&quot;&gt;   &lt;w:lsdexception locked=&quot;false&quot; priority=&quot;61&quot; semihidden=&quot;false&quot; unhidewhenused=&quot;false&quot; name=&quot;Light List Accent 4&quot;&gt;   &lt;w:lsdexception locked=&quot;false&quot; priority=&quot;62&quot; semihidden=&quot;false&quot; unhidewhenused=&quot;false&quot; name=&quot;Light Grid Accent 4&quot;&gt;   &lt;w:lsdexception locked=&quot;false&quot; priority=&quot;63&quot; semihidden=&quot;false&quot; unhidewhenused=&quot;false&quot; name=&quot;Medium Shading 1 Accent 4&quot;&gt;   &lt;w:lsdexception locked=&quot;false&quot; priority=&quot;64&quot; semihidden=&quot;false&quot; unhidewhenused=&quot;false&quot; name=&quot;Medium Shading 2 Accent 4&quot;&gt;   &lt;w:lsdexception locked=&quot;false&quot; priority=&quot;65&quot; semihidden=&quot;false&quot; unhidewhenused=&quot;false&quot; name=&quot;Medium List 1 Accent 4&quot;&gt;   &lt;w:lsdexception locked=&quot;false&quot; priority=&quot;66&quot; semihidden=&quot;false&quot; unhidewhenused=&quot;false&quot; name=&quot;Medium List 2 Accent 4&quot;&gt;   &lt;w:lsdexception locked=&quot;false&quot; priority=&quot;67&quot; semihidden=&quot;false&quot; unhidewhenused=&quot;false&quot; name=&quot;Medium Grid 1 Accent 4&quot;&gt;   &lt;w:lsdexception locked=&quot;false&quot; priority=&quot;68&quot; semihidden=&quot;false&quot; unhidewhenused=&quot;false&quot; name=&quot;Medium Grid 2 Accent 4&quot;&gt;   &lt;w:lsdexception locked=&quot;false&quot; priority=&quot;69&quot; semihidden=&quot;false&quot; unhidewhenused=&quot;false&quot; name=&quot;Medium Grid 3 Accent 4&quot;&gt;   &lt;w:lsdexception locked=&quot;false&quot; priority=&quot;70&quot; semihidden=&quot;false&quot; unhidewhenused=&quot;false&quot; name=&quot;Dark List Accent 4&quot;&gt;   &lt;w:lsdexception locked=&quot;false&quot; priority=&quot;71&quot; semihidden=&quot;false&quot; unhidewhenused=&quot;false&quot; name=&quot;Colorful Shading Accent 4&quot;&gt;   &lt;w:lsdexception locked=&quot;false&quot; priority=&quot;72&quot; semihidden=&quot;false&quot; unhidewhenused=&quot;false&quot; name=&quot;Colorful List Accent 4&quot;&gt;   &lt;w:lsdexception locked=&quot;false&quot; priority=&quot;73&quot; semihidden=&quot;false&quot; unhidewhenused=&quot;false&quot; name=&quot;Colorful Grid Accent 4&quot;&gt;   &lt;w:lsdexception locked=&quot;false&quot; priority=&quot;60&quot; semihidden=&quot;false&quot; unhidewhenused=&quot;false&quot; name=&quot;Light Shading Accent 5&quot;&gt;   &lt;w:lsdexception locked=&quot;false&quot; priority=&quot;61&quot; semihidden=&quot;false&quot; unhidewhenused=&quot;false&quot; name=&quot;Light List Accent 5&quot;&gt;   &lt;w:lsdexception locked=&quot;false&quot; priority=&quot;62&quot; semihidden=&quot;false&quot; unhidewhenused=&quot;false&quot; name=&quot;Light Grid Accent 5&quot;&gt;   &lt;w:lsdexception locked=&quot;false&quot; priority=&quot;63&quot; semihidden=&quot;false&quot; unhidewhenused=&quot;false&quot; name=&quot;Medium Shading 1 Accent 5&quot;&gt;   &lt;w:lsdexception locked=&quot;false&quot; priority=&quot;64&quot; semihidden=&quot;false&quot; unhidewhenused=&quot;false&quot; name=&quot;Medium Shading 2 Accent 5&quot;&gt;   &lt;w:lsdexception locked=&quot;false&quot; priority=&quot;65&quot; semihidden=&quot;false&quot; unhidewhenused=&quot;false&quot; name=&quot;Medium List 1 Accent 5&quot;&gt;   &lt;w:lsdexception locked=&quot;false&quot; priority=&quot;66&quot; semihidden=&quot;false&quot; unhidewhenused=&quot;false&quot; name=&quot;Medium List 2 Accent 5&quot;&gt;   &lt;w:lsdexception locked=&quot;false&quot; priority=&quot;67&quot; semihidden=&quot;false&quot; unhidewhenused=&quot;false&quot; name=&quot;Medium Grid 1 Accent 5&quot;&gt;   &lt;w:lsdexception locked=&quot;false&quot; priority=&quot;68&quot; semihidden=&quot;false&quot; unhidewhenused=&quot;false&quot; name=&quot;Medium Grid 2 Accent 5&quot;&gt;   &lt;w:lsdexception locked=&quot;false&quot; priority=&quot;69&quot; semihidden=&quot;false&quot; unhidewhenused=&quot;false&quot; name=&quot;Medium Grid 3 Accent 5&quot;&gt;   &lt;w:lsdexception locked=&quot;false&quot; priority=&quot;70&quot; semihidden=&quot;false&quot; unhidewhenused=&quot;false&quot; name=&quot;Dark List Accent 5&quot;&gt;   &lt;w:lsdexception locked=&quot;false&quot; priority=&quot;71&quot; semihidden=&quot;false&quot; unhidewhenused=&quot;false&quot; name=&quot;Colorful Shading Accent 5&quot;&gt;   &lt;w:lsdexception locked=&quot;false&quot; priority=&quot;72&quot; semihidden=&quot;false&quot; unhidewhenused=&quot;false&quot; name=&quot;Colorful List Accent 5&quot;&gt;   &lt;w:lsdexception locked=&quot;false&quot; priority=&quot;73&quot; semihidden=&quot;false&quot; unhidewhenused=&quot;false&quot; name=&quot;Colorful Grid Accent 5&quot;&gt;   &lt;w:lsdexception locked=&quot;false&quot; priority=&quot;60&quot; semihidden=&quot;false&quot; unhidewhenused=&quot;false&quot; name=&quot;Light Shading Accent 6&quot;&gt;   &lt;w:lsdexception locked=&quot;false&quot; priority=&quot;61&quot; semihidden=&quot;false&quot; unhidewhenused=&quot;false&quot; name=&quot;Light List Accent 6&quot;&gt;   &lt;w:lsdexception locked=&quot;false&quot; priority=&quot;62&quot; semihidden=&quot;false&quot; unhidewhenused=&quot;false&quot; name=&quot;Light Grid Accent 6&quot;&gt;   &lt;w:lsdexception locked=&quot;false&quot; priority=&quot;63&quot; semihidden=&quot;false&quot; unhidewhenused=&quot;false&quot; name=&quot;Medium Shading 1 Accent 6&quot;&gt;   &lt;w:lsdexception locked=&quot;false&quot; priority=&quot;64&quot; semihidden=&quot;false&quot; unhidewhenused=&quot;false&quot; name=&quot;Medium Shading 2 Accent 6&quot;&gt;   &lt;w:lsdexception locked=&quot;false&quot; priority=&quot;65&quot; semihidden=&quot;false&quot; unhidewhenused=&quot;false&quot; name=&quot;Medium List 1 Accent 6&quot;&gt;   &lt;w:lsdexception locked=&quot;false&quot; priority=&quot;66&quot; semihidden=&quot;false&quot; unhidewhenused=&quot;false&quot; name=&quot;Medium List 2 Accent 6&quot;&gt;   &lt;w:lsdexception locked=&quot;false&quot; priority=&quot;67&quot; semihidden=&quot;false&quot; unhidewhenused=&quot;false&quot; name=&quot;Medium Grid 1 Accent 6&quot;&gt;   &lt;w:lsdexception locked=&quot;false&quot; priority=&quot;68&quot; semihidden=&quot;false&quot; unhidewhenused=&quot;false&quot; name=&quot;Medium Grid 2 Accent 6&quot;&gt;   &lt;w:lsdexception locked=&quot;false&quot; priority=&quot;69&quot; semihidden=&quot;false&quot; unhidewhenused=&quot;false&quot; name=&quot;Medium Grid 3 Accent 6&quot;&gt;   &lt;w:lsdexception locked=&quot;false&quot; priority=&quot;70&quot; semihidden=&quot;false&quot; unhidewhenused=&quot;false&quot; name=&quot;Dark List Accent 6&quot;&gt;   &lt;w:lsdexception locked=&quot;false&quot; priority=&quot;71&quot; semihidden=&quot;false&quot; unhidewhenused=&quot;false&quot; name=&quot;Colorful Shading Accent 6&quot;&gt;   &lt;w:lsdexception locked=&quot;false&quot; priority=&quot;72&quot; semihidden=&quot;false&quot; unhidewhenused=&quot;false&quot; name=&quot;Colorful List Accent 6&quot;&gt;   &lt;w:lsdexception locked=&quot;false&quot; priority=&quot;73&quot; semihidden=&quot;false&quot; unhidewhenused=&quot;false&quot; name=&quot;Colorful Grid Accent 6&quot;&gt;   &lt;w:lsdexception locked=&quot;false&quot; priority=&quot;19&quot; semihidden=&quot;false&quot; unhidewhenused=&quot;false&quot; qformat=&quot;true&quot; name=&quot;Subtle Emphasis&quot;&gt;   &lt;w:lsdexception locked=&quot;false&quot; priority=&quot;21&quot; semihidden=&quot;false&quot; unhidewhenused=&quot;false&quot; qformat=&quot;true&quot; name=&quot;Intense Emphasis&quot;&gt;   &lt;w:lsdexception locked=&quot;false&quot; priority=&quot;31&quot; semihidden=&quot;false&quot; unhidewhenused=&quot;false&quot; qformat=&quot;true&quot; name=&quot;Subtle Reference&quot;&gt;   &lt;w:lsdexception locked=&quot;false&quot; priority=&quot;32&quot; semihidden=&quot;false&quot; unhidewhenused=&quot;false&quot; qformat=&quot;true&quot; name=&quot;Intense Reference&quot;&gt;   &lt;w:lsdexception locked=&quot;false&quot; priority=&quot;33&quot; semihidden=&quot;false&quot; unhidewhenused=&quot;false&quot; qformat=&quot;true&quot; name=&quot;Book Title&quot;&gt;   &lt;w:lsdexception locked=&quot;false&quot; priority=&quot;37&quot; name=&quot;Bibliography&quot;&gt;   &lt;w:lsdexception locked=&quot;false&quot; priority=&quot;39&quot; qformat=&quot;true&quot; name=&quot;TOC Heading&quot;&gt;  &lt;/w:LatentStyles&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;style&gt; &lt;!--  /* Font Definitions */  @font-face  {font-family:&quot;Cambria Math&quot;;  panose-1:2 4 5 3 5 4 6 3 2 4;  mso-font-charset:1;  mso-generic-font-family:roman;  mso-font-format:other;  mso-font-pitch:variable;  mso-font-signature:0 0 0 0 0 0;} @font-face  {font-family:Calibri;  panose-1:2 15 5 2 2 2 4 3 2 4;  mso-font-charset:0;  mso-generic-font-family:swiss;  mso-font-pitch:variable;  mso-font-signature:-1610611985 1073750139 0 0 159 0;}  /* Style Definitions */  p.MsoNormal, li.MsoNormal, div.MsoNormal  {mso-style-unhide:no;  mso-style-qformat:yes;  mso-style-parent:&quot;&quot;;  margin-top:0in;  margin-right:0in;  margin-bottom:10.0pt;  margin-left:0in;  line-height:115%;  mso-pagination:widow-orphan;  font-size:11.0pt;  font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;  mso-ascii-font-family:Calibri;  mso-ascii-theme-font:minor-latin;  mso-fareast-font-family:Calibri;  mso-fareast-theme-font:minor-latin;  mso-hansi-font-family:Calibri;  mso-hansi-theme-font:minor-latin;  mso-bidi-font-family:&quot;Times New Roman&quot;;  mso-bidi-theme-font:minor-bidi;} .MsoChpDefault  {mso-style-type:export-only;  mso-default-props:yes;  mso-ascii-font-family:Calibri;  mso-ascii-theme-font:minor-latin;  mso-fareast-font-family:Calibri;  mso-fareast-theme-font:minor-latin;  mso-hansi-font-family:Calibri;  mso-hansi-theme-font:minor-latin;  mso-bidi-font-family:&quot;Times New Roman&quot;;  mso-bidi-theme-font:minor-bidi;} .MsoPapDefault  {mso-style-type:export-only;  margin-bottom:10.0pt;  line-height:115%;} @page Section1  {size:8.5in 11.0in;  margin:1.0in 1.0in 1.0in 1.0in;  mso-header-margin:.5in;  mso-footer-margin:.5in;  mso-paper-source:0;} div.Section1  {page:Section1;} --&gt; &lt;/style&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-qformat:yes;  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:10.0pt;  mso-para-margin-left:0in;  line-height:115%;  mso-pagination:widow-orphan;  font-size:11.0pt;  font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;  mso-ascii-font-family:Calibri;  mso-ascii-theme-font:minor-latin;  mso-fareast-font-family:&quot;Times New Roman&quot;;  mso-fareast-theme-font:minor-fareast;  mso-hansi-font-family:Calibri;  mso-hansi-theme-font:minor-latin;} &lt;/style&gt; &lt;![endif]--&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;I hope this would have been very useful for you all.&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://programmingocean.blogspot.com/feeds/2864834355477774303/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://programmingocean.blogspot.com/2010/05/use-of-begin-commit-rollback.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7856726257089876870/posts/default/2864834355477774303'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7856726257089876870/posts/default/2864834355477774303'/><link rel='alternate' type='text/html' href='http://programmingocean.blogspot.com/2010/05/use-of-begin-commit-rollback.html' title='Use of Begin, Commit, Rollback Transactions in SQL Server'/><author><name>murukan</name><uri>http://www.blogger.com/profile/07265681234394455890</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='27' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh5PYOrtR0a6mNzWkDDqOsFHzJgR5cDoeSWXyw03RsMIEm3TiAOVu77g7C8pWSur1HVFQ99RfM6m2Qng0fygNfqEjtg4hpiPvx1mMtRNnzED2ztg7GTyD8wezgTR7BBqw/s220/DSCF2627[1]c.JPG'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhL8n3tlmaqdO9JgzAOZyUf366cGla45SONtDWtTxY9roa-eilZnnMVKE-eRmyTAJa3ObLEQsFRh1qMC2r9bJxnjCzqY-tn_lczasbKWZNPYdTpBrKU4lkYjUa-lETazfaCPsa9WRAgJNVa/s72-c/Before+Update.bmp" height="72" width="72"/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7856726257089876870.post-8707488521647928800</id><published>2010-05-29T19:37:00.001-07:00</published><updated>2010-06-24T00:16:53.123-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="SQL Server"/><title type='text'>SQL SERVER – TRIM() Function – UDF TRIM()</title><content type='html'>SQL Server does not have Trim()  function.  So we can create a own UDF (User Defined Function) function for this since SQL Sever does LTRIM(),RTRIM() functions and we can use this any time.&lt;br /&gt;Here I have created a simple Function for this.&lt;br /&gt;&lt;pre class=&quot;brush: sql&quot;&gt;&lt;br /&gt;Create Function Trim(@mText  varchar(MAX))&lt;br /&gt;Returns varchar(MAX)&lt;br /&gt;AS&lt;br /&gt;Begin&lt;br /&gt;return LTRIM(RTRIM(@mText))&lt;br /&gt;End&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;You can run this function as shown below here,&lt;br /&gt;&lt;pre class=&quot;brush: sql&quot;&gt;&lt;br /&gt;Select dbo.Trim(&#39; Test  &#39;)&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;So this function would return ‘Test’ only as LTRIM() function would cut off the Left side spaces and RTRIM() functiom would cut off the Right side spaces.</content><link rel='replies' type='application/atom+xml' href='http://programmingocean.blogspot.com/feeds/8707488521647928800/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://programmingocean.blogspot.com/2010/05/sql-server-trim-function-udf-trim.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7856726257089876870/posts/default/8707488521647928800'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7856726257089876870/posts/default/8707488521647928800'/><link rel='alternate' type='text/html' href='http://programmingocean.blogspot.com/2010/05/sql-server-trim-function-udf-trim.html' title='SQL SERVER – TRIM() Function – UDF TRIM()'/><author><name>murukan</name><uri>http://www.blogger.com/profile/07265681234394455890</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='27' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh5PYOrtR0a6mNzWkDDqOsFHzJgR5cDoeSWXyw03RsMIEm3TiAOVu77g7C8pWSur1HVFQ99RfM6m2Qng0fygNfqEjtg4hpiPvx1mMtRNnzED2ztg7GTyD8wezgTR7BBqw/s220/DSCF2627[1]c.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7856726257089876870.post-2402253120269177954</id><published>2010-05-07T09:36:00.000-07:00</published><updated>2010-06-24T00:17:17.209-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="SQL Server"/><title type='text'>SQL Script for take backup of Database in sql server</title><content type='html'>&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;br /&gt;In sql server there are 2 built-in stored procedures for drop the already existing backup device and create the new device in the user defined path.&lt;br /&gt;Before create the backup device, must drop the device. Because when you create a backup device, if backup device had already been created, sql server throw a error. So very first time have to create a backup device manually.&lt;br /&gt;Afterwards you can use this script.&lt;br /&gt;This is very use ful as user can take backup where user wants it since this procedure takes the path as parameter.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Create Backup device manually in Sql Server 2008&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Go to Server Object where right click on Backup Device, Then choose New Backup Device. if you choose that, sql server let you to create the New Backup Device.&lt;br /&gt;(Please refer the figures as shown below)&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;b&gt;Figure 1&lt;/b&gt;&lt;br /&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhfvqRN59b21qfH1VYJBsu42ufijAhJwK2mEvXwe7ZFXT4bybSey8oFrpf1SSNX_DI6SjUy85bvDkAo1P6UyW-O4C-CsNEIhnck6-EbBJyRa68mu_Z4FF7OYFurBfWicpZguThaTBDpg5WS/s1600/BackupDevice2.JPG&quot;&gt;&lt;img style=&quot;display: block; margin: 0px auto 10px; text-align: center; cursor: pointer; width: 400px; height: 249px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhfvqRN59b21qfH1VYJBsu42ufijAhJwK2mEvXwe7ZFXT4bybSey8oFrpf1SSNX_DI6SjUy85bvDkAo1P6UyW-O4C-CsNEIhnck6-EbBJyRa68mu_Z4FF7OYFurBfWicpZguThaTBDpg5WS/s400/BackupDevice2.JPG&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5468573398362317282&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;b&gt;Figure 2&lt;/b&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi6ciJY41BeKch7ksKaKaj0Ma0u3Hlwyc-oCw3hIedcAIVdq_UNfl0QfqTMbdLYvmf1YjwqqZvK_LqrnUZxFmU_VSK1MxbIVWqdZdZOxsMbMQxfpEj7kOd383-gD7BUDdu6nCKj1PhcyNIy/s1600/BackupDevice1.JPG&quot;&gt;&lt;img style=&quot;display: block; margin: 0px auto 10px; text-align: center; cursor: pointer; width: 400px; height: 250px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi6ciJY41BeKch7ksKaKaj0Ma0u3Hlwyc-oCw3hIedcAIVdq_UNfl0QfqTMbdLYvmf1YjwqqZvK_LqrnUZxFmU_VSK1MxbIVWqdZdZOxsMbMQxfpEj7kOd383-gD7BUDdu6nCKj1PhcyNIy/s400/BackupDevice1.JPG&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5468573064344793890&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;b&gt;Figure 3&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhnNVAtAY8nyQ0E-2grSzPXDd6EBHIaBFaXw3CvfT9bmyKreffHyJXRKllhsRA8Y6XfdsQisAQ0ToO-k5ZvZtaySbjCtGNDZLEVyW2V78KXicPoo5CTpWGILlBxTk2hbHS56L8lbqN5SRoY/s1600/BackupDevice3.JPG&quot;&gt;&lt;img style=&quot;display: block; margin: 0px auto 10px; text-align: center; cursor: pointer; width: 400px; height: 260px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhnNVAtAY8nyQ0E-2grSzPXDd6EBHIaBFaXw3CvfT9bmyKreffHyJXRKllhsRA8Y6XfdsQisAQ0ToO-k5ZvZtaySbjCtGNDZLEVyW2V78KXicPoo5CTpWGILlBxTk2hbHS56L8lbqN5SRoY/s400/BackupDevice3.JPG&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5468573573605185090&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;b&gt;Figure 4&lt;/b&gt;&lt;br /&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhFCm63tCNMm6-zse1PJprSldpr6jveqQXYa3frETyKfFPolkPtaPRJrWg3tw677wD9a2faizztruqPmYG1bhxYvSGs4O1TNPZNR6EP1E8xZl13-DGS68N39JD-S1cZSl_MEqSLkOZfgqkX/s1600/BackupDevice4.JPG&quot;&gt;&lt;img style=&quot;display: block; margin: 0px auto 10px; text-align: center; cursor: pointer; width: 286px; height: 400px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhFCm63tCNMm6-zse1PJprSldpr6jveqQXYa3frETyKfFPolkPtaPRJrWg3tw677wD9a2faizztruqPmYG1bhxYvSGs4O1TNPZNR6EP1E8xZl13-DGS68N39JD-S1cZSl_MEqSLkOZfgqkX/s400/BackupDevice4.JPG&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5468573721862502370&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;b&gt;Figure 5&lt;/b&gt;&lt;br /&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiMuUq9s2naatZIl7RTOrvfieH_syTXzc_zMaJuR_j_3PmT-pStkLw-5z2FQcw71RV_-1iHCNyQWiVljzVOlen6hA_h10xIJBD1S0011QFJRnVv2733_ujFnC_m4cl0If8Jt1wEDKZUDOoI/s1600/BackupDevice5.JPG&quot;&gt;&lt;img style=&quot;display: block; margin: 0px auto 10px; text-align: center; cursor: pointer; width: 268px; height: 305px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiMuUq9s2naatZIl7RTOrvfieH_syTXzc_zMaJuR_j_3PmT-pStkLw-5z2FQcw71RV_-1iHCNyQWiVljzVOlen6hA_h10xIJBD1S0011QFJRnVv2733_ujFnC_m4cl0If8Jt1wEDKZUDOoI/s400/BackupDevice5.JPG&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5468573855119164066&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Script for Drop the Backup Device&lt;br /&gt;&lt;pre class=&quot;brush: sql&quot;&gt;&lt;br /&gt;EXEC sp_dropdevice &#39;Time_Attendance&#39;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Script for Create the Backup Device&lt;br /&gt;&lt;pre class=&quot;brush: sql&quot;&gt;&lt;br /&gt;EXEC sp_addumpdevice &#39;disk&#39;, &#39;Time_Attendance&#39;, @Path&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Script for initializes the backup with user specified name&lt;br /&gt;&lt;pre class=&quot;brush: sql&quot;&gt;&lt;br /&gt;BACKUP DATABASE Time_Attendance&lt;br /&gt;TO Time_Attendance with name= @Name, INIT&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://programmingocean.blogspot.com/feeds/2402253120269177954/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://programmingocean.blogspot.com/2010/05/sql-script-for-take-backup-of-database.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7856726257089876870/posts/default/2402253120269177954'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7856726257089876870/posts/default/2402253120269177954'/><link rel='alternate' type='text/html' href='http://programmingocean.blogspot.com/2010/05/sql-script-for-take-backup-of-database.html' title='SQL Script for take backup of Database in sql server'/><author><name>murukan</name><uri>http://www.blogger.com/profile/07265681234394455890</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='27' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh5PYOrtR0a6mNzWkDDqOsFHzJgR5cDoeSWXyw03RsMIEm3TiAOVu77g7C8pWSur1HVFQ99RfM6m2Qng0fygNfqEjtg4hpiPvx1mMtRNnzED2ztg7GTyD8wezgTR7BBqw/s220/DSCF2627[1]c.JPG'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhfvqRN59b21qfH1VYJBsu42ufijAhJwK2mEvXwe7ZFXT4bybSey8oFrpf1SSNX_DI6SjUy85bvDkAo1P6UyW-O4C-CsNEIhnck6-EbBJyRa68mu_Z4FF7OYFurBfWicpZguThaTBDpg5WS/s72-c/BackupDevice2.JPG" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7856726257089876870.post-2373767033799838545</id><published>2010-04-29T23:32:00.000-07:00</published><updated>2010-06-24T00:17:44.380-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Oracle"/><title type='text'>Get the Running Total in Oracle</title><content type='html'>&lt;p&gt;This very frequent needful thing for developers as they need to  create so many reports based on this concept.&lt;/p&gt; &lt;p&gt;For this you will have to use one of the window functions in oracle  which is &lt;strong&gt;ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW.&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;&lt;strong&gt; &lt;/strong&gt;&lt;/p&gt; &lt;p&gt;This would add each and every vale with previous value and give like  Running Total.&lt;/p&gt; &lt;p&gt;Query for this,&lt;/p&gt; &lt;pre class=&quot;brush: sql&quot;&gt;SELECT PRODUCT_NO,PL_NO, UNRESTRICTED_QTY,&lt;br /&gt;&lt;br /&gt;SUM(UNRESTRICTED_QTY) OVER (ORDER BY PRODUCT_NO ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) RUNNING_TOTAL&lt;br /&gt;&lt;br /&gt;FROM PRODUCT_LOCATION&lt;br /&gt;&lt;br /&gt;WHERE CLIENT_C=UPPER(‘MSWG’) AND UNRESTRICTED_QTY&gt;0 AND LOCATION_NO=’RECEIPT_BAY‘&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj3MpKgIXeNccDf0Q8SEMxRqBbtQLJ6ed3_pIIFraLXG4MiI2vi-SPAD5_Z_GWKt2spmuk_Jj6Nex30yR9Gc38dG-aryRXjyDpS5lBLIQzoB0gs1NUHz4JfXPz3iV_RmAYeO4Zo9NybJ5u5/s1600/windowfn.jpg&quot;&gt;&lt;img style=&quot;display: block; margin: 0px auto 10px; text-align: center; cursor: pointer; width: 400px; height: 49px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj3MpKgIXeNccDf0Q8SEMxRqBbtQLJ6ed3_pIIFraLXG4MiI2vi-SPAD5_Z_GWKt2spmuk_Jj6Nex30yR9Gc38dG-aryRXjyDpS5lBLIQzoB0gs1NUHz4JfXPz3iV_RmAYeO4Zo9NybJ5u5/s400/windowfn.jpg&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5465814876177763970&quot; border=&quot;0&quot; /&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/a&gt;&lt;p&gt;row in the result set and adding up the values with currently reading  value which is specified by &lt;strong&gt;CURRENT&lt;/strong&gt;&lt;strong&gt; &lt;/strong&gt;&lt;strong&gt;ROW&lt;/strong&gt;  up to last record of the record set.&lt;/p&gt; &lt;p&gt;And ordering results by PRODUCT_NO&lt;/p&gt; &lt;p&gt;The result of the above query shown below.&lt;/p&gt;&lt;p&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj3MpKgIXeNccDf0Q8SEMxRqBbtQLJ6ed3_pIIFraLXG4MiI2vi-SPAD5_Z_GWKt2spmuk_Jj6Nex30yR9Gc38dG-aryRXjyDpS5lBLIQzoB0gs1NUHz4JfXPz3iV_RmAYeO4Zo9NybJ5u5/s1600/windowfn.jpg&quot;&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/a&gt;&lt;strong&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();}  catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhfbBxSdsYG3EGCzcNBoY1ruWP3D-kXAVxWXK-ldRigvfRf9AwWhX5pCo4d03D7D0giJs-6DuN2bhL53CsdmmdUAOIZgFs_TeZPz7_19aexXBx65Pife0C1wmlmbb2-L291wLisVaog0cGv/s1600/window_res.jpg&quot;&gt;&lt;img style=&quot;display: block; margin: 0px auto 10px; text-align: center; cursor: pointer; width: 400px; height: 347px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhfbBxSdsYG3EGCzcNBoY1ruWP3D-kXAVxWXK-ldRigvfRf9AwWhX5pCo4d03D7D0giJs-6DuN2bhL53CsdmmdUAOIZgFs_TeZPz7_19aexXBx65Pife0C1wmlmbb2-L291wLisVaog0cGv/s400/window_res.jpg&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5465815089640799426&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://programmingocean.blogspot.com/feeds/2373767033799838545/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://programmingocean.blogspot.com/2010/04/get-running-total-in-oracle.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7856726257089876870/posts/default/2373767033799838545'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7856726257089876870/posts/default/2373767033799838545'/><link rel='alternate' type='text/html' href='http://programmingocean.blogspot.com/2010/04/get-running-total-in-oracle.html' title='Get the Running Total in Oracle'/><author><name>murukan</name><uri>http://www.blogger.com/profile/07265681234394455890</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='27' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh5PYOrtR0a6mNzWkDDqOsFHzJgR5cDoeSWXyw03RsMIEm3TiAOVu77g7C8pWSur1HVFQ99RfM6m2Qng0fygNfqEjtg4hpiPvx1mMtRNnzED2ztg7GTyD8wezgTR7BBqw/s220/DSCF2627[1]c.JPG'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj3MpKgIXeNccDf0Q8SEMxRqBbtQLJ6ed3_pIIFraLXG4MiI2vi-SPAD5_Z_GWKt2spmuk_Jj6Nex30yR9Gc38dG-aryRXjyDpS5lBLIQzoB0gs1NUHz4JfXPz3iV_RmAYeO4Zo9NybJ5u5/s72-c/windowfn.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7856726257089876870.post-2941454254637225352</id><published>2010-04-15T02:41:00.000-07:00</published><updated>2010-05-14T09:10:38.455-07:00</updated><title type='text'>Get table structure using SQL query in SQL Server</title><content type='html'>&lt;span style=&quot;color: rgb(51, 51, 255);&quot;&gt;&lt;span style=&quot;color: rgb(0, 0, 0);&quot;&gt;Here it s the query for retrieve the table structure in sql server,&lt;br /&gt;&lt;br /&gt;&lt;pre class=&quot;brush: sql&quot;&gt;&lt;br /&gt;SELECT Ordinal_Position,Column_Name,Data_Type,Is_Nullable,Character_Maximum_Length&lt;br /&gt;INFORMATION_SCHEMA.COLUMNS&lt;/span&gt;&lt;br /&gt;WHERE&lt;/span&gt; TABLE_NAME=&#39;table Name&#39;&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://programmingocean.blogspot.com/feeds/2941454254637225352/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://programmingocean.blogspot.com/2010/04/get-table-structure-using-sql-query-in.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7856726257089876870/posts/default/2941454254637225352'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7856726257089876870/posts/default/2941454254637225352'/><link rel='alternate' type='text/html' href='http://programmingocean.blogspot.com/2010/04/get-table-structure-using-sql-query-in.html' title='Get table structure using SQL query in SQL Server'/><author><name>murukan</name><uri>http://www.blogger.com/profile/07265681234394455890</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='27' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh5PYOrtR0a6mNzWkDDqOsFHzJgR5cDoeSWXyw03RsMIEm3TiAOVu77g7C8pWSur1HVFQ99RfM6m2Qng0fygNfqEjtg4hpiPvx1mMtRNnzED2ztg7GTyD8wezgTR7BBqw/s220/DSCF2627[1]c.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7856726257089876870.post-2455864492575676137</id><published>2010-03-30T02:08:00.000-07:00</published><updated>2010-05-13T23:08:18.274-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="SQL Server"/><title type='text'>Delete duplicate records from a Table in SQL Server</title><content type='html'>&lt;pre class=&quot;brush: sql&quot;&gt;&lt;br /&gt; drop table ##temp&lt;br /&gt;create table ##temp (id char(3) ,marks int )&lt;br /&gt;create table ##temp2 (id char(3) ,marks int )&lt;br /&gt;insert into ##temp(id,marks) ----Here we are inserting duplicate&lt;br /&gt;select &#39;001&#39;,50               ----records for each ID&lt;br /&gt;union all&lt;br /&gt;select &#39;001&#39;,60&lt;br /&gt;union all&lt;br /&gt;select &#39;002&#39;,66&lt;br /&gt;union all&lt;br /&gt;select &#39;002&#39;,88&lt;br /&gt;union all&lt;br /&gt;select &#39;003&#39;,92&lt;br /&gt;union all&lt;br /&gt;select &#39;003&#39;,64&lt;br /&gt;union all&lt;br /&gt;select &#39;004&#39;,44&lt;br /&gt;union all&lt;br /&gt;select &#39;005&#39;,67&lt;br /&gt;----Here we are getting the distinct records and insert then into another Tempory table&lt;br /&gt;insert into ##temp2 select distinct id,max(marks) from ##temp where id in(&lt;br /&gt;select a.id from&lt;br /&gt;(select id,count(id) cnt from ##temp group by id having count(id)&amp;gt;1) a)&lt;br /&gt;group by id&lt;br /&gt;---And delete those duplicate records from original Table&lt;br /&gt;delete from ##temp where id in(&lt;br /&gt;select a.id from&lt;br /&gt;(select id,count(id) cnt from ##temp group by id having count(id)&amp;gt;1) a)&lt;br /&gt;---And again inser the inserted reocrds from temporary Table&lt;br /&gt;insert into ##temp select * from ##temp2&lt;br /&gt;----Drop the Temporary Table.&lt;br /&gt;drop table ##temp2&lt;br /&gt;---Retrieve the Table which will have only distincts Records&lt;br /&gt;select * from ##temp order by id&lt;br /&gt;&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://programmingocean.blogspot.com/feeds/2455864492575676137/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://programmingocean.blogspot.com/2010/03/delete-duplicate-records-from-table-in.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7856726257089876870/posts/default/2455864492575676137'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7856726257089876870/posts/default/2455864492575676137'/><link rel='alternate' type='text/html' href='http://programmingocean.blogspot.com/2010/03/delete-duplicate-records-from-table-in.html' title='Delete duplicate records from a Table in SQL Server'/><author><name>murukan</name><uri>http://www.blogger.com/profile/07265681234394455890</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='27' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh5PYOrtR0a6mNzWkDDqOsFHzJgR5cDoeSWXyw03RsMIEm3TiAOVu77g7C8pWSur1HVFQ99RfM6m2Qng0fygNfqEjtg4hpiPvx1mMtRNnzED2ztg7GTyD8wezgTR7BBqw/s220/DSCF2627[1]c.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7856726257089876870.post-9116249163532543020</id><published>2010-03-26T23:43:00.000-07:00</published><updated>2010-03-26T23:43:49.072-07:00</updated><title type='text'>Blogger Buzz: Blogger integrates with Amazon Associates</title><content type='html'>&lt;a href=&quot;http://buzz.blogger.com/2009/12/blogger-integrates-with-amazon.html&quot;&gt;Blogger Buzz: Blogger integrates with Amazon Associates&lt;/a&gt;</content><link rel='replies' type='application/atom+xml' href='http://programmingocean.blogspot.com/feeds/9116249163532543020/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://programmingocean.blogspot.com/2010/03/blogger-buzz-blogger-integrates-with.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7856726257089876870/posts/default/9116249163532543020'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7856726257089876870/posts/default/9116249163532543020'/><link rel='alternate' type='text/html' href='http://programmingocean.blogspot.com/2010/03/blogger-buzz-blogger-integrates-with.html' title='Blogger Buzz: Blogger integrates with Amazon Associates'/><author><name>murukan</name><uri>http://www.blogger.com/profile/07265681234394455890</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='27' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh5PYOrtR0a6mNzWkDDqOsFHzJgR5cDoeSWXyw03RsMIEm3TiAOVu77g7C8pWSur1HVFQ99RfM6m2Qng0fygNfqEjtg4hpiPvx1mMtRNnzED2ztg7GTyD8wezgTR7BBqw/s220/DSCF2627[1]c.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7856726257089876870.post-1513803443242158392</id><published>2010-03-23T02:39:00.000-07:00</published><updated>2010-05-14T09:22:27.711-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="SQL Server"/><title type='text'>Compute By clause in SQL Server</title><content type='html'>&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;style&gt; &lt;!--  /* Font Definitions */  @font-face  {font-family:Verdana;  panose-1:2 11 6 4 3 5 4 4 2 4;  mso-font-charset:0;  mso-generic-font-family:swiss;  mso-font-pitch:variable;  mso-font-signature:536871559 0 0 0 415 0;}  /* Style Definitions */  p.MsoNormal, li.MsoNormal, div.MsoNormal  {mso-style-parent:&quot;&quot;;  margin:0in;  margin-bottom:.0001pt;  mso-pagination:widow-orphan;  font-size:12.0pt;  font-family:&quot;Times New Roman&quot;;  mso-fareast-font-family:&quot;Times New Roman&quot;;} @page Section1  {size:8.5in 11.0in;  margin:1.0in 1.25in 1.0in 1.25in;  mso-header-margin:.5in;  mso-footer-margin:.5in;  mso-paper-source:0;} div.Section1  {page:Section1;} --&gt; &lt;/style&gt;&lt;br /&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:Verdana;font-size:85%;&quot;&gt;We can use this clause to sum/count/avg/max/min so on. This clause will give you the output as detail and summary which is based on the fields you want to summarize.&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:Verdana;font-size:85%;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:Verdana;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;&lt;pre class=&quot;brush: sql&quot;&gt;&lt;br /&gt;select * &lt;br /&gt;from #temp &lt;br /&gt;order by student &lt;br /&gt;compute sum(marks) by student&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;code&gt;&lt;/code&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;code&gt;&lt;/code&gt;&lt;/p&gt;&lt;code&gt;&lt;/code&gt;&lt;code&gt;&lt;/code&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;code&gt;&lt;span style=&quot;font-family:Verdana;font-size:85%;&quot;&gt;&lt;/span&gt;&lt;/code&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:Verdana;font-size:85%;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:Verdana;font-size:85%;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:Verdana;font-size:85%;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:Verdana;font-size:85%;&quot;&gt;in above compute by clause, you must specify the field you want to sum in &lt;b&gt;Compute&lt;/b&gt; clause and specify the field in &lt;b&gt;By&lt;/b&gt; clause based on which field you need to compute.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:Verdana;font-size:85%;&quot;&gt;Very important thing is you must specify the &lt;b&gt;Order By&lt;/b&gt; clause in which specify the fileds whatever you specify in By clause in Compute clause. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:Verdana;font-size:85%;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:Verdana;font-size:85%;&quot;&gt;The output of above query is,&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:Verdana;font-size:85%;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjmmX1FR1al0Dz6nrN0pSSJQ32VVVULcuuxHx7y1BKz2asyJhaTNcSmkep0UN0aS9NSz-j7RYas1ldPguL6xe6Ba_TOiztN6CkPNCtkyC5msFWlR3TfPdTeQS9w1078pwmcGuahSUenQryD/s1600-h/ComputeBy_Query_Output.bmp&quot;&gt;&lt;img id=&quot;BLOGGER_PHOTO_ID_5451763522162597298&quot; style=&quot;DISPLAY: block; MARGIN: 0px auto 10px; WIDTH: 251px; CURSOR: pointer; HEIGHT: 400px; TEXT-ALIGN: center&quot; alt=&quot;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjmmX1FR1al0Dz6nrN0pSSJQ32VVVULcuuxHx7y1BKz2asyJhaTNcSmkep0UN0aS9NSz-j7RYas1ldPguL6xe6Ba_TOiztN6CkPNCtkyC5msFWlR3TfPdTeQS9w1078pwmcGuahSUenQryD/s400/ComputeBy_Query_Output.bmp&quot; border=&quot;0&quot; /&gt;&lt;span style=&quot;font-family:Verdana;font-size:85%;&quot;&gt;&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;font-family:Verdana;font-size:85%;&quot;&gt;&lt;a onblur=&quot;try  {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjIgnDRAhLMOfzJbMHv-oX4vmgVzZ5vcP_yYw2SYjjuj2tvohNji9FN3wQaOaOdRXY6q4ExhoiZCSwh5cBVaFzGLzTdP9-aC4Dx64sMCa2g5r11NnpXnqVAgEQB9GkBCFHnUNXP8CvminbO/s1600-h/Compute_By_Avg.bmp&quot;&gt;&lt;br /&gt;&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:Verdana;font-size:85%;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:Verdana;font-size:85%;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:Verdana;font-size:85%;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:Verdana;font-size:85%;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:Verdana;font-size:85%;&quot;&gt;When we try with max,min,avg, the query and output would be as shown below,&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:Verdana;font-size:85%;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:Verdana;font-size:85%;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:Verdana;font-size:85%;&quot;&gt;&lt;strong&gt;Using Max()&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:Verdana;font-size:85%;&quot;&gt;&lt;pre class=&quot;brush: sql&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:&#39;;font-size:85%;color:blue;&quot;&gt;select&lt;/span&gt;&lt;span style=&quot;font-family:&#39;;font-size:85%;&quot;&gt; &lt;span style=&quot;color:gray;&quot;&gt;*&lt;/span&gt; &lt;span style=&quot;color:blue;&quot;&gt;from&lt;/span&gt; #temp&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:&#39;;font-size:85%;color:blue;&quot;&gt;order&lt;/span&gt;&lt;span style=&quot;font-family:&#39;;font-size:85%;&quot;&gt; &lt;span style=&quot;color:blue;&quot;&gt;by&lt;/span&gt; student&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:&#39;;font-size:85%;color:blue;&quot;&gt;compute&lt;/span&gt;&lt;span style=&quot;font-family:&#39;;font-size:85%;&quot;&gt;&lt;span style=&quot;font-size:0;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color:fuchsia;&quot;&gt;max&lt;/span&gt;&lt;span style=&quot;color:gray;&quot;&gt;(&lt;/span&gt;marks&lt;span style=&quot;color:gray;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color:blue;&quot;&gt;by&lt;/span&gt; student&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:&#39;;font-size:85%;&quot;&gt;&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;&lt;code&gt;&lt;/code&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:Verdana;font-size:85%;&quot;&gt;&lt;a onblur=&quot;try  {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgv3n2hOvVgDob4550HSOccg0G3dp7xbQEUf0dxM0N10FdMHrqd6J3UoXKiVMYNq8XV6WHDxr6udQ55PDLSXhopeyI7sG-Invm87HHmdh6w65wgcVKu0fwJ5Pm95SW956KwSw6LT1_IkTCm/s1600-h/Compute_By_Max.bmp&quot;&gt;&lt;img id=&quot;BLOGGER_PHOTO_ID_5451764229176078498&quot; style=&quot;DISPLAY: block; MARGIN: 0px auto 10px; WIDTH: 233px; CURSOR: pointer; HEIGHT: 400px; TEXT-ALIGN: center&quot; alt=&quot;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgv3n2hOvVgDob4550HSOccg0G3dp7xbQEUf0dxM0N10FdMHrqd6J3UoXKiVMYNq8XV6WHDxr6udQ55PDLSXhopeyI7sG-Invm87HHmdh6w65wgcVKu0fwJ5Pm95SW956KwSw6LT1_IkTCm/s400/Compute_By_Max.bmp&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:&#39;;font-size:85%;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:&#39;;font-size:85%;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:&#39;;font-size:85%;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:&#39;;font-size:85%;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:Verdana;font-size:85%;&quot;&gt;&lt;strong&gt;Using Min ()&lt;o:p&gt;&lt;/o:p&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:&#39;;font-size:85%;color:blue;&quot;&gt;&lt;code&gt;&lt;/code&gt;&lt;/span&gt;&lt;code&gt;&lt;/code&gt;&lt;/p&gt;&lt;code&gt;&lt;/code&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;color:#0000FF;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;&lt;pre class=&quot;brush: sql&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:&#39;;font-size:85%;color:blue;&quot;&gt;select&lt;/span&gt;&lt;span style=&quot;font-family:&#39;;font-size:85%;&quot;&gt; &lt;span style=&quot;color:gray;&quot;&gt;*&lt;/span&gt; &lt;span style=&quot;color:blue;&quot;&gt;from&lt;/span&gt; #temp&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:&#39;;font-size:85%;color:blue;&quot;&gt;order&lt;/span&gt;&lt;span style=&quot;font-family:&#39;;font-size:85%;&quot;&gt; &lt;span style=&quot;color:blue;&quot;&gt;by&lt;/span&gt; student&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:&#39;;font-size:85%;color:blue;&quot;&gt;compute&lt;/span&gt;&lt;span style=&quot;font-family:&#39;;font-size:85%;&quot;&gt;&lt;span style=&quot;font-size:0;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color:fuchsia;&quot;&gt;min&lt;/span&gt;&lt;span style=&quot;color:gray;&quot;&gt;(&lt;/span&gt;marks&lt;span style=&quot;color:gray;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color:blue;&quot;&gt;by&lt;/span&gt; student&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:&#39;;font-size:85%;&quot;&gt;&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;&lt;code&gt;&lt;/code&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;code&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;/span&gt;&lt;/code&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj8lQ1DbFv-mAkGiTEsU0mSOhc-OnolAPU1ArGP_ct76H3RXwegBvwFsO2CW28L5B1nsUL9Bhs5nEbOoGAOzoUM2yMC1PqZ-ZTeICUu4eRT56CyCyzC5pd-T4ONNCCs_VWlA2DbWecdmfqs/s1600-h/Compute_By_Min.bmp&quot;&gt;&lt;img id=&quot;BLOGGER_PHOTO_ID_5451763881305636530&quot; style=&quot;DISPLAY: block; MARGIN: 0px auto 10px; WIDTH: 232px; CURSOR: pointer; HEIGHT: 400px; TEXT-ALIGN: center&quot; alt=&quot;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj8lQ1DbFv-mAkGiTEsU0mSOhc-OnolAPU1ArGP_ct76H3RXwegBvwFsO2CW28L5B1nsUL9Bhs5nEbOoGAOzoUM2yMC1PqZ-ZTeICUu4eRT56CyCyzC5pd-T4ONNCCs_VWlA2DbWecdmfqs/s400/Compute_By_Min.bmp&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;pre class=&quot;brush: sql&quot;&gt;&lt;span style=&quot;font-family:&#39;;font-size:85%;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:&#39;;font-size:85%;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:&#39;;font-size:85%;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:&#39;;font-size:85%;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:Verdana;font-size:85%;&quot;&gt;&lt;strong&gt;Using Avg()&lt;o:p&gt;&lt;/o:p&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:&#39;;font-size:85%;color:blue;&quot;&gt;&lt;code&gt;&lt;/code&gt;&lt;/span&gt;&lt;code&gt;&lt;/code&gt;&lt;/p&gt;&lt;code&gt;&lt;/code&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:&#39;;font-size:85%;color:blue;&quot;&gt;select&lt;/span&gt;&lt;span style=&quot;font-family:&#39;;font-size:85%;&quot;&gt; &lt;span style=&quot;color:gray;&quot;&gt;*&lt;/span&gt; &lt;span style=&quot;color:blue;&quot;&gt;from&lt;/span&gt; #temp&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:&#39;;font-size:85%;color:blue;&quot;&gt;order&lt;/span&gt;&lt;span style=&quot;font-family:&#39;;font-size:85%;&quot;&gt; &lt;span style=&quot;color:blue;&quot;&gt;by&lt;/span&gt; student&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:&#39;;font-size:85%;color:blue;&quot;&gt;compute&lt;/span&gt;&lt;span style=&quot;font-family:&#39;;font-size:85%;&quot;&gt;&lt;span style=&quot;font-size:0;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color:fuchsia;&quot;&gt;avg&lt;/span&gt;&lt;span style=&quot;color:gray;&quot;&gt;(&lt;/span&gt;marks&lt;span style=&quot;color:gray;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color:blue;&quot;&gt;by&lt;/span&gt; student&lt;/span&gt;&lt;/p&gt;&lt;code&gt;&lt;/code&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;/p&gt;&lt;/pre&gt;&lt;br /&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family:&#39;;font-size:85%;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;span style=&quot;font-family:Verdana;font-size:85%;&quot;&gt;&lt;a onblur=&quot;try  {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjIgnDRAhLMOfzJbMHv-oX4vmgVzZ5vcP_yYw2SYjjuj2tvohNji9FN3wQaOaOdRXY6q4ExhoiZCSwh5cBVaFzGLzTdP9-aC4Dx64sMCa2g5r11NnpXnqVAgEQB9GkBCFHnUNXP8CvminbO/s1600-h/Compute_By_Avg.bmp&quot;&gt;&lt;img id=&quot;BLOGGER_PHOTO_ID_5451764619621047202&quot; style=&quot;DISPLAY: block; MARGIN: 0px auto 10px; WIDTH: 232px; CURSOR: pointer; HEIGHT: 400px; TEXT-ALIGN: center&quot; alt=&quot;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjIgnDRAhLMOfzJbMHv-oX4vmgVzZ5vcP_yYw2SYjjuj2tvohNji9FN3wQaOaOdRXY6q4ExhoiZCSwh5cBVaFzGLzTdP9-aC4Dx64sMCa2g5r11NnpXnqVAgEQB9GkBCFHnUNXP8CvminbO/s400/Compute_By_Avg.bmp&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;/span&gt; &lt;p class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;&lt;span style=&quot;font-family:&#39;;font-size:85%;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;/code&gt;</content><link rel='replies' type='application/atom+xml' href='http://programmingocean.blogspot.com/feeds/1513803443242158392/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://programmingocean.blogspot.com/2010/03/compute-by-clause-in-sql-server.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7856726257089876870/posts/default/1513803443242158392'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7856726257089876870/posts/default/1513803443242158392'/><link rel='alternate' type='text/html' href='http://programmingocean.blogspot.com/2010/03/compute-by-clause-in-sql-server.html' title='Compute By clause in SQL Server'/><author><name>murukan</name><uri>http://www.blogger.com/profile/07265681234394455890</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='27' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh5PYOrtR0a6mNzWkDDqOsFHzJgR5cDoeSWXyw03RsMIEm3TiAOVu77g7C8pWSur1HVFQ99RfM6m2Qng0fygNfqEjtg4hpiPvx1mMtRNnzED2ztg7GTyD8wezgTR7BBqw/s220/DSCF2627[1]c.JPG'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjmmX1FR1al0Dz6nrN0pSSJQ32VVVULcuuxHx7y1BKz2asyJhaTNcSmkep0UN0aS9NSz-j7RYas1ldPguL6xe6Ba_TOiztN6CkPNCtkyC5msFWlR3TfPdTeQS9w1078pwmcGuahSUenQryD/s72-c/ComputeBy_Query_Output.bmp" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7856726257089876870.post-7959731186135631495</id><published>2010-03-16T00:34:00.000-07:00</published><updated>2010-06-24T00:18:10.551-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="SQL Server"/><title type='text'>Use of Rowcount in SQL Server</title><content type='html'>&lt;span style=&quot;font-family:verdana;&quot;&gt;We can use &lt;span style=&quot;color: rgb(51, 102, 255);&quot;&gt;rowcoun&lt;/span&gt;t sql property to set the number of rows to be shown in the output.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:verdana;&quot;&gt;for an example,&lt;br /&gt;lets say there are 10 records in a table, if we set the &lt;span style=&quot;color: rgb(51, 102, 255);&quot;&gt;rowcount&lt;/span&gt; to 5 then when retrieve records from that table, only 5 records will be shown.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:verdana;&quot;&gt;if you &lt;span style=&quot;color: rgb(51, 102, 255);&quot;&gt;rowcount&lt;/span&gt; to 0 then all records will be retrieved and shown in output.&lt;/span&gt;&lt;br /&gt;&lt;code&gt;&lt;/code&gt;&lt;ol&gt;&lt;li&gt;&lt;code&gt;SET ROWCOUNT 5&lt;/code&gt;&lt;/li&gt;&lt;li&gt;&lt;code&gt;SELECT ref_num FROM tbl_po_master&lt;/code&gt;&lt;/li&gt;&lt;/ol&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEimxfbaaFWb2DESaZwcHvFgaV8X4XHeHBZfnEa06xnHTmdxVzr4ki_SnOT6BwfjYZ4JaScO07JhOpfG9zx9WUBHdWtOxI99GZl7AlAH-5Op5pFsWhqr1BhB0ilY-XTkxCiEEOGfRUGl35GZ/s1600-h/Rowcount_Query.jpg&quot;&gt;&lt;img style=&quot;margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 331px; height: 255px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEimxfbaaFWb2DESaZwcHvFgaV8X4XHeHBZfnEa06xnHTmdxVzr4ki_SnOT6BwfjYZ4JaScO07JhOpfG9zx9WUBHdWtOxI99GZl7AlAH-5Op5pFsWhqr1BhB0ilY-XTkxCiEEOGfRUGl35GZ/s400/Rowcount_Query.jpg&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5449141343730157842&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style=&quot;font-family:verdana;&quot;&gt;in above example only 5 rows have been retrieved and shown in output as we set the &lt;/span&gt;&lt;span style=&quot;color: rgb(51, 102, 255);font-family:verdana;&quot; &gt;rowcount&lt;/span&gt; to 5.</content><link rel='replies' type='application/atom+xml' href='http://programmingocean.blogspot.com/feeds/7959731186135631495/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://programmingocean.blogspot.com/2010/03/use-of-rowcount-in-sql-server.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7856726257089876870/posts/default/7959731186135631495'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7856726257089876870/posts/default/7959731186135631495'/><link rel='alternate' type='text/html' href='http://programmingocean.blogspot.com/2010/03/use-of-rowcount-in-sql-server.html' title='Use of Rowcount in SQL Server'/><author><name>murukan</name><uri>http://www.blogger.com/profile/07265681234394455890</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='27' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh5PYOrtR0a6mNzWkDDqOsFHzJgR5cDoeSWXyw03RsMIEm3TiAOVu77g7C8pWSur1HVFQ99RfM6m2Qng0fygNfqEjtg4hpiPvx1mMtRNnzED2ztg7GTyD8wezgTR7BBqw/s220/DSCF2627[1]c.JPG'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEimxfbaaFWb2DESaZwcHvFgaV8X4XHeHBZfnEa06xnHTmdxVzr4ki_SnOT6BwfjYZ4JaScO07JhOpfG9zx9WUBHdWtOxI99GZl7AlAH-5Op5pFsWhqr1BhB0ilY-XTkxCiEEOGfRUGl35GZ/s72-c/Rowcount_Query.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7856726257089876870.post-6325609160888221112</id><published>2010-03-16T00:12:00.000-07:00</published><updated>2010-06-24T00:19:57.674-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="SQL Server"/><title type='text'>Get the Table fileds in SQL Server/Oracle</title><content type='html'>In SQL Server you can retreive the field names as shown below,&lt;br /&gt;&lt;pre class=&quot;brush: sql&quot;&gt;&lt;br /&gt;SELECT  name&lt;/code&gt;&lt;/li&gt;&lt;li&gt;&lt;code&gt;FROM syscolumns&lt;/code&gt;&lt;/li&gt;&lt;li&gt;&lt;code&gt;WHERE id = (SELECT id FROM sysobjects WHERE name=&#39;Table_Name&#39;)&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://programmingocean.blogspot.com/feeds/6325609160888221112/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://programmingocean.blogspot.com/2010/03/get-table-fileds-in-sql-serveroracle.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7856726257089876870/posts/default/6325609160888221112'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7856726257089876870/posts/default/6325609160888221112'/><link rel='alternate' type='text/html' href='http://programmingocean.blogspot.com/2010/03/get-table-fileds-in-sql-serveroracle.html' title='Get the Table fileds in SQL Server/Oracle'/><author><name>murukan</name><uri>http://www.blogger.com/profile/07265681234394455890</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='27' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh5PYOrtR0a6mNzWkDDqOsFHzJgR5cDoeSWXyw03RsMIEm3TiAOVu77g7C8pWSur1HVFQ99RfM6m2Qng0fygNfqEjtg4hpiPvx1mMtRNnzED2ztg7GTyD8wezgTR7BBqw/s220/DSCF2627[1]c.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7856726257089876870.post-1907506983853909769</id><published>2010-03-15T23:47:00.000-07:00</published><updated>2010-03-16T00:11:18.519-07:00</updated><title type='text'>Get the parameter list of a Storedprocedure in SQL Server</title><content type='html'>&lt;span style=&quot;font-family: verdana;&quot;&gt;There is way find what are the parameter list for a storedprocedure in sql server rather find them by open individually.&lt;/span&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&lt;/code&gt;&lt;ol&gt;&lt;li&gt;&lt;code&gt;SELECT PARAMETER_NAME,DATA_TYPE,PARAMETER_MODE&lt;/code&gt;&lt;/li&gt;&lt;li&gt;&lt;code&gt;FROM INFORMATION_SCHEMA.PARAMETERS&lt;/code&gt;&lt;/li&gt;&lt;li&gt;&lt;code&gt;WHERE SPECIFIC_NAME=&#39;AddDefaultPropertyDefinitions&#39;&lt;/code&gt;&lt;/li&gt;&lt;/ol&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhJSLUVTR1Fwr3sMONtc5WTvhnCPD6G0UKu3YR8Ip52DhYkTLdeU112hVK68T8wfInjhWySHKTSLLN6woCKLsJarge5FwaLsriqB7gwtKP-khMiBri-4FXNk6Mq5N-TMEEw9qVPqF0iano4/s1600-h/Find_Parameters.jpg&quot;&gt;&lt;img style=&quot;margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 400px; height: 153px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhJSLUVTR1Fwr3sMONtc5WTvhnCPD6G0UKu3YR8Ip52DhYkTLdeU112hVK68T8wfInjhWySHKTSLLN6woCKLsJarge5FwaLsriqB7gwtKP-khMiBri-4FXNk6Mq5N-TMEEw9qVPqF0iano4/s400/Find_Parameters.jpg&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5449125099047979570&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;span style=&quot;font-family: verdana;&quot;&gt;&lt;br /&gt;Hope this would be very useful for developers who are working with database.&lt;/span&gt;</content><link rel='replies' type='application/atom+xml' href='http://programmingocean.blogspot.com/feeds/1907506983853909769/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://programmingocean.blogspot.com/2010/03/get-parameter-list-of-storedprocedure.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7856726257089876870/posts/default/1907506983853909769'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7856726257089876870/posts/default/1907506983853909769'/><link rel='alternate' type='text/html' href='http://programmingocean.blogspot.com/2010/03/get-parameter-list-of-storedprocedure.html' title='Get the parameter list of a Storedprocedure in SQL Server'/><author><name>murukan</name><uri>http://www.blogger.com/profile/07265681234394455890</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='27' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh5PYOrtR0a6mNzWkDDqOsFHzJgR5cDoeSWXyw03RsMIEm3TiAOVu77g7C8pWSur1HVFQ99RfM6m2Qng0fygNfqEjtg4hpiPvx1mMtRNnzED2ztg7GTyD8wezgTR7BBqw/s220/DSCF2627[1]c.JPG'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhJSLUVTR1Fwr3sMONtc5WTvhnCPD6G0UKu3YR8Ip52DhYkTLdeU112hVK68T8wfInjhWySHKTSLLN6woCKLsJarge5FwaLsriqB7gwtKP-khMiBri-4FXNk6Mq5N-TMEEw9qVPqF0iano4/s72-c/Find_Parameters.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7856726257089876870.post-488063510423942646</id><published>2010-03-15T23:19:00.001-07:00</published><updated>2010-03-15T23:43:58.327-07:00</updated><title type='text'>Procedure for Split the words in SQL Sever</title><content type='html'>&lt;span style=&quot;font-family:verdana;&quot;&gt;Here it is the procedure to &lt;/span&gt;&lt;span style=&quot;font-family:verdana;&quot;&gt;Split the words using comma seperator. still you can use different character for split instead of comma(&#39;,&#39;). Here i m using &#39;E,l,e,p,h,a,n,t&#39; as word with comma characters.&lt;br /&gt;so the output should be  &#39;E&#39;,&#39;l&#39;,&#39;e&#39;,&#39;p&#39;,&#39;h&#39;,&#39;a&#39;,&#39;n&#39;,&#39;t&#39;.&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family:verdana;&quot;&gt;&lt;code&gt;&lt;/code&gt;&lt;/span&gt;&lt;ol&gt;&lt;li&gt;&lt;span style=&quot;font-family:verdana;&quot;&gt;&lt;code&gt;Declare @name as varchar(20)&lt;/code&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style=&quot;font-family:verdana;&quot;&gt;&lt;code&gt;Declare @i as int&lt;/code&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style=&quot;font-family:verdana;&quot;&gt;&lt;code&gt;Declare @char as char&lt;/code&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style=&quot;font-family:verdana;&quot;&gt;&lt;code&gt;Declare @word as varchar(20)&lt;/code&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style=&quot;font-family:verdana;&quot;&gt;&lt;code&gt;select @name=&#39;E,l,e,p,h,a,n,t&#39;&lt;/code&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style=&quot;font-family:verdana;&quot;&gt;&lt;code&gt;set @word=&#39;&#39;&lt;/code&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style=&quot;font-family:verdana;&quot;&gt;&lt;code&gt;set @i=1&lt;/code&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style=&quot;font-family:verdana;&quot;&gt;&lt;code&gt;while @i&lt;=len(@name)     begin         set @char=substring(@name,@i,1)             if @char&lt;&gt; &#39;,&#39;&lt;/code&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style=&quot;font-family:verdana;&quot;&gt;&lt;code&gt;                begin&lt;/code&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style=&quot;font-family:verdana;&quot;&gt;&lt;code&gt;                    set @word=@word+@char &lt;/code&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style=&quot;font-family:verdana;&quot;&gt;&lt;code&gt;                end&lt;/code&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style=&quot;font-family:verdana;&quot;&gt;&lt;code&gt;            else if (@char=&#39;,&#39; and @i&lt;&gt;len(@name))&lt;/code&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style=&quot;font-family:verdana;&quot;&gt;&lt;code&gt;                begin&lt;/code&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style=&quot;font-family:verdana;&quot;&gt;&lt;code&gt;                    print @word&lt;/code&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style=&quot;font-family:verdana;&quot;&gt;&lt;code&gt;                    set @word=&#39;&#39;&lt;/code&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style=&quot;font-family:verdana;&quot;&gt;&lt;code&gt;                end&lt;/code&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style=&quot;font-family:verdana;&quot;&gt;&lt;code&gt;            ---Print the last word&lt;/code&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style=&quot;font-family:verdana;&quot;&gt;&lt;code&gt;            if @i=len(@name)&lt;/code&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style=&quot;font-family:verdana;&quot;&gt;&lt;code&gt;                begin&lt;/code&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style=&quot;font-family:verdana;&quot;&gt;&lt;code&gt;                    print @word&lt;/code&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style=&quot;font-family:verdana;&quot;&gt;&lt;code&gt;                end&lt;/code&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style=&quot;font-family:verdana;&quot;&gt;&lt;code&gt;        set @i=@i+1&lt;/code&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style=&quot;font-family:verdana;&quot;&gt;&lt;code&gt;    end&lt;/code&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgOZBePhabmxVdlh8ijLd7mdFgouJtsQ5T8xQrDUccfOqLNMWanV-tj16QLJl7daNjELPRNYcdqw_jbx21sYPolOk0SA-BPc9pBb-xn8lpi8FTbsZY_OmtuBCaMHa7FkEhIEl-_01r9vqxz/s1600-h/Split_Query.jpg&quot;&gt;&lt;img style=&quot;margin: 0pt 0pt 10px 10px; float: right; cursor: pointer; width: 400px; height: 318px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgOZBePhabmxVdlh8ijLd7mdFgouJtsQ5T8xQrDUccfOqLNMWanV-tj16QLJl7daNjELPRNYcdqw_jbx21sYPolOk0SA-BPc9pBb-xn8lpi8FTbsZY_OmtuBCaMHa7FkEhIEl-_01r9vqxz/s400/Split_Query.jpg&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5449115179251295266&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Output of this query would be,&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEidFFlvFZ0yTfTtopcgdJ7SJDCJ12tZuXVDt5GvW-M1aHUVVBn0gJGb2I8iI8M5a0m3cZCpdY3jlM_ZuTa6YKj9KGRgUo4Eu1dmWhk7boy13U74lnK_kzOuCYcSPE7-3U8yARa__c_aSkMt/s1600-h/Split_Result.bmp&quot;&gt;&lt;img style=&quot;margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 61px; height: 176px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEidFFlvFZ0yTfTtopcgdJ7SJDCJ12tZuXVDt5GvW-M1aHUVVBn0gJGb2I8iI8M5a0m3cZCpdY3jlM_ZuTa6YKj9KGRgUo4Eu1dmWhk7boy13U74lnK_kzOuCYcSPE7-3U8yARa__c_aSkMt/s400/Split_Result.bmp&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5449115501508225682&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;</content><link rel='replies' type='application/atom+xml' href='http://programmingocean.blogspot.com/feeds/488063510423942646/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://programmingocean.blogspot.com/2010/03/procedure-for-split-words-in-sql-sever.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7856726257089876870/posts/default/488063510423942646'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7856726257089876870/posts/default/488063510423942646'/><link rel='alternate' type='text/html' href='http://programmingocean.blogspot.com/2010/03/procedure-for-split-words-in-sql-sever.html' title='Procedure for Split the words in SQL Sever'/><author><name>murukan</name><uri>http://www.blogger.com/profile/07265681234394455890</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='27' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh5PYOrtR0a6mNzWkDDqOsFHzJgR5cDoeSWXyw03RsMIEm3TiAOVu77g7C8pWSur1HVFQ99RfM6m2Qng0fygNfqEjtg4hpiPvx1mMtRNnzED2ztg7GTyD8wezgTR7BBqw/s220/DSCF2627[1]c.JPG'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgOZBePhabmxVdlh8ijLd7mdFgouJtsQ5T8xQrDUccfOqLNMWanV-tj16QLJl7daNjELPRNYcdqw_jbx21sYPolOk0SA-BPc9pBb-xn8lpi8FTbsZY_OmtuBCaMHa7FkEhIEl-_01r9vqxz/s72-c/Split_Query.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7856726257089876870.post-6956376305961396495</id><published>2010-03-09T00:04:00.000-08:00</published><updated>2010-03-09T01:19:45.093-08:00</updated><title type='text'>Get the number of the current day of the week in SQL Server</title><content type='html'>&lt;span style=&quot;font-family: verdana;&quot;&gt;In SQL Server there is a built-in function called Datepart() which is takes 2 paramaters which are return date option and date value.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana;&quot;&gt;for the 1st paramater pass the date option as &#39;dw&#39; and for second parameter pass the date value as shown below,&lt;/span&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt; SET dateformat dmy&lt;/span&gt;&lt;/code&gt; &lt;code style=&quot;font-weight: bold;&quot;&gt; Select DATENAME(dw,&#39;09/03/2010&#39;) Day_Name,datepart(dw,&#39;09/03/2010&#39;) which_day_ofWeek&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana;&quot;&gt;if you execute this query, output will be,&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiBC1VD15Dt4GIcc4X73koiCquIG_dbj7TCG7z40hVXJ18TuoDcZ1fOcDBd3k60bcK0H78WQc8Yqm2Tlz-kfDI6baT1LZLdu0uIcNupvyWVU-GnGp3aENScgryx8EIV3OPIVQWOub3kj0bK/s1600-h/Get_Weekday_Number.bmp&quot;&gt;&lt;img style=&quot;margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 400px; height: 91px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiBC1VD15Dt4GIcc4X73koiCquIG_dbj7TCG7z40hVXJ18TuoDcZ1fOcDBd3k60bcK0H78WQc8Yqm2Tlz-kfDI6baT1LZLdu0uIcNupvyWVU-GnGp3aENScgryx8EIV3OPIVQWOub3kj0bK/s400/Get_Weekday_Number.bmp&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5446551439477512274&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana;&quot;&gt;in SQL Server, by default the week start with &#39;Monday&#39; which is 1. so in this example, the week is Tuesday. So the number of the Tuesday is 2.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana;&quot;&gt;You can check, what is default start week number by using &lt;/span&gt;&lt;span style=&quot;font-weight: bold; font-family: verdana;&quot;&gt;@@DATEFIRST.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;code&gt;                        &lt;span style=&quot;font-weight: bold;&quot;&gt;Select @@DATEFIRST&lt;/span&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh7YGZE5k9jphrCotkr_K6kdkkee0Hsi7CJK5JY28F1gWdqkubCjBtG2iLDS9lRkQ3xd4SoPnJl2AF_hOgCi2LwAOzqyxlWNDfqcyVy6uM0B4LQ0xzpBr7pnzjDR4qsgysatvXjuJKijW2m/s1600-h/DATEFIRST.jpg&quot;&gt;&lt;img style=&quot;margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 310px; height: 176px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh7YGZE5k9jphrCotkr_K6kdkkee0Hsi7CJK5JY28F1gWdqkubCjBtG2iLDS9lRkQ3xd4SoPnJl2AF_hOgCi2LwAOzqyxlWNDfqcyVy6uM0B4LQ0xzpBr7pnzjDR4qsgysatvXjuJKijW2m/s400/DATEFIRST.jpg&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5446552961251322114&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;span style=&quot;font-family: verdana;&quot;&gt;Since SQL Server default start week number is 1(Monday), it is giving 1 in output.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana;&quot;&gt;Default Value for Week in SQL Server,&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-size:130%;&quot;&gt;                                  Monday       - 1&lt;br /&gt;                                  Tuesday      - 2&lt;br /&gt;                                  Wednesday - 3&lt;br /&gt;                                  Thursday    - 4&lt;br /&gt;                                  Friday          - 5&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-size:130%;&quot;&gt;                                  Saturday     - 6&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-size:130%;&quot;&gt;                                  Sunday        - 7&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana;&quot;&gt;But You can change the default start week number as shown below,&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;font-size:130%;&quot; &gt;&lt;code&gt;              SET datefirst &lt;span style=&quot;font-family:Georgia,serif;&quot;&gt;7&lt;/span&gt;&lt;/code&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana;&quot;&gt;So here we make the start week number to 7 which is sunday.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana;&quot;&gt;After set the Datefirst to 7(sunday) and execute the first query you will get as &lt;/span&gt;&lt;span style=&quot;font-family: verdana;&quot;&gt;shown below,&lt;/span&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;SET datefirst 7&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;SET dateformat dmy&lt;/span&gt; &lt;span style=&quot;font-weight: bold;&quot;&gt;Select DATENAME(dw,&#39;09/03/2010&#39;)    Day_Name,datepart(dw,&#39;09/03/2010&#39;) which_day_ofWeek&lt;/span&gt; &lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiwfQTrjqqtvushtVQlqQKGdi7cJrMHpdODFpt4Gp9Us8CZputtcKrZx6sLoQavWvESwr2WijOibVTMVLoXQo99pLfSLdWsfLvr8VNDjuJkNbRI0MTH9z0dM1NnDRwuJzJlKoDw0hZ4F8tN/s1600-h/DATEFIRST_Query.jpg&quot;&gt;&lt;img style=&quot;margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 400px; height: 97px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiwfQTrjqqtvushtVQlqQKGdi7cJrMHpdODFpt4Gp9Us8CZputtcKrZx6sLoQavWvESwr2WijOibVTMVLoXQo99pLfSLdWsfLvr8VNDjuJkNbRI0MTH9z0dM1NnDRwuJzJlKoDw0hZ4F8tN/s400/DATEFIRST_Query.jpg&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5446556972947173778&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;Now if you see the output, it shows 3. because now week start from Sunday instead of Monday. That is the reason why now week number became 3.</content><link rel='replies' type='application/atom+xml' href='http://programmingocean.blogspot.com/feeds/6956376305961396495/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://programmingocean.blogspot.com/2010/03/get-number-of-current-day-of-week-in.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7856726257089876870/posts/default/6956376305961396495'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7856726257089876870/posts/default/6956376305961396495'/><link rel='alternate' type='text/html' href='http://programmingocean.blogspot.com/2010/03/get-number-of-current-day-of-week-in.html' title='Get the number of the current day of the week in SQL Server'/><author><name>murukan</name><uri>http://www.blogger.com/profile/07265681234394455890</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='27' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh5PYOrtR0a6mNzWkDDqOsFHzJgR5cDoeSWXyw03RsMIEm3TiAOVu77g7C8pWSur1HVFQ99RfM6m2Qng0fygNfqEjtg4hpiPvx1mMtRNnzED2ztg7GTyD8wezgTR7BBqw/s220/DSCF2627[1]c.JPG'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiBC1VD15Dt4GIcc4X73koiCquIG_dbj7TCG7z40hVXJ18TuoDcZ1fOcDBd3k60bcK0H78WQc8Yqm2Tlz-kfDI6baT1LZLdu0uIcNupvyWVU-GnGp3aENScgryx8EIV3OPIVQWOub3kj0bK/s72-c/Get_Weekday_Number.bmp" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7856726257089876870.post-2277406883921098070</id><published>2010-03-08T22:56:00.000-08:00</published><updated>2010-03-09T00:01:44.068-08:00</updated><title type='text'>Get the Weekday Name in SQL Server</title><content type='html'>There is a built-in function call &lt;span style=&quot;color: rgb(51, 102, 255);&quot;&gt;DateName()&lt;/span&gt; in SQL Server to get the Weekday Name.&lt;br /&gt;This function takes 2 parameters in which first is return date option whereas second one date value from which you want to get the weekday name.&lt;br /&gt;To get the weekday name you have to specify the date option as &lt;span style=&quot;font-weight: bold;&quot;&gt;&#39;dw&#39;&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;for example,&lt;br /&gt;&lt;code&gt;&lt;br /&gt;set dateformat dmy&lt;br /&gt;SELECT DATENAME(dw,&#39;09/03/2010&#39;) Weekday&lt;br /&gt;&lt;br /&gt;&lt;/code&gt;in this example &#39;09&#39; is day of march. so if you use this sql function as i given above, it will return the exact name of the weekday.&lt;br /&gt;&lt;br /&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiLg_v6M9b3tpdvT5LSpntQVTQZQoQbxyxuOrVcLok3040fWrn7sFF9yNYDBwqiv4Mj_BLNgzavMwwn68JYjIMXXsQrtxSh5TJ4SJhwPoNWoIZLd6fEoNnDGQo6EQpGYUHWPi5C_YRUs1yg/s1600-h/Get_WeekName.jpg&quot;&gt;&lt;img style=&quot;margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 142px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiLg_v6M9b3tpdvT5LSpntQVTQZQoQbxyxuOrVcLok3040fWrn7sFF9yNYDBwqiv4Mj_BLNgzavMwwn68JYjIMXXsQrtxSh5TJ4SJhwPoNWoIZLd6fEoNnDGQo6EQpGYUHWPi5C_YRUs1yg/s320/Get_WeekName.jpg&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5446529852017016242&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;br /&gt;in output, it is give you week day name.</content><link rel='replies' type='application/atom+xml' href='http://programmingocean.blogspot.com/feeds/2277406883921098070/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://programmingocean.blogspot.com/2010/03/get-weekday-name-in-sql-server.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7856726257089876870/posts/default/2277406883921098070'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7856726257089876870/posts/default/2277406883921098070'/><link rel='alternate' type='text/html' href='http://programmingocean.blogspot.com/2010/03/get-weekday-name-in-sql-server.html' title='Get the Weekday Name in SQL Server'/><author><name>murukan</name><uri>http://www.blogger.com/profile/07265681234394455890</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='27' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh5PYOrtR0a6mNzWkDDqOsFHzJgR5cDoeSWXyw03RsMIEm3TiAOVu77g7C8pWSur1HVFQ99RfM6m2Qng0fygNfqEjtg4hpiPvx1mMtRNnzED2ztg7GTyD8wezgTR7BBqw/s220/DSCF2627[1]c.JPG'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiLg_v6M9b3tpdvT5LSpntQVTQZQoQbxyxuOrVcLok3040fWrn7sFF9yNYDBwqiv4Mj_BLNgzavMwwn68JYjIMXXsQrtxSh5TJ4SJhwPoNWoIZLd6fEoNnDGQo6EQpGYUHWPi5C_YRUs1yg/s72-c/Get_WeekName.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7856726257089876870.post-1190914964095447681</id><published>2010-03-08T00:34:00.000-08:00</published><updated>2010-03-08T00:41:53.572-08:00</updated><title type='text'>How to get the month name in SQL Server</title><content type='html'>&lt;span style=&quot;font-family:verdana;&quot;&gt;There is a built-in function called &lt;span style=&quot;font-weight: bold;&quot;&gt;datename()&lt;/span&gt; for find the month name from given date.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:verdana;&quot;&gt;for example:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhtNvDjGSYfT_3ceSt6rzTPZTJFLdYo5EGNQCua6C824GaQHsdLdtmeOYoYLKfY_fBVHLLY8YQGzH2xAf1uZzwbWOziZsQU429PU8-ntn5jr3-MZyP2euQgBWP9yjMcTB6cgsFYgFxA1FPB/s1600-h/GetName.jpg&quot;&gt;&lt;img style=&quot;margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 155px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhtNvDjGSYfT_3ceSt6rzTPZTJFLdYo5EGNQCua6C824GaQHsdLdtmeOYoYLKfY_fBVHLLY8YQGzH2xAf1uZzwbWOziZsQU429PU8-ntn5jr3-MZyP2euQgBWP9yjMcTB6cgsFYgFxA1FPB/s320/GetName.jpg&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5446180384608240898&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;</content><link rel='replies' type='application/atom+xml' href='http://programmingocean.blogspot.com/feeds/1190914964095447681/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://programmingocean.blogspot.com/2010/03/how-to-get-month-name-in-sql-server.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7856726257089876870/posts/default/1190914964095447681'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7856726257089876870/posts/default/1190914964095447681'/><link rel='alternate' type='text/html' href='http://programmingocean.blogspot.com/2010/03/how-to-get-month-name-in-sql-server.html' title='How to get the month name in SQL Server'/><author><name>murukan</name><uri>http://www.blogger.com/profile/07265681234394455890</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='27' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh5PYOrtR0a6mNzWkDDqOsFHzJgR5cDoeSWXyw03RsMIEm3TiAOVu77g7C8pWSur1HVFQ99RfM6m2Qng0fygNfqEjtg4hpiPvx1mMtRNnzED2ztg7GTyD8wezgTR7BBqw/s220/DSCF2627[1]c.JPG'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhtNvDjGSYfT_3ceSt6rzTPZTJFLdYo5EGNQCua6C824GaQHsdLdtmeOYoYLKfY_fBVHLLY8YQGzH2xAf1uZzwbWOziZsQU429PU8-ntn5jr3-MZyP2euQgBWP9yjMcTB6cgsFYgFxA1FPB/s72-c/GetName.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7856726257089876870.post-6786065114429359762</id><published>2010-03-05T00:08:00.000-08:00</published><updated>2010-03-05T01:03:02.056-08:00</updated><title type='text'>Get the Column data in a single row with comma separator in SQL</title><content type='html'>&lt;span style=&quot;font-family:verdana;&quot;&gt;In this post i thought to expalin how to get one column data in a single row with comma separator. as i shown shown below a table have one column call Choice which have 4 rows.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEifqOvLkU7-tTbNvPNrlQjeJsBYZFC1-pcwMKqxERa2fAVIKRnGbfHQVfb1xmhFPliL2_wp4zusW7aYXQyIFSLHxH60AINbqM_v1xgfhZ9dMwTeuOOcOa5r_V1cYqc_WZP0RXLb1Ri5NvAb/s1600-h/Before_COALESCE_Function1.jpg&quot;&gt;&lt;img style=&quot;margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 296px; height: 320px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEifqOvLkU7-tTbNvPNrlQjeJsBYZFC1-pcwMKqxERa2fAVIKRnGbfHQVfb1xmhFPliL2_wp4zusW7aYXQyIFSLHxH60AINbqM_v1xgfhZ9dMwTeuOOcOa5r_V1cYqc_WZP0RXLb1Ri5NvAb/s320/Before_COALESCE_Function1.jpg&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5445069646308827746&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;br /&gt;So our task is how to bring up all these 4 rows into one single row with comma separator.&lt;br /&gt;We can do this in 2 methods,&lt;br /&gt;&lt;ol style=&quot;font-style: italic; color: rgb(153, 0, 0);&quot;&gt;&lt;li&gt;Using COALESCE() function&lt;/li&gt;&lt;li&gt;Using ISNULL() Function&lt;/li&gt;&lt;/ol&gt;&lt;br /&gt;Actually both are playing same role.&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;1. Using COALESCE() function&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;As shown below in the SQL Query below, COALESCE() function takes 2 parameters.&lt;br /&gt;It is check whether passed field value is Null or not if it is null then place with blank whereas if the field value is not null then concatenate value with comma.&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgG03r_p7QE_q_G7GTS89Uq0cO6xM_tC0SSm_jXb0TcZn5ENeMJImYN_h9-w2XkRSDz_Au0EPwu9QJVvyKPRxAkoU9o-wVFGa68_KzuuWX9b5BqKnPpLlkZYnohbS8lx3wEhSy0pooVrCnZ/s1600-h/COALESCE_Function1.jpg&quot;&gt;&lt;img style=&quot;margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 380px; height: 340px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgG03r_p7QE_q_G7GTS89Uq0cO6xM_tC0SSm_jXb0TcZn5ENeMJImYN_h9-w2XkRSDz_Au0EPwu9QJVvyKPRxAkoU9o-wVFGa68_KzuuWX9b5BqKnPpLlkZYnohbS8lx3wEhSy0pooVrCnZ/s320/COALESCE_Function1.jpg&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5445070520492785954&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;2. Using ISNULL() Function&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;This query also working similar to COALESCE() function.&lt;br /&gt;&lt;br /&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgskSoA7i7DLHwFnosWy4vIqkEfHHOdSe57yQRX24TY6IEgc0qPkJD4ILf8ZPvjisB_ddA6y1tW5771Vx6HCXVO6jx1UnE0THojaA2N67oZ97AdZ-9CgOvPb5Fi8WlQzn08k6QzFmjvjDZM/s1600-h/ISNULL_Function1.jpg&quot;&gt;&lt;img style=&quot;margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 429px; height: 371px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgskSoA7i7DLHwFnosWy4vIqkEfHHOdSe57yQRX24TY6IEgc0qPkJD4ILf8ZPvjisB_ddA6y1tW5771Vx6HCXVO6jx1UnE0THojaA2N67oZ97AdZ-9CgOvPb5Fi8WlQzn08k6QzFmjvjDZM/s320/ISNULL_Function1.jpg&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5445070932781685170&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;br /&gt;here  value &#39;A&#39; repeating twice. so how to get distinct value from this?&lt;br /&gt;here it is the SQL query for that,&lt;br /&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiP9s5r2U5hwW3V1WxfnEt3kkcbivAJtd4_dGYJq63Zivy-WySBMGMGvX9Z80l8P4Plnh3MhDuiMlyr9U3DAKbc5jqEsHqv7kqxEgdopG7dLvh4eLFYivpEa9EYnVNOnH2Ctyk60KbB8rEp/s1600-h/COALESCE_Function1_Distinct.jpg&quot;&gt;&lt;img style=&quot;margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 293px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiP9s5r2U5hwW3V1WxfnEt3kkcbivAJtd4_dGYJq63Zivy-WySBMGMGvX9Z80l8P4Plnh3MhDuiMlyr9U3DAKbc5jqEsHqv7kqxEgdopG7dLvh4eLFYivpEa9EYnVNOnH2Ctyk60KbB8rEp/s320/COALESCE_Function1_Distinct.jpg&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5445071832468692610&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;We just write subquery to filter only distinct values and using that as a Table for Outer query.&lt;br /&gt;So here only gives A,B,C.</content><link rel='replies' type='application/atom+xml' href='http://programmingocean.blogspot.com/feeds/6786065114429359762/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://programmingocean.blogspot.com/2010/03/get-column-data-in-single-row-with.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7856726257089876870/posts/default/6786065114429359762'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7856726257089876870/posts/default/6786065114429359762'/><link rel='alternate' type='text/html' href='http://programmingocean.blogspot.com/2010/03/get-column-data-in-single-row-with.html' title='Get the Column data in a single row with comma separator in SQL'/><author><name>murukan</name><uri>http://www.blogger.com/profile/07265681234394455890</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='27' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh5PYOrtR0a6mNzWkDDqOsFHzJgR5cDoeSWXyw03RsMIEm3TiAOVu77g7C8pWSur1HVFQ99RfM6m2Qng0fygNfqEjtg4hpiPvx1mMtRNnzED2ztg7GTyD8wezgTR7BBqw/s220/DSCF2627[1]c.JPG'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEifqOvLkU7-tTbNvPNrlQjeJsBYZFC1-pcwMKqxERa2fAVIKRnGbfHQVfb1xmhFPliL2_wp4zusW7aYXQyIFSLHxH60AINbqM_v1xgfhZ9dMwTeuOOcOa5r_V1cYqc_WZP0RXLb1Ri5NvAb/s72-c/Before_COALESCE_Function1.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7856726257089876870.post-4309985939650527767</id><published>2010-02-26T00:55:00.000-08:00</published><updated>2010-02-26T01:10:39.220-08:00</updated><title type='text'>Get the Server Name in SQL Server</title><content type='html'>We can get the Connected Sql Server Name using the Built-in function SQL Server as shown below,&lt;br /&gt;&lt;br /&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhFd2fW996FMZCOffFCkUucu1ufUYOKuKA2sskEp46f_svel542Tsxl1SJ920eLPWu2S4qCBwNf5PpQud2C267Sthp_S-3wu_0WA_CuI51S16aWY78GMaJUvUtmHAkfWQsNvAe6ANPgimtR/s1600-h/Server_name.jpg&quot;&gt;&lt;img style=&quot;margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 385px; height: 86px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhFd2fW996FMZCOffFCkUucu1ufUYOKuKA2sskEp46f_svel542Tsxl1SJ920eLPWu2S4qCBwNf5PpQud2C267Sthp_S-3wu_0WA_CuI51S16aWY78GMaJUvUtmHAkfWQsNvAe6ANPgimtR/s320/Server_name.jpg&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5442476262135702322&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhCr4lBgn5crV1BEeJ_ReUGqa2uLdvsaCvcPaWv96QqeylseQsXdrpMLY0JG_8mOBIrc6KWzJTKnEcRSOsCQhllGRHIF0ismQYK27Z14eRSWSQ9pi8mX12fLKdMdCh76-_FcDS-uHWaC-57/s1600-h/Server_Name_Output.jpg&quot;&gt;&lt;img style=&quot;margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 441px; height: 79px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhCr4lBgn5crV1BEeJ_ReUGqa2uLdvsaCvcPaWv96QqeylseQsXdrpMLY0JG_8mOBIrc6KWzJTKnEcRSOsCQhllGRHIF0ismQYK27Z14eRSWSQ9pi8mX12fLKdMdCh76-_FcDS-uHWaC-57/s320/Server_Name_Output.jpg&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5442476525331034146&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;img src=&quot;file:///C:/DOCUME%7E1/ELLA%7E1.MUR/LOCALS%7E1/Temp/moz-screenshot-2.jpg&quot; alt=&quot;&quot; /&gt;</content><link rel='replies' type='application/atom+xml' href='http://programmingocean.blogspot.com/feeds/4309985939650527767/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://programmingocean.blogspot.com/2010/02/get-server-name-in-sql-server.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7856726257089876870/posts/default/4309985939650527767'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7856726257089876870/posts/default/4309985939650527767'/><link rel='alternate' type='text/html' href='http://programmingocean.blogspot.com/2010/02/get-server-name-in-sql-server.html' title='Get the Server Name in SQL Server'/><author><name>murukan</name><uri>http://www.blogger.com/profile/07265681234394455890</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='27' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh5PYOrtR0a6mNzWkDDqOsFHzJgR5cDoeSWXyw03RsMIEm3TiAOVu77g7C8pWSur1HVFQ99RfM6m2Qng0fygNfqEjtg4hpiPvx1mMtRNnzED2ztg7GTyD8wezgTR7BBqw/s220/DSCF2627[1]c.JPG'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhFd2fW996FMZCOffFCkUucu1ufUYOKuKA2sskEp46f_svel542Tsxl1SJ920eLPWu2S4qCBwNf5PpQud2C267Sthp_S-3wu_0WA_CuI51S16aWY78GMaJUvUtmHAkfWQsNvAe6ANPgimtR/s72-c/Server_name.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7856726257089876870.post-8245968158417409384</id><published>2010-02-25T21:36:00.000-08:00</published><updated>2010-02-25T21:48:26.038-08:00</updated><title type='text'>Extract only the Date from DateTime in SQL Server</title><content type='html'>Normaly extarcting date only from DATETIME is commaon and serious problem in SQL SERVER.&lt;br /&gt;Here i have given some common methods to extract on the date from datetime&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;font-family:verdana;font-size:100%;&quot;  &gt;Method 1&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;font-family:verdana;&quot; &gt;------------&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;&lt;span style=&quot;color: rgb(51, 102, 255);font-family:courier new;font-size:100%;&quot;  &gt;SELECT&lt;br /&gt;CAST&lt;br /&gt;(&lt;br /&gt;FLOOR(CAST(GETDATE() AS FLOAT))&lt;br /&gt;AS DATETIME&lt;br /&gt;)&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;font-family:verdana;font-size:100%;&quot;  &gt;Method 2--but it is not correct &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;------------------------------------&lt;br /&gt;This is similar to first method but we have used INT instead of FLOAT . But it will seldom correct. It will not give you the exact date of what you expecting.&lt;br /&gt;So better not to use INT.&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold; color: rgb(51, 102, 255);font-family:courier new;&quot; &gt;SELECT &lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold; color: rgb(51, 102, 255);font-family:courier new;&quot; &gt;CAST&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold; color: rgb(51, 102, 255);font-family:courier new;&quot; &gt;(&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold; color: rgb(51, 102, 255);font-family:courier new;&quot; &gt;FLOOR(CAST(GETDATE() AS INT)) &lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold; color: rgb(51, 102, 255);font-family:courier new;&quot; &gt;AS DATETIME&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold; color: rgb(51, 102, 255);font-family:courier new;&quot; &gt;)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;font-family:verdana;&quot; &gt;Method 3&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;font-family:verdana;&quot; &gt;----------&lt;/span&gt;&lt;br /&gt;i would recommend this method to extract inly date though there are many methods. because this method is very simple and easy.&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(51, 102, 255);font-family:courier new;&quot; &gt;SELECT &lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(51, 102, 255);font-family:courier new;&quot; &gt;CAST&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(51, 102, 255);font-family:courier new;&quot; &gt;(&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(51, 102, 255);font-family:courier new;&quot; &gt;STR(DAY(GETDATE()))+ &#39;/&#39; +&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(51, 102, 255);font-family:courier new;&quot; &gt;STR(MONTH(GETDATE())) +&#39;/&#39;+&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(51, 102, 255);font-family:courier new;&quot; &gt;STR(YEAR(GETDATE())) &lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(51, 102, 255);font-family:courier new;&quot; &gt;AS DATETIME&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(51, 102, 255);font-family:courier new;&quot; &gt;)&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;font-family:verdana;&quot; &gt;Method 4&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;font-family:verdana;&quot; &gt;----------&lt;/span&gt;&lt;br /&gt;In this we have used CONVERT function with 113 date type.&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold; color: rgb(51, 102, 255);font-family:courier new;&quot; &gt;SELECT CONVERT(DATETIME, CONVERT(VARCHAR(12), GETDATE(), 113))&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;font-family:verdana;&quot; &gt;Method 5&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;font-family:verdana;&quot; &gt;----------&lt;/span&gt;&lt;br /&gt;Here we have used DATEDIFF and DATEADD functions together to extract.get the different between specified date and 0 then again add o with output value of DATEDIFF&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold; color: rgb(51, 102, 255);font-family:courier new;&quot; &gt;SELECT DATEADD(dd, DATEDIFF(dd,0,GETDATE()), 0)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;font-family:verdana;&quot; &gt;Method 6&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;font-family:verdana;&quot; &gt;----------&lt;/span&gt;&lt;br /&gt;This is also similar to previous method. But here we have not used DATEADD instead we have used CAST.&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold; color: rgb(51, 102, 255);font-family:courier new;&quot; &gt;SELECTCAST(DATEDIFF(dd,0,GETDATE() as datetime)&lt;/span&gt;</content><link rel='replies' type='application/atom+xml' href='http://programmingocean.blogspot.com/feeds/8245968158417409384/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://programmingocean.blogspot.com/2010/02/extract-onlt-date-from-datetime-in-sql.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7856726257089876870/posts/default/8245968158417409384'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7856726257089876870/posts/default/8245968158417409384'/><link rel='alternate' type='text/html' href='http://programmingocean.blogspot.com/2010/02/extract-onlt-date-from-datetime-in-sql.html' title='Extract only the Date from DateTime in SQL Server'/><author><name>murukan</name><uri>http://www.blogger.com/profile/07265681234394455890</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='27' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh5PYOrtR0a6mNzWkDDqOsFHzJgR5cDoeSWXyw03RsMIEm3TiAOVu77g7C8pWSur1HVFQ99RfM6m2Qng0fygNfqEjtg4hpiPvx1mMtRNnzED2ztg7GTyD8wezgTR7BBqw/s220/DSCF2627[1]c.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7856726257089876870.post-6872833257410578134</id><published>2010-02-10T22:47:00.000-08:00</published><updated>2010-02-10T23:06:29.919-08:00</updated><title type='text'>PIVOT() Function MSSQL Server</title><content type='html'>Introduction&lt;br /&gt;&lt;br /&gt;The PIVOT() function in MS SQL Server is very useful function. This is works like Cross-Tab table in Crystal Report.&lt;br /&gt;&lt;br /&gt;Explanation&lt;br /&gt;&lt;br /&gt;For an instance, as shown below table, we have customer,Yr,Mothname, and TTL columns. The Year column consisting distinct records 2009,2010 year. If you want to show the Year data as each column header name, then you will have to use the PIVOT() function to show the distinct records as column header.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt; SELECT user_id Customer,datepart(“yyyy”,order_date) Yr,datename(month,order_date) [Month] ,&lt;br /&gt;&lt;br /&gt;isnull(sum(total_value),0) TTL&lt;br /&gt;&lt;br /&gt;FROM tbl_po_master group by user_id,datepart(“yyyy”,order_date),datename(month,order_date)&lt;br /&gt;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhFPW1LeSyxx9utR5-p1FCf6Ot1f-VJpv9R4tWlp5eJUf593vLN7vzcQBn3-pgO3rG3XT6FCAHI3h4OK06hSYPaWpr4gx1Eom4AoXKGNf7t2XGeMCpa_WW4pUNQOlw9xb37IW6AYlZNGcpb/s1600-h/Group+Query+Result.jpg&quot;&gt;&lt;img style=&quot;display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 320px; height: 158px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhFPW1LeSyxx9utR5-p1FCf6Ot1f-VJpv9R4tWlp5eJUf593vLN7vzcQBn3-pgO3rG3XT6FCAHI3h4OK06hSYPaWpr4gx1Eom4AoXKGNf7t2XGeMCpa_WW4pUNQOlw9xb37IW6AYlZNGcpb/s320/Group+Query+Result.jpg&quot; border=&quot;0&quot; alt=&quot;&quot;id=&quot;BLOGGER_PHOTO_ID_5436875637675392082&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Using PIVOT() function&lt;br /&gt;&lt;br /&gt;In PIVOT() function, you must specify the column values as shown below,&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;br /&gt;select * from&lt;br /&gt;&lt;br /&gt;(SELECT user_id Customer,datepart(“yyyy”,order_date) Yr,datename(month,order_date) [Month] ,&lt;br /&gt;&lt;br /&gt;isnull(sum(total_value),0) TTL&lt;br /&gt;&lt;br /&gt;FROM tbl_po_master group by user_id,datepart(“yyyy”,order_date),datename(month,order_date)  ) s&lt;br /&gt;&lt;br /&gt;PIVOT&lt;br /&gt;&lt;br /&gt;(&lt;br /&gt;&lt;br /&gt;sum(TTL)&lt;br /&gt;&lt;br /&gt;FOR yr IN ([2009],[2010])&lt;br /&gt;&lt;br /&gt;) p&lt;br /&gt;&lt;br /&gt;order by Customer&lt;br /&gt;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;With our previous query we need to use PIVOT() function and in PIVOT() function have to give the aggregating filed and give the filed/Column name which should show as each column header.&lt;br /&gt;&lt;br /&gt;sum(TTL) à This is the Aggregate field&lt;br /&gt;&lt;br /&gt;FOR yr IN ([2009],[2010])&lt;br /&gt;&lt;br /&gt;Here, give the column name which should show each column header. And give the distinct values of that field as parameter for IN().&lt;br /&gt;&lt;br /&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEixv99BaZ4PmtU_o2MU0BTGjiPDMWTj_9ITUJ3vaKVUW5GfSo4VaoLTkGr-Y3qVCqhgbpPIA7pDn3cbPjnYMke2n43Fp6L3IqJ87zOQIYNlZcwOLhAwHR9NIQ43fZEgzvkE-MBwx7H6l4rd/s1600-h/QUERY_RESULTS.jpg&quot;&gt;&lt;img style=&quot;display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 320px; height: 192px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEixv99BaZ4PmtU_o2MU0BTGjiPDMWTj_9ITUJ3vaKVUW5GfSo4VaoLTkGr-Y3qVCqhgbpPIA7pDn3cbPjnYMke2n43Fp6L3IqJ87zOQIYNlZcwOLhAwHR9NIQ43fZEgzvkE-MBwx7H6l4rd/s320/QUERY_RESULTS.jpg&quot; border=&quot;0&quot; alt=&quot;&quot;id=&quot;BLOGGER_PHOTO_ID_5436876378151915890&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;After executed the above query you would get this result in which you could notice that 2009,2010 column values became as each column header&lt;br /&gt;&lt;br /&gt;In this above query you can give the Month column name instead of Yr column. If try with that you would get the out put as shown below,&lt;br /&gt;&lt;br /&gt;Query:&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;br /&gt;select * from&lt;br /&gt;&lt;br /&gt;(SELECT user_id Customer,datepart(“yyyy”,order_date) Yr,datename(month,order_date) [Month] ,&lt;br /&gt;&lt;br /&gt;isnull(sum(total_value),0) TTL&lt;br /&gt;&lt;br /&gt;FROM tbl_po_master group by user_id,datepart(“yyyy”,order_date),datename(month,order_date)  ) s&lt;br /&gt;&lt;br /&gt;PIVOT&lt;br /&gt;&lt;br /&gt;(&lt;br /&gt;&lt;br /&gt;sum(TTL)&lt;br /&gt;&lt;br /&gt;FOR Month IN ([December],[January])&lt;br /&gt;&lt;br /&gt;) p&lt;br /&gt;&lt;br /&gt;order by Customer&lt;br /&gt;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Output:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEih8oXR7U6Vr23Ch0l4hqR7YquHFrrqnTAXVPCYwXMoe_HyxNRIWdKC7uNXtcn5fWtYFEuTcXbnTYjZkJgEIx8_SUjr5hlHCcSZB7AAwknrbWTi7P7vX2JmmibqV4r0k_IIEwUdDD-3zayO/s1600-h/QUERY_RESULTS2.jpg&quot;&gt;&lt;img style=&quot;display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 320px; height: 112px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEih8oXR7U6Vr23Ch0l4hqR7YquHFrrqnTAXVPCYwXMoe_HyxNRIWdKC7uNXtcn5fWtYFEuTcXbnTYjZkJgEIx8_SUjr5hlHCcSZB7AAwknrbWTi7P7vX2JmmibqV4r0k_IIEwUdDD-3zayO/s320/QUERY_RESULTS2.jpg&quot; border=&quot;0&quot; alt=&quot;&quot;id=&quot;BLOGGER_PHOTO_ID_5436876569299744354&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Now in the output, Month field distinct values (December and January) are showing as column header mean while Yr column values (2009,2010) are showing as row</content><link rel='replies' type='application/atom+xml' href='http://programmingocean.blogspot.com/feeds/6872833257410578134/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://programmingocean.blogspot.com/2010/02/introduction-pivot-function-in-ms-sql.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7856726257089876870/posts/default/6872833257410578134'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7856726257089876870/posts/default/6872833257410578134'/><link rel='alternate' type='text/html' href='http://programmingocean.blogspot.com/2010/02/introduction-pivot-function-in-ms-sql.html' title='PIVOT() Function MSSQL Server'/><author><name>murukan</name><uri>http://www.blogger.com/profile/07265681234394455890</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='27' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh5PYOrtR0a6mNzWkDDqOsFHzJgR5cDoeSWXyw03RsMIEm3TiAOVu77g7C8pWSur1HVFQ99RfM6m2Qng0fygNfqEjtg4hpiPvx1mMtRNnzED2ztg7GTyD8wezgTR7BBqw/s220/DSCF2627[1]c.JPG'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhFPW1LeSyxx9utR5-p1FCf6Ot1f-VJpv9R4tWlp5eJUf593vLN7vzcQBn3-pgO3rG3XT6FCAHI3h4OK06hSYPaWpr4gx1Eom4AoXKGNf7t2XGeMCpa_WW4pUNQOlw9xb37IW6AYlZNGcpb/s72-c/Group+Query+Result.jpg" height="72" width="72"/><thr:total>1</thr:total></entry></feed>