<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Tech Insight ! &#187; DBMS</title>
	<atom:link href="http://techinsight.dhanashree.com/tag/dbms/feed/" rel="self" type="application/rss+xml" />
	<link>http://techinsight.dhanashree.com</link>
	<description>Technical blog on ASP.Net, PHP, Web Development, Web hosting , Database Programming</description>
	<lastBuildDate>Fri, 12 Aug 2011 07:26:49 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>How to make SQL Server 2005 database empty using cursor &amp; sys.objects (Delete All Tables, stored procedures, views &amp; UDF’s)</title>
		<link>http://techinsight.dhanashree.com/how-to-make-sql-server-2005-database-empty-using-cursor-sys-objects-delete-all-tables-stored-procedures-views-udf%e2%80%99s/</link>
		<comments>http://techinsight.dhanashree.com/how-to-make-sql-server-2005-database-empty-using-cursor-sys-objects-delete-all-tables-stored-procedures-views-udf%e2%80%99s/#comments</comments>
		<pubDate>Wed, 24 Feb 2010 09:17:51 +0000</pubDate>
		<dc:creator>kiran</dc:creator>
				<category><![CDATA[SQL server 2005]]></category>
		<category><![CDATA[DBMS]]></category>
		<category><![CDATA[SQL server]]></category>

		<guid isPermaLink="false">http://techinsight.dhanashree.com/how-to-make-sql-server-2005-database-empty-using-cursor-sys-objects-delete-all-tables-stored-procedures-views-udf%e2%80%99s/</guid>
		<description><![CDATA[Understanding sys.objects:
Sys.objects is a system VIEW in SQL Server 2005, for each SQL database there is a separate sys.object view which gets stored within databse itself.
Using Sys.objects returns list of all database objects and its types, type can be either of given below:
DB OBJECT TYPES

F     FOREIGN_KEY_CONSTRAINT
IT    INTERNAL_TABLE
PK    PRIMARY_KEY_CONSTRAINT
S     SYSTEM_TABLE
SQ    SERVICE_QUEUE
U     USER_TABLE
V     VIEW
How to DELETE all User Tables , [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Understanding <span style="text-decoration: underline;">s</span><em><span style="text-decoration: underline;">ys.objects</span></em></strong>:</p>
<p><strong><em>Sys.objects</em></strong> is a system VIEW in SQL Server 2005, for each SQL database there is a separate <strong>sys.object </strong>view which gets stored within databse itself.</p>
<p>Using <strong><em>Sys.objects</em></strong> returns list of all database objects and its types, type can be either of given below:</p>
<p><span style="text-decoration: underline;"><strong>DB OBJECT TYPES<br />
</strong></span></p>
<p>F     FOREIGN_KEY_CONSTRAINT</p>
<p>IT    INTERNAL_TABLE</p>
<p>PK    PRIMARY_KEY_CONSTRAINT</p>
<p>S     SYSTEM_TABLE</p>
<p>SQ    SERVICE_QUEUE</p>
<p>U     USER_TABLE</p>
<p>V     VIEW</p>
<p><span style="text-decoration: underline;"><strong><em>How to DELETE all User Tables , stored procedures , UDF&#8217;s and Views using cursor<br />
</em></strong></span></p>
<p><span style="font-family: Courier New; font-size: 10pt;"><span style="color: blue;">Use</span> [database name]<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;"><span style="color: blue;">declare</span> @q <span style="color: blue;">as</span><br />
<span style="color: blue;">nvarchar</span><span style="color: gray;">(</span><span style="color: fuchsia;">max</span><span style="color: gray;">)<br />
</span></span></p>
<p><span style="font-family: Courier New; font-size: 10pt;"><span style="color: blue;">declare</span> @name <span style="color: blue;">nvarchar</span><span style="color: gray;">(</span><span style="color: fuchsia;">max</span><span style="color: gray;">);<br />
</span></span></p>
<p><span style="font-family: Courier New; font-size: 10pt;"><span style="color: blue;">declare</span> @type <span style="color: blue;">nvarchar</span><span style="color: gray;">(</span><span style="color: fuchsia;">max</span><span style="color: gray;">);<br />
</span></span></p>
<p><span style="font-family: Courier New; font-size: 10pt;"><span style="color: blue;">declare</span> cur <span style="color: blue;">cursor</span><br />
<span style="color: blue;">for<span style="color: #000000;"> </span>select name <span style="color: #000000;"><span style="color: gray;">,</span><span style="color: blue;">type from <span style="color: #008000;">sys.objects <span style="color: #0000ff;">where type <span style="color: #000000;"><span style="color: gray;">in(</span><span style="color: red;">&#8216;p&#8217;</span><span style="color: gray;">,</span><span style="color: red;">&#8216;fn&#8217;</span><span style="color: gray;">,</span><span style="color: red;">&#8216;v&#8217;</span><span style="color: gray;">,</span><span style="color: red;">&#8216;u&#8217;</span><span style="color: gray;">);</span></span></span></span></span></span></span></span></p>
<p><span style="font-family: Courier New; font-size: 10pt;"><span style="color: blue;">open</span> cur<span style="color: gray;">;<br />
</span></span></p>
<p><span style="font-family: Courier New; font-size: 10pt;"><span style="color: blue;">fetch</span> next <span style="color: blue;">from</span> cur <span style="color: blue;">into</span> @name<span style="color: gray;">,</span>@type </span></p>
<p><span style="font-family: Courier New; font-size: 10pt;"><span style="color: #0000ff;">while <span style="color: #ff00ff;">@@fetch_status <span style="color: #000000;"><span style="color: gray;">=</span> 0</span></span></span></span></p>
<p><span style="font-family: Courier New; font-size: 10pt;"><span style="color: #0000ff;"><span style="color: #ff00ff;"><span style="color: #000000;"><span style="color: #0000ff;">begin</span></span></span></span></span></p>
<p><span style="font-family: Courier New; font-size: 10pt;"><span style="color: blue;">if</span><span style="color: gray;">(</span>@type<span style="color: gray;">=</span><span style="color: red;">&#8216;p&#8217;</span><span style="color: gray;">)<br />
</span></span></p>
<p><span style="color: blue; font-family: Courier New; font-size: 10pt;">begin<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;"><span style="color: blue;">set</span> @q<span style="color: gray;">=</span>N<span style="color: red;">&#8216;drop procedure &#8216;</span><span style="color: red;"> </span><span style="color: gray;">+</span> @name<span style="color: gray;">;<br />
</span></span></p>
<p><span style="color: blue; font-family: Courier New; font-size: 10pt;">end<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;"><span style="color: blue;">if</span><span style="color: gray;">(</span>@type<span style="color: gray;">=</span><span style="color: red;">&#8216;fn&#8217;</span><span style="color: gray;">)<br />
</span></span></p>
<p><span style="color: blue; font-family: Courier New; font-size: 10pt;">begin</span></p>
<p><span style="color: blue; font-family: Courier New; font-size: 10pt;"><span style="color: #000000;"><span style="color: blue;">set</span> @q<span style="color: gray;">=</span>N<span style="color: red;">&#8216;drop function &#8216; <span style="color: #000000;"><span style="color: gray;">+</span> @name<span style="color: gray;">;</span></span></span></span></span></p>
<p><span style="color: blue; font-family: Courier New; font-size: 10pt;">end<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;"><span style="color: blue;">if</span><span style="color: gray;">(</span>@type<span style="color: gray;">=</span><span style="color: red;">&#8216;v&#8217;</span><span style="color: gray;">)<br />
</span></span></p>
<p><span style="color: blue; font-family: Courier New; font-size: 10pt;">begin<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;"><span style="color: blue;">set</span> @q<span style="color: gray;">=</span>N<span style="color: red;">&#8216;drop view &#8216;</span><span style="color: red;"> </span><span style="color: gray;">+</span> @name<span style="color: gray;">;<br />
</span></span></p>
<p><span style="color: blue; font-family: Courier New; font-size: 10pt;">end<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;"><span style="color: blue;">if</span><span style="color: gray;">(</span>@type<span style="color: gray;">=</span><span style="color: red;">&#8216;u&#8217;</span><span style="color: gray;">)<br />
</span></span></p>
<p><span style="color: blue; font-family: Courier New; font-size: 10pt;">begin<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;"><span style="color: blue;">set</span> @q<span style="color: gray;">=</span>N<span style="color: red;">&#8216;drop table &#8216;</span><span style="color: red;"> </span><span style="color: gray;">+</span> @name<span style="color: gray;">;<br />
</span></span></p>
<p><span style="color: blue; font-family: Courier New; font-size: 10pt;">end<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;"><span style="color: blue;">exec</span><span style="color: blue;"> </span><span style="color: maroon;">sp_executesql</span> @q<span style="color: gray;">;<br />
</span></span></p>
<p><span style="font-family: Courier New; font-size: 10pt;"><span style="color: blue;">fetch</span> next <span style="color: blue;">from</span> cur <span style="color: blue;">into</span> @name<span style="color: gray;">,</span>@type<br />
</span></p>
<p><span style="color: blue; font-family: Courier New; font-size: 10pt;">end<br />
</span></p>
<p><span style="font-family: Courier New; font-size: 10pt;"><span style="color: blue;">close</span> cur<span style="color: gray;">;<br />
</span></span></p>
<p><span style="font-family: Courier New; font-size: 10pt;"><span style="color: blue;">deallocate</span> cur<span style="color: gray;">;</span></span></p>
<p><span style="font-family: Calibri; font-size: 15px; color: #ff0000;">NOTE<span style="mso-spacerun: yes;"> </span>:</span></p>
<p class="MsoNormal" style="margin: 0in 0in 10pt;"><span lang="EN-IN"><span style="font-size: 11pt; font-family: Calibri;">If you are in need of any </span><a href="http://dhanashree.com/web-development-services/asp-php-web-development" target="_blank"><span style="font-size: 11pt; font-family: Calibri;">Web Development</span></a><span style="font-size: 11pt; font-family: Calibri;"> feel free to <span style="text-decoration: underline;"><a href="http://dhanashree.com/contact-web-designing-company" target="_blank">Inquire us</a></span> .<span style="mso-spacerun: yes;"> </span><span style="text-decoration: underline;"><a href="http://dhanashree.com/" target="_blank">Dhanashree Inc</a></span>. Expertise in <span style="text-decoration: underline;"><a href="http://dhanashree.com/web-development-services/asp-php-web-development/dot-net-web-designing" target="_blank">Asp.net Development</a></span>, <span style="text-decoration: underline;"><a href="http://dhanashree.com/web-development-services/asp-php-web-development/lamp-development-php-web-designing" target="_blank">Php Development</a></span>,<span style="mso-spacerun: yes;"> </span><span style="text-decoration: underline;"><a href="http://dhanashree.com/web-development-services/website-designing" target="_blank">Website designing</a></span>, <span style="text-decoration: underline;"><a href="http://dhanashree.com/web-development-services/open-source-wordpress-joomla-oscommerce-customisation" target="_blank">Open Source customisation</a></span>. <span style="text-decoration: underline;"><a href="http://dhanashree.com/" target="_blank">Dhanashree Inc</a> </span>can be our <span style="text-decoration: underline;"><a href="http://dhanashree.com/web-development-services/offshore-website-designing-company" target="_blank">offshore development company</a></span> / </span><a href="http://dhanashree.com/web-designing-outsource-advantages" target="_blank"><span style="font-size: 11pt; font-family: Calibri;">outsourcing</span></a><span style="font-size: 11pt; font-family: Calibri;"> <span style="text-decoration: underline;"><a href="http://dhanashree.com/dhanashree-web-development-profile" target="_blank">web development company</a></span>, <span style="text-decoration: underline;"><a href="http://dhanashree.com/web-development-services/dedicated-php-dotnet-developer" target="_blank">hire dedicated web programmers</a></span>.</span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 10pt;"><span lang="EN-IN"><span style="font-size: 11pt; font-family: Calibri;">Above information is for knowledge sharing<span style="mso-spacerun: yes;"> </span>if you have problem / issue / suggestion please intimate us with details for proper and prompt action.</span></span></p>
]]></content:encoded>
			<wfw:commentRss>http://techinsight.dhanashree.com/how-to-make-sql-server-2005-database-empty-using-cursor-sys-objects-delete-all-tables-stored-procedures-views-udf%e2%80%99s/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Quick DBMS reference: Single line definitions of important SQL Server terms</title>
		<link>http://techinsight.dhanashree.com/quick-dbms-reference-single-line-definitions-of-important-sql-server-terms-2/</link>
		<comments>http://techinsight.dhanashree.com/quick-dbms-reference-single-line-definitions-of-important-sql-server-terms-2/#comments</comments>
		<pubDate>Sat, 06 Feb 2010 09:36:40 +0000</pubDate>
		<dc:creator>kiran</dc:creator>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[SQL server 2005]]></category>
		<category><![CDATA[DBMS]]></category>

		<guid isPermaLink="false">http://techinsight.dhanashree.com/?p=188</guid>
		<description><![CDATA[Normalization: is a process of organizing data and minimizing redundancy 
De-normalization: is a technique to move from higher to lower normal forms of database modeling in order to speed up database access.
Stored Procedure: is a named group of T-SQL statements which can be created and stored in Database as an object.
Primary Key: is a unique [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Normalization: </strong>is a process of organizing data and minimizing redundancy<strong> </strong></p>
<p><strong>De-normalization: </strong>is a technique to move from higher to lower normal forms of database modeling in order to speed up database access.</p>
<p><strong>Stored Procedure: </strong>is a named group of T-SQL statements which can be created and stored in Database as an object.</p>
<p><strong>Primary Key: </strong>is a unique identifier of a row in a DB table, [it can’t be NULL]</p>
<p><strong>Unique key: </strong>forces uniqueness to a respective table column, [it can be NULL]</p>
<p><strong>Foreign Key: </strong>a foreign key in 1 table refers to the primary key in other table, Used to force referential integrity.</p>
<p><strong>Inner join: </strong>exists in both tables</p>
<p><strong>Left Outer join: </strong>all records from left side table + matched rows from right side table (totals number of rows will be same as left table)</p>
<p><strong>Right Outer join: </strong>all records from right side table + matched rows from left side table (totals number of rows will be same as right table), it’s a mirror image of left outer join</p>
<p><strong>Full Outer join: </strong>all records from left side table + all records from right side table, weather matched or not</p>
<p><strong>Cross join: </strong>returns [left table rows * right table rows], a Cartesian product of both tables</p>
<p><strong>Self join: </strong>when table joins to itself using diff aliases to avoid confusion</p>
<p><strong>Union: </strong>selects only distinct records from both tables</p>
<p><strong>Union all: </strong>selects all records from both tables</p>
<p><strong>View: </strong>is a subset of a table, can be used to retrieve data, insert or Update data. Can contain multiple select statements inside</p>
<p><strong>Trigger: </strong>A trigger is a SQL procedure that initiates an action when an event (INSERT, DELETE or UPDATE) occurs.</p>
<p><strong>Cursor: </strong>is a database object used to loop trough records on row by row bases.</p>
<p><strong>Index: </strong>pointers to data records, represents structure of how data get stored physically in a table</p>
<table border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td width="319" valign="top"><strong>Clustered index</strong></td>
<td width="319" valign="top"><strong>Non clustered index</strong></td>
</tr>
<tr>
<td width="319" valign="top">Reorders physical data stored in table</td>
<td width="319" valign="top">It contains pointers to data rows</td>
</tr>
<tr>
<td width="319" valign="top">A table can have Only 1 clustered index</td>
<td width="319" valign="top">A table can have one OR many    non-clustered index</td>
</tr>
<tr>
<td width="319" valign="top">Leaf nodes contains data</td>
<td width="319" valign="top">Leaf nodes contains reference to data</td>
</tr>
</tbody>
</table>
<p><strong> </strong></p>
<p><strong>Linked server: </strong>is a concept of adding other remote server to a group to query DB’s of both servers together</p>
<p><strong>Collation: set of rules that determines how data stores &amp; compares in database</strong><strong> </strong></p>
<p><strong>Collation types: case sensitive, accent sensitive, kana sensitive, width sensitive</strong></p>
<p><strong>Data ware housing: </strong></p>
<ol>
<li>Record should Never delete from DB</li>
<li>All records must be linked</li>
<li>Once committed records should be read-only</li>
<li>All changes made must be tracked with time</li>
</ol>
<p><strong>User defined function (UDF): </strong>is a bunch of T-SQL statements which accepts 0 or more parameters and returns a scalar data value or table.</p>
<p><strong>DDL:</strong> data definition language – e.g. <strong>TRUNCATE</strong> command is a DDL command</p>
<p><strong>DML:</strong> data manipulation language – e.g. <strong>INSERT</strong>, <strong>UPDATE</strong> &amp; <strong>DELETE</strong> are DML commands</p>
<p><span style="font-family: Calibri; font-size: 15px; color: #ff0000;">NOTE<span style="mso-spacerun: yes;"> </span>:</span></p>
<p class="MsoNormal" style="margin: 0in 0in 10pt;"><span lang="EN-IN"><span style="font-size: 11pt; font-family: Calibri;">If you are in need of any </span><a href="http://dhanashree.com/web-development-services/asp-php-web-development" target="_blank"><span style="font-size: 11pt; font-family: Calibri;">Web Development</span></a><span style="font-size: 11pt; font-family: Calibri;"> feel free to <span style="text-decoration: underline;"><a href="http://dhanashree.com/contact-web-designing-company" target="_blank">Inquire us</a></span> .<span style="mso-spacerun: yes;"> </span><span style="text-decoration: underline;"><a href="http://dhanashree.com/" target="_blank">Dhanashree Inc</a></span>. Expertise in <span style="text-decoration: underline;"><a href="http://dhanashree.com/web-development-services/asp-php-web-development/dot-net-web-designing" target="_blank">Asp.net Development</a></span>, <span style="text-decoration: underline;"><a href="http://dhanashree.com/web-development-services/asp-php-web-development/lamp-development-php-web-designing" target="_blank">Php Development</a></span>,<span style="mso-spacerun: yes;"> </span><span style="text-decoration: underline;"><a href="http://dhanashree.com/web-development-services/website-designing" target="_blank">Website designing</a></span>, <span style="text-decoration: underline;"><a href="http://dhanashree.com/web-development-services/open-source-wordpress-joomla-oscommerce-customisation" target="_blank">Open Source customisation</a></span>. <span style="text-decoration: underline;"><a href="http://dhanashree.com/" target="_blank">Dhanashree Inc</a> </span>can be our <span style="text-decoration: underline;"><a href="http://dhanashree.com/web-development-services/offshore-website-designing-company" target="_blank">offshore development company</a></span> / </span><a href="http://dhanashree.com/web-designing-outsource-advantages" target="_blank"><span style="font-size: 11pt; font-family: Calibri;">outsourcing</span></a><span style="font-size: 11pt; font-family: Calibri;"> <span style="text-decoration: underline;"><a href="http://dhanashree.com/dhanashree-web-development-profile" target="_blank">web development company</a></span>, <span style="text-decoration: underline;"><a href="http://dhanashree.com/web-development-services/dedicated-php-dotnet-developer" target="_blank">hire dedicated web programmers</a></span>.</span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 10pt;"><span lang="EN-IN"><span style="font-size: 11pt; font-family: Calibri;">Above information is for knowledge sharing<span style="mso-spacerun: yes;"> </span>if you have problem / issue / suggestion please intimate us with details for proper and prompt action.</span></span></p>
]]></content:encoded>
			<wfw:commentRss>http://techinsight.dhanashree.com/quick-dbms-reference-single-line-definitions-of-important-sql-server-terms-2/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
	</channel>
</rss>

