<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-7848011355253090856</id><updated>2012-01-06T17:10:41.079+05:30</updated><category term='destructor'/><category term='FLASH'/><category term='Remote Procedure Call'/><category term='DBMS_PIPE'/><category term='e-r diagram'/><category term='flash vs silverlight'/><category term='AJAX vs silverlight'/><category term='RIA'/><category term='ASP.NET'/><category term='asp.net vs silverlight'/><category term='truncate'/><category term='t-sql'/><category term='www'/><category term='WIRELESS'/><category term='streaming audio'/><category term='MACROMEDIA'/><category term='LAST_DDL_TIME'/><category term='ASP.NET 1.1'/><category term='corruption in India'/><category term='xhtml'/><category term='SQL*Plus SPOOL command'/><category term='MULTICAST'/><category term='motion tween with expression blend'/><category term='windows media server'/><category term='Deploy asp.net application'/><category term='Native Support for Adobe AIR'/><category term='java'/><category term='%ROWTYPE'/><category term='Deep Zoom Technology'/><category term='visual studio to design reports'/><category term='WML'/><category term='layer'/><category term='SDK'/><category term='free DNS Management'/><category term='Who Is Blocking SQL Server'/><category term='Installing Flex SDK'/><category term='sap crm'/><category term='.net projects'/><category term='integration services'/><category term='SSRS'/><category term='Independence day speech'/><category term='user friendly'/><category term='mcts exam papers'/><category term='SQL FAQs'/><category term='finalize method in vb.net'/><category term='sql server version'/><category term='.NET'/><category term='benifits of stored procedures'/><category term='distrubuted architecture'/><category term='what is MYSQL'/><category term='Google and You tube videos'/><category term='SQL Server 7.0 versions'/><category term='Microsoft'/><category term='Dynamic SQL statements from PL/SQL'/><category term='internet broadcasting'/><category term='sd online training'/><category term='user-friendly'/><category term='oops'/><category term='QuickTime movies in your Website'/><category term='IS Retail'/><category term='CREATE SATELLITE ASSEMBLY'/><category term='non-clustered indexes'/><category term='Banglore'/><category term='RICH INTERNET APPLICATION'/><category term='data grid view cell value'/><category term='case sensitive search in sql server'/><category term='http request'/><category term='sharepoint'/><category term='optimising sql queries'/><category term='WTLS'/><category term='report manager'/><category term='Sare Jaha se accha'/><category term='constructor in vb.net'/><category term='cascade delete'/><category term='low price Domain'/><category term='Patriotic presentations'/><category term='VSTS 2010'/><category term='code'/><category term='Hindustaan Hamara'/><category term='Free Who.is protection'/><category term='analysis services'/><category term='Getting the last identity value used'/><category term='embed'/><category term='Software development models'/><category term='Pulivendula'/><category term='.net framework'/><category term='EXtensible Markup Language'/><category term='silverlight'/><category term='cookies'/><category term='debugging PL/SQL'/><category term='classid'/><category term='motion tween in silverlight'/><category term='Indian Air Force'/><category term='EXPRESSION DESIGN'/><category term='develop silverlight applications'/><category term='learn silverlight'/><category term='PHP'/><category term='mcpd'/><category term='container'/><category term='ASSEMBLY'/><category term='Moonlight'/><category term='Independence day message'/><category term='dynamic statements'/><category term='sap is retail'/><category term='SQL server Transactions'/><category term='bulk copy'/><category term='what is stored procedure'/><category term='WPF'/><category term='exceptions in ado.net'/><category term='setup and deployment'/><category term='execute immediate'/><category term='MYSQL'/><category term='ASP.NET 2.0'/><category term='optimising sql server indexes'/><category term='EXPRESSION BLEND'/><category term='PL/SQL'/><category term='query to a text file'/><category term='server side scripting'/><category term='DELIGATE'/><category term='mid-tier'/><category term='SILVER LIGHTwith web services'/><category term='mutating table'/><category term='Report builder'/><category term='ASP.NET data grid view'/><category term='LIMITATIONS'/><category term='Performance Tuning Tips for Creating Visual Basic Applications'/><category term='analysis services cubes'/><category term='sql Query'/><category term='SATELLITE ASSEMBLIES'/><category term='accessing web services in silverlight'/><category term='Linear Sequential Model'/><category term='Indian'/><category term='silverlight rendering engine'/><category term='xml'/><category term='Independence'/><category term='Except operator'/><category term='attribute'/><category term='RPC in .net'/><category term='IS Utilities'/><category term='function overloading'/><category term='what is silverlight'/><category term='motion tween expression blend'/><category term='getting started with Stored Procedures'/><category term='comparing NULL with NULL'/><category term='USER_OBJECTS'/><category term='DOWNLOAD'/><category term='webcasting'/><category term='Microsoft Certified Technology Specialist'/><category term='ssl'/><category term='speech'/><category term='XMLHTTPRequest'/><category term='MICROSOFT EXPRESSION WEB'/><category term='WAP GATEWAY SERVER'/><category term='Flex AJAX Bridge Library'/><category term='multi layer'/><category term='Frame work caching Flex 3.3'/><category term='Anna Hazare'/><category term='Joining Queries from Oracle and SQL Server Databases'/><category term='.NET RIA services'/><category term='javascript'/><category term='new method'/><category term='PHP.'/><category term='AJAX'/><category term='raise_application_error'/><category term='EXPRESSION STUDIO'/><category term='OLAP Data Grid'/><category term='layer vs  server'/><category term='RPC'/><category term='MOBILE'/><category term='http'/><category term='PHP + MYSQL'/><category term='gridview cell value'/><category term='rpc Layers'/><category term='.net 4.0'/><category term='mcts'/><category term='INIT.ORA'/><category term='IS Oil and Gas'/><category term='AJAX VIDEO PLAYER'/><category term='Indexes in sql server'/><category term='elements'/><category term='Mail'/><category term='INDIA'/><category term='PHP vs IIS'/><category term='SDLC'/><category term='Ralegaon Siddhi'/><category term='WINDOWS PRESENTATION FOUNDATION'/><category term='software requirement analysis'/><category term='NULL'/><category term='object oriented programming destructor'/><category term='client-server'/><category term='view state'/><category term='AJAX instead of silverlight'/><category term='YSR'/><category term='set serveroutput'/><category term='protect pl/sql code'/><category term='constructor'/><category term='Print the screen from PL/SQL'/><category term='sap'/><category term='Prototyping Model'/><category term='oracle faqs'/><category term='tags'/><category term='web camera support in silverlight'/><category term='COVARIENCE'/><category term='import and exporting'/><category term='Flex Charting'/><category term='Prevent Unnecessary Database Hit in ADO.NET'/><category term='WPF CLASS HIERARCHY'/><category term='https'/><category term='India against corruption'/><category term='normalisation in database'/><category term='What is PL/SQL'/><category term='ddl'/><category term='customized players'/><category term='FLEX'/><category term='operating system command from PL/SQL'/><category term='Rudrakonda'/><category term='Classic Life Cycle Model'/><category term='object oriented programming constructor'/><category term='lokayukta'/><category term='decode'/><category term='movies'/><category term='client server'/><category term='interview questions'/><category term='advantages of stored procedures'/><category term='.NER RIA'/><category term='Derived Tables in sql server'/><category term='secure socket layer'/><category term='CHAT'/><category term='ria development'/><category term='sessions'/><category term='sql interview'/><category term='SILVER LIGHT Videos'/><category term='YSR Padayatra'/><category term='send'/><category term='Flex 3.3 Release Notes'/><category term='inheritance'/><category term='Streaming'/><category term='offline capabilities'/><category term='player'/><category term='OPEN'/><category term='tips on optimizing sql server indexes'/><category term='Microsoft certified professional developer'/><category term='whats new in ado.net 2.0'/><category term='Andhra CM'/><category term='jan lokpal bill'/><category term='Video'/><category term='tier'/><category term='sql server DBA'/><category term='write file from PL/SQL'/><category term='packages'/><category term='HTTP STREAMING'/><category term='web-server'/><category term='DBMS_OUTPUT'/><category term='clustered index'/><category term='destructor in vb.net'/><category term='procedural language'/><category term='Chopper Crash'/><category term='text to speech'/><category term='Microsoft 70-528'/><category term='FLEX BUILDER'/><category term='streaming video'/><category term='Here is the general format for including .wmv files in web pages: Embed Windows Media'/><category term='VIDEO STREAMING'/><category term='dml'/><category term='AJAX XML Request'/><category term='what is php file'/><category term='What is NULL'/><category term='streaming reports'/><category term='WTP'/><category term='what is .net ria services'/><category term='Oracle'/><category term='lokpal'/><category term='triggers'/><category term='interview FAQs'/><category term='Videos'/><category term='crm online training'/><category term='constraining table'/><category term='Rapid Application Development Model'/><category term='silverlight DRM'/><category term='markup'/><category term='EXPRESSION ENCODER'/><category term='WAP'/><category term='stored procedures'/><category term='getting started with SILVERLIGHT'/><category term='percent sign in sql'/><category term='Component Assembly Model'/><category term='asp.net with silverlight'/><category term='restrictions of web services in silverlight'/><category term='RDBMS'/><category term='Search PL/SQL code for a string/ key value?'/><category term='sap online training'/><category term='differences between visual studio 2005 and visual studio 2008'/><category term='web services'/><category term='post'/><category term='online training hyderabad'/><category term='flash animations in silverlight'/><category term='SQL*Plus'/><category term='history of pl/sql code changes'/><category term='UTL_FILE package'/><category term='silverlight 3'/><category term='loop through tables in pl/sql'/><category term='video tutorials'/><category term='visual studio 2010'/><category term='Multiple Record Insert'/><category term='hyper text transfer protocol'/><category term='Bomb Blast'/><category term='state management in asp.net'/><category term='xaml'/><category term='Read file from PL/SQL'/><category term='COD rules'/><category term='silverlight 2'/><category term='Microsoft .net'/><category term='functions'/><category term='data paging'/><category term='stored proceduressql server datatypes'/><category term='Working with Transactions in ADO.NET'/><category term='Free Domain Tranfer'/><category term='Web'/><category term='Multi Row Insert'/><category term='MSDN'/><category term='.net framework 4.0'/><category term='SILVER LIGHT'/><category term='cursors'/><category term='%TYPE'/><category term='tips'/><category term='download free php'/><category term='codebase'/><category term='Nallamalla Range'/><category term='sql server 2005'/><category term='get'/><category term='vb.net'/><category term='performance tuning'/><category term='THREADING'/><category term='LINQ'/><category term='EXPRESSION MEDIA'/><category term='OPEN SOURCE'/><category term='object'/><category term='Adobe AIR'/><category term='client side rendering'/><category term='Flex 3 Backward Compatability'/><category term='soap and silverlight'/><category term='Ad Hoc Distributed Queries'/><category term='visual studio'/><category term='movie'/><category term='Kurnool'/><category term='printing support in silverlight'/><category term='openrowset in sql server'/><category term='HTML'/><category term='%TYPE vs %ROWTYPE'/><category term='working with exceptions in ADO.NET'/><category term='Y S Rajasekhara Reddy'/><category term='DBMS'/><category term='VIDEO CONFERENCING'/><category term='live streaming'/><category term='sap sd'/><category term='data-centric program'/><category term='cpm'/><category term='Flex Component kit for Flash CS3'/><category term='Remote Procedure Calling'/><category term='job roles'/><category term='Wesley'/><category term='ADOBE'/><category term='RAD model'/><category term='n-tier'/><category term='ddl statements fromPL/SQL'/><category term='procedures'/><category term='sql server 2008'/><category term='sql server datatypes'/><category term='SMTP'/><category term='delete duplicate rows sql server'/><category term='reporting services'/><category term='capabilities of silverlight'/><category term='Andhrapradesh'/><category term='common provider model'/><category term='Waterfall Method'/><category term='mcpd exam paper'/><category term='database'/><category term='advanced search'/><category term='EXPRESSION WEB'/><category term='soap'/><category term='voice in asp.net application'/><category term='Text to Voice'/><category term='what is php'/><category term='AP Congress Leader'/><category term='Sand Boxed Multi-version'/><category term='SQL*DBA'/><category term='WSP'/><category term='email in a query'/><category term='IS Retail Training hyderabad'/><category term='binary wrapper'/><category term='using Using in .NET'/><category term='sql server'/><category term='cross-platform'/><category term='COMMUNICATION TOOLS'/><category term='ADO.NET'/><category term='microsoft silverlight'/><category term='media asset management'/><category term='SQL SERVER PERFORMANCE TUNING TIPS'/><category term='distributed architecture'/><category term='Flash video in your website'/><category term='free domain forwarding'/><category term='data'/><title type='text'>Tech Mates</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://ravifirst.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://ravifirst.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default?start-index=101&amp;max-results=100'/><author><name>Ravi's</name><uri>http://www.blogger.com/profile/14359502815484562942</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_WxhoysBC8gY/StgCRfR-X5I/AAAAAAAAAJQ/l5Cd32MA2kk/S220/Rlogo.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>135</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-7848011355253090856.post-2879819402237259813</id><published>2011-04-14T10:47:00.001+05:30</published><updated>2011-04-14T10:50:12.236+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='lokpal'/><category scheme='http://www.blogger.com/atom/ns#' term='lokayukta'/><category scheme='http://www.blogger.com/atom/ns#' term='India against corruption'/><category scheme='http://www.blogger.com/atom/ns#' term='corruption in India'/><category scheme='http://www.blogger.com/atom/ns#' term='jan lokpal bill'/><title type='text'>A look at the salient features of Jan Lokpal Bill ...</title><content type='html'>&lt;div style="text-align:justify;"&gt;&lt;br /&gt;1. An institution called &lt;span style="font-weight:bold;"&gt;LOKPAL&lt;/span&gt; at the centre and &lt;span style="font-weight:bold;"&gt;LOKAYUKTA&lt;/span&gt; in each state will be set up&lt;br /&gt;&lt;br /&gt;2. Like Supreme Court and &lt;span style="font-weight:bold;"&gt;Election Commission&lt;/span&gt;, they will be completely independent of the governments. No minister or bureaucrat will be able to influence their investigations.&lt;br /&gt;&lt;br /&gt;3. Cases against corrupt people will not linger on for years anymore: Investigations in any case will have to be completed in one year. Trial should be completed in next one year so that the corrupt politician, officer or judge is sent to jail within two years.&lt;br /&gt;&lt;br /&gt;4. The loss that a corrupt person caused to the government will be recovered at the time of conviction.&lt;br /&gt;&lt;br /&gt;5. How will it help a common citizen: If any work of any citizen is not done in prescribed time in any government office, Lokpal will impose financial penalty on guilty officers, which will be given as compensation to the complainant.&lt;br /&gt;&lt;br /&gt;6. So, you could approach Lokpal if your ration card or passport or voter card is not being made or if police is not registering your case or any other work is not being done in prescribed time. Lokpal will have to get it done in a month's time. You could also report any case of corruption to Lokpal like ration being siphoned off, poor quality roads been constructed or panchayat funds being siphoned off. Lokpal will have to complete its investigations in a year, trial will be over in next one year and the guilty will go to jail within two years.&lt;br /&gt;&lt;br /&gt;7. But won't the government appoint corrupt and weak people as Lokpal members? That won't be possible because its members will be selected by judges, citizens and constitutional authorities and not by politicians, through a completely transparent and participatory process.&lt;br /&gt;&lt;br /&gt;8. What if some officer in Lokpal becomes corrupt? The entire functioning of Lokpal/ Lokayukta will be completely transparent. Any complaint against any officer of Lokpal shall be investigated and the officer dismissed within two months.&lt;br /&gt;&lt;br /&gt;9. What will happen to existing anti-corruption agencies? CVC, departmental vigilance and anti-corruption branch of CBI will be merged into Lokpal. Lokpal will have complete powers and machinery to independently investigate and prosecute any officer, judge or politician.&lt;br /&gt;&lt;br /&gt;10. It will be the duty of the Lokpal to provide protection to those who are being victimized for raising their voice against corruption.&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7848011355253090856-2879819402237259813?l=ravifirst.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ravifirst.blogspot.com/feeds/2879819402237259813/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ravifirst.blogspot.com/2011/04/look-at-salient-features-of-jan-lokpal.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/2879819402237259813'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/2879819402237259813'/><link rel='alternate' type='text/html' href='http://ravifirst.blogspot.com/2011/04/look-at-salient-features-of-jan-lokpal.html' title='A look at the salient features of Jan Lokpal Bill ...'/><author><name>Ravi's</name><uri>http://www.blogger.com/profile/14359502815484562942</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_WxhoysBC8gY/StgCRfR-X5I/AAAAAAAAAJQ/l5Cd32MA2kk/S220/Rlogo.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7848011355253090856.post-300118545153703997</id><published>2011-04-14T10:40:00.002+05:30</published><updated>2011-04-14T10:47:40.488+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Anna Hazare'/><category scheme='http://www.blogger.com/atom/ns#' term='India against corruption'/><category scheme='http://www.blogger.com/atom/ns#' term='Ralegaon Siddhi'/><category scheme='http://www.blogger.com/atom/ns#' term='corruption in India'/><category scheme='http://www.blogger.com/atom/ns#' term='jan lokpal bill'/><title type='text'>What is Jan Lokpal Bill ?</title><content type='html'>&lt;div style="text-align:justify;"&gt;&lt;br /&gt;The &lt;span style="font-weight:bold;"&gt;Jan Lokpal Bill&lt;/span&gt; (&lt;span style="font-weight:bold;"&gt;Citizen's ombudsman Bill&lt;/span&gt;) is a draft &lt;span style="font-weight:bold;"&gt;anti-corruption bill&lt;/span&gt; drawn up by prominent civil society activists seeking the appointment of a &lt;span style="font-weight:bold;"&gt;Jan Lokpal&lt;/span&gt;, an independent body  that would investigate corruption cases, complete the investigation within a year and envisages trial in the case getting over in the next one year.&lt;br /&gt;&lt;br /&gt;Drafted by &lt;span style="font-style:italic;"&gt;Justice Santosh Hegde&lt;/span&gt; (former Supreme Court Judge and present Lokayukta of Karnataka), &lt;span style="font-style:italic;"&gt;Prashant Bhushan&lt;/span&gt; (Supreme Court Lawyer) and &lt;span style="font-style:italic;"&gt;Arvind Kejriwal&lt;/span&gt; (RTI activist), the draft Bill envisages a system where a corrupt person found guilty would go to jail within two years of the complaint being made and his ill-gotten wealth being confiscated. It also seeks power to the &lt;span style="font-weight:bold;"&gt;Jan Lokpal&lt;/span&gt; to prosecute politicians and bureaucrats without government permission.&lt;br /&gt;&lt;br /&gt;Retired IPS officer &lt;span style="font-weight:bold;"&gt;Kiran Bedi&lt;/span&gt; and other known people like &lt;span style="font-style:italic;"&gt;Swami Agnivesh&lt;/span&gt;, &lt;span style="font-style:italic;"&gt;Sri Sri Ravi Shankar&lt;/span&gt;, Anna Hazare and &lt;span style="font-style:italic;"&gt;Mallika Sarabhai&lt;/span&gt; are also part of the movement, called &lt;span style="font-weight:bold;"&gt;India Against Corruption&lt;/span&gt;. Its website describes the movement as "an expression of collective anger of people of India against corruption. We have all come together to force/request/persuade/pressurize the Government to enact the &lt;span style="font-weight:bold;"&gt;Jan Lokpal Bill&lt;/span&gt;. We feel that if this Bill were enacted it would create an effective deterrence against corruption."&lt;br /&gt;&lt;br /&gt;Anna Hazare, anti-corruption crusader, began a fast-unto-death today, demanding that this bill, drafted by the civil society, be adopted. The website of the India Against Corruption movement calls the Lokpal Bill of the government an "eyewash" and has on it a critique of that government Bill. It also lists the difference between the Bills drafted by the government and civil society.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7848011355253090856-300118545153703997?l=ravifirst.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ravifirst.blogspot.com/feeds/300118545153703997/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ravifirst.blogspot.com/2011/04/what-is-jan-lokpal-bill.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/300118545153703997'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/300118545153703997'/><link rel='alternate' type='text/html' href='http://ravifirst.blogspot.com/2011/04/what-is-jan-lokpal-bill.html' title='What is Jan Lokpal Bill ?'/><author><name>Ravi's</name><uri>http://www.blogger.com/profile/14359502815484562942</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_WxhoysBC8gY/StgCRfR-X5I/AAAAAAAAAJQ/l5Cd32MA2kk/S220/Rlogo.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7848011355253090856.post-7492821736323249269</id><published>2011-04-14T10:34:00.002+05:30</published><updated>2011-04-14T10:39:33.717+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Anna Hazare'/><category scheme='http://www.blogger.com/atom/ns#' term='Ralegaon Siddhi'/><category scheme='http://www.blogger.com/atom/ns#' term='corruption in India'/><title type='text'>Who is Anna Hazare ?</title><content type='html'>&lt;span style="font-weight:bold;"&gt;Anna Hazare &lt;/span&gt;, An ex-army man. Fought 1965 Indo-Pak War. &lt;br /&gt;&lt;br /&gt;He built a village &lt;span style="font-weight:bold;"&gt;Ralegaon Siddhi&lt;/span&gt; in Ahamad Nagar district, Maharashtra. This village is a self-sustained model village. Energy is produced in the village itself from &lt;span style="font-weight:bold;"&gt;solar power, biofuel and wind mills&lt;/span&gt;. In 1975, it used to be a poverty clad village. Now it is one of the richest village in India. It has become a model for self-sustained, eco-friendly &amp; harmonic village. &lt;br /&gt;  &lt;br /&gt;This guy, Anna Hazare was awarded &lt;span style="font-weight:bold;"&gt;Padma Bhushan&lt;/span&gt; and is a known figure for his social activities. &lt;br /&gt;  &lt;br /&gt;He is supporting a cause, the amendment of a law to curb &lt;span style="font-weight:bold;"&gt;corruption in India&lt;/span&gt;. &lt;br /&gt;&lt;br /&gt;He is advocating for a Bil, The &lt;span style="font-weight:bold;"&gt;Lok Pal Bill&lt;/span&gt; (The &lt;span style="font-weight:bold;"&gt;Citizen Ombudsman Bill&lt;/span&gt;), that will form an autonomous authority who will make politicians (ministers), bureaucrats (IAS/IPS) accountable for their deeds.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7848011355253090856-7492821736323249269?l=ravifirst.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ravifirst.blogspot.com/feeds/7492821736323249269/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ravifirst.blogspot.com/2011/04/who-is-anna-hazare.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/7492821736323249269'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/7492821736323249269'/><link rel='alternate' type='text/html' href='http://ravifirst.blogspot.com/2011/04/who-is-anna-hazare.html' title='Who is Anna Hazare ?'/><author><name>Ravi's</name><uri>http://www.blogger.com/profile/14359502815484562942</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_WxhoysBC8gY/StgCRfR-X5I/AAAAAAAAAJQ/l5Cd32MA2kk/S220/Rlogo.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7848011355253090856.post-2447118189514886599</id><published>2010-03-14T18:10:00.002+05:30</published><updated>2010-03-14T18:12:39.409+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='silverlight'/><category scheme='http://www.blogger.com/atom/ns#' term='microsoft silverlight'/><category scheme='http://www.blogger.com/atom/ns#' term='Moonlight'/><title type='text'>What is Moonlight ?</title><content type='html'>Moonlight is an open source implementation of Silverlight, primarily for Linux and other Unix/X11 based operating systems. In September of 2007, Microsoft and Novell announced a technical collaboration that includes access to Microsoft's test suites for Silverlight and the distribution of a Media Pack for Linux users that will contain licensed media codecs for video and audio.&lt;br /&gt;&lt;br /&gt;Moonlight 2 was released December 17, 2009&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7848011355253090856-2447118189514886599?l=ravifirst.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ravifirst.blogspot.com/feeds/2447118189514886599/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ravifirst.blogspot.com/2010/03/what-is-moonlight.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/2447118189514886599'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/2447118189514886599'/><link rel='alternate' type='text/html' href='http://ravifirst.blogspot.com/2010/03/what-is-moonlight.html' title='What is Moonlight ?'/><author><name>Ravi's</name><uri>http://www.blogger.com/profile/14359502815484562942</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_WxhoysBC8gY/StgCRfR-X5I/AAAAAAAAAJQ/l5Cd32MA2kk/S220/Rlogo.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7848011355253090856.post-7622581774073151457</id><published>2009-12-11T09:00:00.003+05:30</published><updated>2009-12-11T09:04:57.019+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='SQL FAQs'/><category scheme='http://www.blogger.com/atom/ns#' term='sql server 2005'/><category scheme='http://www.blogger.com/atom/ns#' term='sql server version'/><category scheme='http://www.blogger.com/atom/ns#' term='sql interview'/><title type='text'>How to find the version of SQL Server using ?</title><content type='html'>&lt;span style="font-weight:bold;"&gt;For SQL Server 2005/2008&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="width:90%;height:auto"&gt;&lt;br /&gt;SELECT  SERVERPROPERTY('productversion'), &lt;br /&gt;SERVERPROPERTY ('productlevel'), &lt;br /&gt;SERVERPROPERTY ('edition')&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;For SQL Server 2000&lt;/span&gt;&lt;br /&gt;&lt;div style="width:90%;height:auto"&gt;&lt;br /&gt;select @@version&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7848011355253090856-7622581774073151457?l=ravifirst.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ravifirst.blogspot.com/feeds/7622581774073151457/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ravifirst.blogspot.com/2009/12/how-to-find-version-of-sql-server-using.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/7622581774073151457'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/7622581774073151457'/><link rel='alternate' type='text/html' href='http://ravifirst.blogspot.com/2009/12/how-to-find-version-of-sql-server-using.html' title='How to find the version of SQL Server using ?'/><author><name>Ravi's</name><uri>http://www.blogger.com/profile/14359502815484562942</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_WxhoysBC8gY/StgCRfR-X5I/AAAAAAAAAJQ/l5Cd32MA2kk/S220/Rlogo.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7848011355253090856.post-1616894571193606865</id><published>2009-09-11T14:45:00.003+05:30</published><updated>2009-09-11T15:00:43.281+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='visual studio'/><category scheme='http://www.blogger.com/atom/ns#' term='Microsoft Certified Technology Specialist'/><category scheme='http://www.blogger.com/atom/ns#' term='mcts exam papers'/><category scheme='http://www.blogger.com/atom/ns#' term='Microsoft certified professional developer'/><category scheme='http://www.blogger.com/atom/ns#' term='Microsoft 70-528'/><category scheme='http://www.blogger.com/atom/ns#' term='ASP.NET'/><category scheme='http://www.blogger.com/atom/ns#' term='mcts'/><category scheme='http://www.blogger.com/atom/ns#' term='mcpd'/><category scheme='http://www.blogger.com/atom/ns#' term='mcpd exam paper'/><title type='text'>Microsoft 70-528 Paper</title><content type='html'>&lt;span style="font-weight:bold;"&gt;Q.1.&lt;/span&gt; Your Web site uses custom Themes. Your Web site must support additional Themes based on the user's company name. The company name is set when a user logs on to the Web site. The company's Theme name is stored in a variable named ThemeName. You need to use this variable to dynamically set the Web site's Theme. What should you do?&lt;br /&gt;&lt;br /&gt;A. Add the following code segment to the markup source of each page on the Web site.&lt;br /&gt;&lt;%@ Page Theme="ThemeName" ... %&gt;&lt;br /&gt;&lt;br /&gt;B. Add the following code segment to the Load event of each page on the Web site.&lt;br /&gt;Page.Theme = ThemeName;&lt;br /&gt;&lt;br /&gt;C. Add the following code segment to the PreInit event of each page on the Web site.&lt;br /&gt;Page.Theme = ThemeName;&lt;br /&gt;&lt;br /&gt;D. Add the following code segment to the Web site's configuration file.&lt;br /&gt;&lt;pages theme="ThemeName" /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Answer: C&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Q.2.&lt;/span&gt; Your Web site uses custom Themes. Your Web site must support additional Themes based on the user's company name. The company name is set when a user logs on to the Web site. The company's Theme name is stored in a variable named ThemeName. You need to use this variable to dynamically set the Web site's Theme. What should you do?&lt;br /&gt;&lt;br /&gt;A. Add the following code segment to the markup source of each page on the Web site.&lt;br /&gt;&lt;%@ Page Theme="ThemeName" ... %&gt;&lt;br /&gt;&lt;br /&gt;B. Add the following code segment to the Load event of each page on the Web site.&lt;br /&gt;Page.Theme = ThemeName&lt;br /&gt;&lt;br /&gt;C. Add the following code segment to the PreInit event of each page on the Web site.&lt;br /&gt;Page.Theme = ThemeName&lt;br /&gt;&lt;br /&gt;D. Add the following code segment to the Web site's configuration file.&lt;br /&gt;&lt;pages theme="ThemeName" /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Answer: C&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7848011355253090856-1616894571193606865?l=ravifirst.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ravifirst.blogspot.com/feeds/1616894571193606865/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ravifirst.blogspot.com/2009/09/microsoft-70-528-paper.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/1616894571193606865'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/1616894571193606865'/><link rel='alternate' type='text/html' href='http://ravifirst.blogspot.com/2009/09/microsoft-70-528-paper.html' title='Microsoft 70-528 Paper'/><author><name>Ravi's</name><uri>http://www.blogger.com/profile/14359502815484562942</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_WxhoysBC8gY/StgCRfR-X5I/AAAAAAAAAJQ/l5Cd32MA2kk/S220/Rlogo.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7848011355253090856.post-5692273897900558883</id><published>2009-09-08T12:42:00.002+05:30</published><updated>2009-09-08T12:49:25.626+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Web'/><category scheme='http://www.blogger.com/atom/ns#' term='http'/><category scheme='http://www.blogger.com/atom/ns#' term='hyper text transfer protocol'/><category scheme='http://www.blogger.com/atom/ns#' term='ASP.NET'/><category scheme='http://www.blogger.com/atom/ns#' term='ssl'/><category scheme='http://www.blogger.com/atom/ns#' term='https'/><category scheme='http://www.blogger.com/atom/ns#' term='secure socket layer'/><title type='text'>Why Https ?</title><content type='html'>if we visit a website or webpage, and look at the address in the web browser, it will likely begin with the following: http://. This means that the website is talking to our browser using the regular 'unsecure' language. In other words, it is possible for someone to "eavesdrop" on our computer's conversation with the website. If we fill out a form on the website, someone might see the information we send to that site.This is why we never ever enter our credit card number in an http website.But if the web address begins with https://, that basically means our computer is talking to the website in a secure code that no one can eavesdrop on. So If a website ever asks us to enter our credit card information, we should automatically look to see if the web address begins with https://. Although it may be encrypted does not mean its safe, there are tools out there to decrypt the information being sent over the wire, although its more difficult to do so.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7848011355253090856-5692273897900558883?l=ravifirst.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='related' href='http://tourandhra.info' title='Why Https ?'/><link rel='replies' type='application/atom+xml' href='http://ravifirst.blogspot.com/feeds/5692273897900558883/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ravifirst.blogspot.com/2009/09/why-https.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/5692273897900558883'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/5692273897900558883'/><link rel='alternate' type='text/html' href='http://ravifirst.blogspot.com/2009/09/why-https.html' title='Why Https ?'/><author><name>Ravi's</name><uri>http://www.blogger.com/profile/14359502815484562942</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_WxhoysBC8gY/StgCRfR-X5I/AAAAAAAAAJQ/l5Cd32MA2kk/S220/Rlogo.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7848011355253090856.post-7715205587272693875</id><published>2009-09-08T12:40:00.001+05:30</published><updated>2009-09-08T12:42:26.865+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Web'/><category scheme='http://www.blogger.com/atom/ns#' term='http'/><category scheme='http://www.blogger.com/atom/ns#' term='ASP.NET'/><category scheme='http://www.blogger.com/atom/ns#' term='ssl'/><category scheme='http://www.blogger.com/atom/ns#' term='https'/><category scheme='http://www.blogger.com/atom/ns#' term='web-server'/><category scheme='http://www.blogger.com/atom/ns#' term='secure socket layer'/><title type='text'>How Https Works ?</title><content type='html'>To prepare a web-server for accepting https connections the administrator must create a public key certificate for the web-server.This certificate must be signed by a certificate authority of one form or another, who certifies that the certificate holder is who they say they are. Web browsers are generally distributed with the signing certificates of major certificate authorities, so that they can verify certificates signed by them.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7848011355253090856-7715205587272693875?l=ravifirst.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ravifirst.blogspot.com/feeds/7715205587272693875/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ravifirst.blogspot.com/2009/09/how-https-works.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/7715205587272693875'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/7715205587272693875'/><link rel='alternate' type='text/html' href='http://ravifirst.blogspot.com/2009/09/how-https-works.html' title='How Https Works ?'/><author><name>Ravi's</name><uri>http://www.blogger.com/profile/14359502815484562942</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_WxhoysBC8gY/StgCRfR-X5I/AAAAAAAAAJQ/l5Cd32MA2kk/S220/Rlogo.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7848011355253090856.post-6410224232336291366</id><published>2009-09-08T12:34:00.000+05:30</published><updated>2009-09-08T12:38:52.313+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Web'/><category scheme='http://www.blogger.com/atom/ns#' term='http'/><category scheme='http://www.blogger.com/atom/ns#' term='www'/><category scheme='http://www.blogger.com/atom/ns#' term='hyper text transfer protocol'/><category scheme='http://www.blogger.com/atom/ns#' term='ASP.NET'/><category scheme='http://www.blogger.com/atom/ns#' term='ssl'/><category scheme='http://www.blogger.com/atom/ns#' term='https'/><category scheme='http://www.blogger.com/atom/ns#' term='secure socket layer'/><title type='text'>What is Https ?</title><content type='html'>HTTPs is hypertext transfer protocol over Secure Socket Layer , which is responsible for sending and receiving confidential information with a server.So the information must be secured in order to prevent unauthorized access.HTTPS uses port 443 instead of HTTP port 80 in its interactions with the lower layer, TCP/IP.It is a Web protocol developed by Netscape and built into its browser that encrypts and decrypts user page requests as well as the pages that are returned by the Web server. HTTPS is really just the use of Netscapes Secure Socket Layer (SSL) as a sub layer under its regular HTTP application layering. This ensures reasonable protection from eavesdroppers. HTTPS is normally used in login pages, shopping/commercial sites etc.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7848011355253090856-6410224232336291366?l=ravifirst.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ravifirst.blogspot.com/feeds/6410224232336291366/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ravifirst.blogspot.com/2009/09/what-is-https.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/6410224232336291366'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/6410224232336291366'/><link rel='alternate' type='text/html' href='http://ravifirst.blogspot.com/2009/09/what-is-https.html' title='What is Https ?'/><author><name>Ravi's</name><uri>http://www.blogger.com/profile/14359502815484562942</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_WxhoysBC8gY/StgCRfR-X5I/AAAAAAAAAJQ/l5Cd32MA2kk/S220/Rlogo.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7848011355253090856.post-6932519766952304801</id><published>2009-09-08T12:07:00.000+05:30</published><updated>2009-09-08T12:34:52.478+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Web'/><category scheme='http://www.blogger.com/atom/ns#' term='http'/><category scheme='http://www.blogger.com/atom/ns#' term='www'/><category scheme='http://www.blogger.com/atom/ns#' term='hyper text transfer protocol'/><category scheme='http://www.blogger.com/atom/ns#' term='ASP.NET'/><title type='text'>What is Http ?</title><content type='html'>HTTP is hyper text transfer protocol which is responsible for sending and receiving information across the Internet.It is transmitted over the web via PORT 80(TCP).We normally use HTTP while browsing the web, but its not secure and so someone can eavesdrop the conversation between the web server and us.javascript:void(0)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7848011355253090856-6932519766952304801?l=ravifirst.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ravifirst.blogspot.com/feeds/6932519766952304801/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ravifirst.blogspot.com/2009/09/what-is-http.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/6932519766952304801'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/6932519766952304801'/><link rel='alternate' type='text/html' href='http://ravifirst.blogspot.com/2009/09/what-is-http.html' title='What is Http ?'/><author><name>Ravi's</name><uri>http://www.blogger.com/profile/14359502815484562942</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_WxhoysBC8gY/StgCRfR-X5I/AAAAAAAAAJQ/l5Cd32MA2kk/S220/Rlogo.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7848011355253090856.post-1099695861542817266</id><published>2009-09-03T13:52:00.002+05:30</published><updated>2009-09-03T14:04:51.873+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Y S Rajasekhara Reddy'/><category scheme='http://www.blogger.com/atom/ns#' term='Andhra CM'/><category scheme='http://www.blogger.com/atom/ns#' term='YSR Padayatra'/><category scheme='http://www.blogger.com/atom/ns#' term='YSR'/><title type='text'>YSR Pada Yatra</title><content type='html'>YSR burst onto the national stage with his padyatra during the campaign for the 2004 assembly elections.  Many saw him as the centerpiece of the Congress strategy against the all-powerful TDP.&lt;br /&gt;&lt;br /&gt;YSR expanded his political empire from Andhra Pradesh's feudal Reddy heartland.  He won 4 Lok Sabha and 4 Assembly elections from Kadappa.  He was credited publicly and often with being a leader with a huge mass base, a rarity in the Congress party.&lt;br /&gt;&lt;br /&gt;But his last term in office was marred by accusations of corruptions and scams.  His son's media empire expanded rapidly under his father's watch. Critics of the YSR regime, like the powerful Eenadu media group, were severely dealt with. Even the Satyam scandal, it was alleged, had an YSR connection.&lt;br /&gt;&lt;br /&gt;And when superstar Chiranjeevi decided to throw his weight into the last elections, many doubted what YSR would accomplish for the Congress.  But in his campaign, YSR claimed he was a development man.  He fought on the back of populist schemes: irrigation, pensions, schemes for women&lt;br /&gt;&lt;br /&gt;The YSR magic worked, and his party's victory was seen as hard evidence of a grassroots politician whose charisma trounced the controversy surrounding him.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7848011355253090856-1099695861542817266?l=ravifirst.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ravifirst.blogspot.com/feeds/1099695861542817266/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ravifirst.blogspot.com/2009/09/ysr-pada-yatra_03.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/1099695861542817266'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/1099695861542817266'/><link rel='alternate' type='text/html' href='http://ravifirst.blogspot.com/2009/09/ysr-pada-yatra_03.html' title='YSR Pada Yatra'/><author><name>Ravi's</name><uri>http://www.blogger.com/profile/14359502815484562942</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_WxhoysBC8gY/StgCRfR-X5I/AAAAAAAAAJQ/l5Cd32MA2kk/S220/Rlogo.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7848011355253090856.post-8680728176772397603</id><published>2009-09-03T13:49:00.000+05:30</published><updated>2009-09-03T13:51:26.126+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Y S Rajasekhara Reddy'/><category scheme='http://www.blogger.com/atom/ns#' term='Rudrakonda'/><category scheme='http://www.blogger.com/atom/ns#' term='Andhra CM'/><category scheme='http://www.blogger.com/atom/ns#' term='Kurnool'/><category scheme='http://www.blogger.com/atom/ns#' term='Pulivendula'/><category scheme='http://www.blogger.com/atom/ns#' term='Chopper Crash'/><category scheme='http://www.blogger.com/atom/ns#' term='AP Congress Leader'/><category scheme='http://www.blogger.com/atom/ns#' term='YSR'/><title type='text'>YSR killed in chopper crash: Express your condolences</title><content type='html'>I deeply regret the sudden demise of my beloved chief Minister Shri Y.S.Rajasekhar Reddy. My heart felt condolence to the departed great leader.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7848011355253090856-8680728176772397603?l=ravifirst.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ravifirst.blogspot.com/feeds/8680728176772397603/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ravifirst.blogspot.com/2009/09/ysr-killed-in-chopper-crash-express.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/8680728176772397603'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/8680728176772397603'/><link rel='alternate' type='text/html' href='http://ravifirst.blogspot.com/2009/09/ysr-killed-in-chopper-crash-express.html' title='YSR killed in chopper crash: Express your condolences'/><author><name>Ravi's</name><uri>http://www.blogger.com/profile/14359502815484562942</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_WxhoysBC8gY/StgCRfR-X5I/AAAAAAAAAJQ/l5Cd32MA2kk/S220/Rlogo.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7848011355253090856.post-7499673909314799870</id><published>2009-09-03T13:40:00.000+05:30</published><updated>2009-09-03T13:42:00.549+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Nallamalla Range'/><category scheme='http://www.blogger.com/atom/ns#' term='Y S Rajasekhara Reddy'/><category scheme='http://www.blogger.com/atom/ns#' term='Andhra CM'/><category scheme='http://www.blogger.com/atom/ns#' term='Kurnool'/><category scheme='http://www.blogger.com/atom/ns#' term='Chopper Crash'/><category scheme='http://www.blogger.com/atom/ns#' term='Wesley'/><category scheme='http://www.blogger.com/atom/ns#' term='AP Congress Leader'/><category scheme='http://www.blogger.com/atom/ns#' term='YSR'/><title type='text'>Who was there with YSR on his chopper</title><content type='html'>The bodies of Andhra Pradesh Chief Minister YSR Reddy, his Special Secretary P Subramanyam, Chief Secretary A S C Wesley, pilot Group Captain S K Bhatia and co-pilot M S Reddy were found on Rudrakonda Hill, 40 nautical miles east of Kurnool.&lt;br /&gt;&lt;br /&gt;Subramaniam was a 1983 batch officer and had been working at the Chief Minister's office for nearly five years. Chief Security Officer ASC Wesley had joined the Chief Minister's office just two moths ago.&lt;br /&gt;&lt;br /&gt;The two pilots on board the seven-seater Bell 430 helicopter had several hours of flying.&lt;br /&gt; &lt;br /&gt;According to reports, their bodies will be first flown to kurnool and then to Hyderabad.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7848011355253090856-7499673909314799870?l=ravifirst.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ravifirst.blogspot.com/feeds/7499673909314799870/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ravifirst.blogspot.com/2009/09/who-was-there-with-ysr-on-his-chopper.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/7499673909314799870'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/7499673909314799870'/><link rel='alternate' type='text/html' href='http://ravifirst.blogspot.com/2009/09/who-was-there-with-ysr-on-his-chopper.html' title='Who was there with YSR on his chopper'/><author><name>Ravi's</name><uri>http://www.blogger.com/profile/14359502815484562942</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_WxhoysBC8gY/StgCRfR-X5I/AAAAAAAAAJQ/l5Cd32MA2kk/S220/Rlogo.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7848011355253090856.post-2566602237784746388</id><published>2009-09-03T13:27:00.004+05:30</published><updated>2009-09-03T13:39:21.605+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Indian Air Force'/><category scheme='http://www.blogger.com/atom/ns#' term='Nallamalla Range'/><category scheme='http://www.blogger.com/atom/ns#' term='Y S Rajasekhara Reddy'/><category scheme='http://www.blogger.com/atom/ns#' term='Rudrakonda'/><category scheme='http://www.blogger.com/atom/ns#' term='Andhra CM'/><category scheme='http://www.blogger.com/atom/ns#' term='Kurnool'/><category scheme='http://www.blogger.com/atom/ns#' term='Chopper Crash'/><category scheme='http://www.blogger.com/atom/ns#' term='Wesley'/><category scheme='http://www.blogger.com/atom/ns#' term='AP Congress Leader'/><category scheme='http://www.blogger.com/atom/ns#' term='Andhrapradesh'/><category scheme='http://www.blogger.com/atom/ns#' term='YSR'/><title type='text'>YSR &amp; 4 others killed in chopper crash</title><content type='html'>Andhra Pradesh Chief Minister &lt;span style="font-weight:bold;"&gt;Y S Rajasekhara Reddy&lt;/span&gt; and four others including 2 Pilots Capt &lt;span style="font-weight:bold;"&gt;S K Bhatia&lt;/span&gt; and Capt &lt;span style="font-weight:bold;"&gt;M S Reddy&lt;/span&gt;, chief security officer &lt;span style="font-weight:bold;"&gt;A S C Wesley&lt;/span&gt; and his  special secretary &lt;span style="font-weight:bold;"&gt;P Subramaniam&lt;/span&gt; were killed when his helicopter crash-landed atop the Rudrakonda hill in the Nallamalla range, about 40 nautical miles east of Kurnool.&lt;br /&gt;&lt;br /&gt;  Indian Air Force personnel located the helicopter in the deep forests on Thursday morning, after 24 hours of massive land, air and satellite-backed search.&lt;br /&gt;&lt;br /&gt;  The 11-year-old Bell 430 helicopter with five on board had lost radio contact one hour after it took off from the old Begumpet Airport in Hyderabad on Wednesday 02 Sept 2009.&lt;br /&gt;&lt;br /&gt;  Highly placed Congress sources said the party was not in a hurry to convene the meeting of Congress Legislature Party to elect a leader and the same could take place after three or four days.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7848011355253090856-2566602237784746388?l=ravifirst.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ravifirst.blogspot.com/feeds/2566602237784746388/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ravifirst.blogspot.com/2009/09/ysr-4-others-killed-in-chopper-crash.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/2566602237784746388'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/2566602237784746388'/><link rel='alternate' type='text/html' href='http://ravifirst.blogspot.com/2009/09/ysr-4-others-killed-in-chopper-crash.html' title='YSR &amp; 4 others killed in chopper crash'/><author><name>Ravi's</name><uri>http://www.blogger.com/profile/14359502815484562942</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_WxhoysBC8gY/StgCRfR-X5I/AAAAAAAAAJQ/l5Cd32MA2kk/S220/Rlogo.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7848011355253090856.post-3761449914473012385</id><published>2009-08-15T11:53:00.007+05:30</published><updated>2009-08-15T12:20:35.238+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Sare Jaha se accha'/><category scheme='http://www.blogger.com/atom/ns#' term='Independence day message'/><category scheme='http://www.blogger.com/atom/ns#' term='Patriotic presentations'/><category scheme='http://www.blogger.com/atom/ns#' term='Hindustaan Hamara'/><category scheme='http://www.blogger.com/atom/ns#' term='Independence day speech'/><title type='text'>Sare jaha se accha Hindustaan Hamara Hamaaraaaa</title><content type='html'>"Long years ago we made a tryst with destiny, and now the time comes when we will redeem our pledge, not wholly or in full measure, but very substantially. At the stroke of the midnight hour, when the world sleeps, India will awake to life and freedom. A moment comes, which comes but rarely in history, when we step out from the old to the new, when an age ends and when the soul of a nation, long suppressed, finds utterance.... We end today a period of ill fortune, and India discovers herself again."&lt;br /&gt;&lt;div style="text-align:right"&gt;&lt;br /&gt;- Jawaharlal Nehru&lt;br /&gt;(Speech on Indian Independence Day, 1947)&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;On 15 August 1947, India attained freedom from the British Rule. Every year, August 15 is celebrated as the Independence Day in India. This national festival is celebrated with great enthusiasm all over the country.&lt;br /&gt;&lt;br /&gt;The Independence Day of any country is a moment of pride and glory. On this special occasion, rich tributes are paid to the freedom fighters who sacrificed their lives and fought to free their motherland from the clutches of the oppressors - British who ruled the country.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_WxhoysBC8gY/SoZaqc0UmqI/AAAAAAAAAHI/E4OGj259oOo/s1600-h/india.jpg"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 351px; height: 377px;" src="http://2.bp.blogspot.com/_WxhoysBC8gY/SoZaqc0UmqI/AAAAAAAAAHI/E4OGj259oOo/s400/india.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5370079291022547618" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The British, had initially come for trade but gradually took over the total administration of the country. &lt;br /&gt;&lt;br /&gt;At the strike of midnight of the August 15, 1947, India shook off the shackles of British Rule and became free. It was a night of celebration all over the country.&lt;br /&gt;&lt;br /&gt;Commemorating the day India attained freedom (15th August); Independence Day is celebrated with flag hoisting ceremonies and cultural programmes all over the country. The main program is held at the Red Fort where the Prime Minster unfurls the National Flag and it is saluted by Guns.&lt;br /&gt;&lt;br /&gt;The Prime Minister's speech at the Red Fort in Delhi is a major highlight. Patriotic presentations by school children add colors to the celebrations.&lt;br /&gt;&lt;br /&gt;Delhi’s skyline gets dotted with thousands of kites taking to the sky this day. Similar programmes are held at all the State capitals also.&lt;br /&gt;&lt;br /&gt;The preparations begin a month in advance. Roads are decorated with flags and buntings. Buildings of national importance are illuminated.&lt;br /&gt;&lt;br /&gt;&lt;center&gt;&lt;span style="font-weight:bold;"&gt;HAPPY INDEPENDENCE DAY&lt;/span&gt;&lt;/center&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7848011355253090856-3761449914473012385?l=ravifirst.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ravifirst.blogspot.com/feeds/3761449914473012385/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ravifirst.blogspot.com/2009/08/sare-jaha-se-accha-hindustaan-hamara.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/3761449914473012385'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/3761449914473012385'/><link rel='alternate' type='text/html' href='http://ravifirst.blogspot.com/2009/08/sare-jaha-se-accha-hindustaan-hamara.html' title='Sare jaha se accha Hindustaan Hamara Hamaaraaaa'/><author><name>Ravi's</name><uri>http://www.blogger.com/profile/14359502815484562942</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_WxhoysBC8gY/StgCRfR-X5I/AAAAAAAAAJQ/l5Cd32MA2kk/S220/Rlogo.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_WxhoysBC8gY/SoZaqc0UmqI/AAAAAAAAAHI/E4OGj259oOo/s72-c/india.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7848011355253090856.post-2902977006551329948</id><published>2009-08-10T14:17:00.001+05:30</published><updated>2009-08-10T14:19:15.559+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='analysis services'/><category scheme='http://www.blogger.com/atom/ns#' term='xml'/><category scheme='http://www.blogger.com/atom/ns#' term='Report builder'/><category scheme='http://www.blogger.com/atom/ns#' term='integration services'/><category scheme='http://www.blogger.com/atom/ns#' term='SSRS'/><category scheme='http://www.blogger.com/atom/ns#' term='sql interview'/><title type='text'>What new data source types were added in SSRS 2005?</title><content type='html'>In addition to the data source types available in SSRS 2000 (SQL Server, Oracle, ODBC, OLE DB), the following have been added in SSRS 2005:&lt;br /&gt;&lt;br /&gt;    * SQL Server 2005 Analysis Services&lt;br /&gt;    * SQL Server 2005 Integration Services&lt;br /&gt;    * SQL Server 2005 Report Builder Models&lt;br /&gt;    * XML (through URL and Web services)&lt;br /&gt;    * SAP (available through download)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7848011355253090856-2902977006551329948?l=ravifirst.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ravifirst.blogspot.com/feeds/2902977006551329948/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ravifirst.blogspot.com/2009/08/what-new-data-source-types-were-added.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/2902977006551329948'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/2902977006551329948'/><link rel='alternate' type='text/html' href='http://ravifirst.blogspot.com/2009/08/what-new-data-source-types-were-added.html' title='What new data source types were added in SSRS 2005?'/><author><name>Ravi's</name><uri>http://www.blogger.com/profile/14359502815484562942</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_WxhoysBC8gY/StgCRfR-X5I/AAAAAAAAAJQ/l5Cd32MA2kk/S220/Rlogo.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7848011355253090856.post-4744432388764028417</id><published>2009-08-10T14:16:00.000+05:30</published><updated>2009-08-10T14:17:22.654+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='reporting services'/><category scheme='http://www.blogger.com/atom/ns#' term='SSRS'/><category scheme='http://www.blogger.com/atom/ns#' term='visual studio to design reports'/><category scheme='http://www.blogger.com/atom/ns#' term='sql interview'/><title type='text'>Do I need Visual Studio 2005 to design reports?</title><content type='html'>No. Unlike SSRS 2000, which required users to purchase Visual Studio 2003, SQL Server 2005 comes with Business Intelligence Development Studio, which provides the Visual Studio shell and the business intelligence projects including Report Designer and Report Builder Model Designer. If users already have Visual Studio 2005, these projects are installed along with language projects.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7848011355253090856-4744432388764028417?l=ravifirst.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ravifirst.blogspot.com/feeds/4744432388764028417/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ravifirst.blogspot.com/2009/08/do-i-need-visual-studio-2005-to-design.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/4744432388764028417'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/4744432388764028417'/><link rel='alternate' type='text/html' href='http://ravifirst.blogspot.com/2009/08/do-i-need-visual-studio-2005-to-design.html' title='Do I need Visual Studio 2005 to design reports?'/><author><name>Ravi's</name><uri>http://www.blogger.com/profile/14359502815484562942</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_WxhoysBC8gY/StgCRfR-X5I/AAAAAAAAAJQ/l5Cd32MA2kk/S220/Rlogo.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7848011355253090856.post-3830247250909330311</id><published>2009-08-10T14:15:00.000+05:30</published><updated>2009-08-10T14:16:01.720+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='SQL FAQs'/><category scheme='http://www.blogger.com/atom/ns#' term='sql server'/><category scheme='http://www.blogger.com/atom/ns#' term='reporting services'/><category scheme='http://www.blogger.com/atom/ns#' term='Report builder'/><category scheme='http://www.blogger.com/atom/ns#' term='SSRS'/><category scheme='http://www.blogger.com/atom/ns#' term='sql interview'/><title type='text'>How do users use Report Builder with SQL Server data sources?</title><content type='html'>While models that provide access to SQL Server Analysis Services are automatically generated on the report server, the Report Builder Model Designer can be used to generate or modify the models that are built on top of SQL Server relational databases. These model-building projects are a new type of project within a Visual Studio–based development shell.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7848011355253090856-3830247250909330311?l=ravifirst.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ravifirst.blogspot.com/feeds/3830247250909330311/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ravifirst.blogspot.com/2009/08/how-do-users-use-report-builder-with.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/3830247250909330311'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/3830247250909330311'/><link rel='alternate' type='text/html' href='http://ravifirst.blogspot.com/2009/08/how-do-users-use-report-builder-with.html' title='How do users use Report Builder with SQL Server data sources?'/><author><name>Ravi's</name><uri>http://www.blogger.com/profile/14359502815484562942</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_WxhoysBC8gY/StgCRfR-X5I/AAAAAAAAAJQ/l5Cd32MA2kk/S220/Rlogo.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7848011355253090856.post-8209915278760286904</id><published>2009-08-10T14:13:00.002+05:30</published><updated>2009-08-10T14:14:59.758+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='reporting services'/><category scheme='http://www.blogger.com/atom/ns#' term='Report builder'/><category scheme='http://www.blogger.com/atom/ns#' term='SSRS'/><category scheme='http://www.blogger.com/atom/ns#' term='analysis services cubes'/><category scheme='http://www.blogger.com/atom/ns#' term='sql interview'/><title type='text'>How does Report Builder support Analysis Services cubes?</title><content type='html'>Report Builder supports relational SQL and Analysis Services data sources in SQL Server 2005. To create a model for Analysis Services cube, go to Report Manager or Management Studio, create a data source for your Analysis Services database, and then select the Generate Model option to create the model.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7848011355253090856-8209915278760286904?l=ravifirst.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ravifirst.blogspot.com/feeds/8209915278760286904/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ravifirst.blogspot.com/2009/08/how-does-report-builder-support.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/8209915278760286904'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/8209915278760286904'/><link rel='alternate' type='text/html' href='http://ravifirst.blogspot.com/2009/08/how-does-report-builder-support.html' title='How does Report Builder support Analysis Services cubes?'/><author><name>Ravi's</name><uri>http://www.blogger.com/profile/14359502815484562942</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_WxhoysBC8gY/StgCRfR-X5I/AAAAAAAAAJQ/l5Cd32MA2kk/S220/Rlogo.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7848011355253090856.post-9056045908582270419</id><published>2009-08-10T14:13:00.001+05:30</published><updated>2009-08-10T14:13:48.672+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='SQL FAQs'/><category scheme='http://www.blogger.com/atom/ns#' term='reporting services'/><category scheme='http://www.blogger.com/atom/ns#' term='Report builder'/><category scheme='http://www.blogger.com/atom/ns#' term='SSRS'/><category scheme='http://www.blogger.com/atom/ns#' term='sql interview'/><title type='text'>What is Report Builder?</title><content type='html'>Report Builder is a business-user, ad-hoc report design client that allows users to design reports based on the business terms (Report Builder model) they are familiar with, but without needing to understand database schemas or how to write SQL or MDX queries. Report Builder works with both SQL Server and Analysis Services data sources.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7848011355253090856-9056045908582270419?l=ravifirst.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ravifirst.blogspot.com/feeds/9056045908582270419/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ravifirst.blogspot.com/2009/08/what-is-report-builder.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/9056045908582270419'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/9056045908582270419'/><link rel='alternate' type='text/html' href='http://ravifirst.blogspot.com/2009/08/what-is-report-builder.html' title='What is Report Builder?'/><author><name>Ravi's</name><uri>http://www.blogger.com/profile/14359502815484562942</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_WxhoysBC8gY/StgCRfR-X5I/AAAAAAAAAJQ/l5Cd32MA2kk/S220/Rlogo.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7848011355253090856.post-1111440034505281944</id><published>2009-08-10T14:11:00.001+05:30</published><updated>2009-08-10T14:12:52.117+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='sql server'/><category scheme='http://www.blogger.com/atom/ns#' term='reporting services'/><category scheme='http://www.blogger.com/atom/ns#' term='report manager'/><category scheme='http://www.blogger.com/atom/ns#' term='SSRS'/><category scheme='http://www.blogger.com/atom/ns#' term='sql interview'/><title type='text'>What tools can be used to manage SSRS 2005?</title><content type='html'>Report Manager, the Web-based management tool, is still available in SSRS 2005. In additions, all of the Report Manager functionality is now available in SQL Server 2000 Management Studio, a Windows-based console that gives you a single place to manage all components of SQL Server. Finally, a new Reporting Services Configuration tool allows you to manage various aspects of your report server, including service identities and database connections.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7848011355253090856-1111440034505281944?l=ravifirst.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ravifirst.blogspot.com/feeds/1111440034505281944/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ravifirst.blogspot.com/2009/08/what-tools-can-be-used-to-manage-ssrs.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/1111440034505281944'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/1111440034505281944'/><link rel='alternate' type='text/html' href='http://ravifirst.blogspot.com/2009/08/what-tools-can-be-used-to-manage-ssrs.html' title='What tools can be used to manage SSRS 2005?'/><author><name>Ravi's</name><uri>http://www.blogger.com/profile/14359502815484562942</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_WxhoysBC8gY/StgCRfR-X5I/AAAAAAAAAJQ/l5Cd32MA2kk/S220/Rlogo.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7848011355253090856.post-7800950839467631392</id><published>2009-08-10T14:09:00.000+05:30</published><updated>2009-08-10T14:10:58.924+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='SQL FAQs'/><category scheme='http://www.blogger.com/atom/ns#' term='reporting services'/><category scheme='http://www.blogger.com/atom/ns#' term='SSRS'/><category scheme='http://www.blogger.com/atom/ns#' term='sql interview'/><title type='text'>How to upgrade from SQL Server 2000 Reporting Services to SQL Server 2005 Reporting Services?</title><content type='html'>You can upgrade most installations using the SQL Server 2005 setup program. All report server content and settings will be fully functional after the upgrade process.&lt;br /&gt;&lt;br /&gt;In cases where you have customized your report server deployment (added extensions, changed virtual directory settings, or encrypted the ASP.NET account user name in the registry), you will need to migrate your Reporting Services installation. In this case, you install a new instance of SSRS 2005 and use the Reporting Services configuration tool to migrate settings.&lt;br /&gt;&lt;br /&gt;If you deployed custom extensions for Reporting Services 2000, you may need to rebuild these extensions so that SSRS 2005 can use them. Consult SQL Server Books Online for specific instructions on what you need to do to move to SSRS 2005.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7848011355253090856-7800950839467631392?l=ravifirst.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ravifirst.blogspot.com/feeds/7800950839467631392/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ravifirst.blogspot.com/2009/08/how-to-upgrade-from-sql-server-2000.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/7800950839467631392'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/7800950839467631392'/><link rel='alternate' type='text/html' href='http://ravifirst.blogspot.com/2009/08/how-to-upgrade-from-sql-server-2000.html' title='How to upgrade from SQL Server 2000 Reporting Services to SQL Server 2005 Reporting Services?'/><author><name>Ravi's</name><uri>http://www.blogger.com/profile/14359502815484562942</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_WxhoysBC8gY/StgCRfR-X5I/AAAAAAAAAJQ/l5Cd32MA2kk/S220/Rlogo.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7848011355253090856.post-1288354592711335562</id><published>2009-08-10T14:07:00.001+05:30</published><updated>2009-08-10T14:09:35.810+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='SQL FAQs'/><category scheme='http://www.blogger.com/atom/ns#' term='sql server 2005'/><category scheme='http://www.blogger.com/atom/ns#' term='reporting services'/><category scheme='http://www.blogger.com/atom/ns#' term='Report builder'/><category scheme='http://www.blogger.com/atom/ns#' term='SSRS'/><category scheme='http://www.blogger.com/atom/ns#' term='sql interview'/><title type='text'>What’s new in SQL Server 2005 Reporting Services?</title><content type='html'>SQL Server 2005 retains the core functionality of SQL Server 2000 Reporting Services. The product contains several key additions and enhancements, including the following:&lt;br /&gt;&lt;br /&gt;    * Report Builder (end-user reporting)&lt;br /&gt;    * Report Controls (ships with Microsoft Visual Studio 2005)&lt;br /&gt;    * Direct client printing (first shipped in SQL Server 2000 Service Pack 2)&lt;br /&gt;    * SharePoint Reporting Web Parts (first shipped in SQL Server 2000 Service Pack 2)&lt;br /&gt;    * End-user sort&lt;br /&gt;    * Multivalued parameters&lt;br /&gt;    * Custom report items&lt;br /&gt;    * Report Designer improvements&lt;br /&gt;    * Analysis Services Query Designer&lt;br /&gt;    * Management Studio integration&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7848011355253090856-1288354592711335562?l=ravifirst.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ravifirst.blogspot.com/feeds/1288354592711335562/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ravifirst.blogspot.com/2009/08/whats-new-in-sql-server-2005-reporting.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/1288354592711335562'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/1288354592711335562'/><link rel='alternate' type='text/html' href='http://ravifirst.blogspot.com/2009/08/whats-new-in-sql-server-2005-reporting.html' title='What’s new in SQL Server 2005 Reporting Services?'/><author><name>Ravi's</name><uri>http://www.blogger.com/profile/14359502815484562942</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_WxhoysBC8gY/StgCRfR-X5I/AAAAAAAAAJQ/l5Cd32MA2kk/S220/Rlogo.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7848011355253090856.post-8723281710683849117</id><published>2009-08-10T14:03:00.002+05:30</published><updated>2009-08-10T14:07:29.240+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='SQL FAQs'/><category scheme='http://www.blogger.com/atom/ns#' term='sql server 2005'/><category scheme='http://www.blogger.com/atom/ns#' term='reporting services'/><category scheme='http://www.blogger.com/atom/ns#' term='SSRS'/><category scheme='http://www.blogger.com/atom/ns#' term='sql interview'/><title type='text'>What is SQL Server 2005 Reporting Services?</title><content type='html'>SQL Server 2005 Reporting Services is a server-based enterprise reporting environment, managed through Web services, that delivers a variety of interactive and printed reports.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7848011355253090856-8723281710683849117?l=ravifirst.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ravifirst.blogspot.com/feeds/8723281710683849117/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ravifirst.blogspot.com/2009/08/what-is-sql-server-2005-reporting.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/8723281710683849117'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/8723281710683849117'/><link rel='alternate' type='text/html' href='http://ravifirst.blogspot.com/2009/08/what-is-sql-server-2005-reporting.html' title='What is SQL Server 2005 Reporting Services?'/><author><name>Ravi's</name><uri>http://www.blogger.com/profile/14359502815484562942</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_WxhoysBC8gY/StgCRfR-X5I/AAAAAAAAAJQ/l5Cd32MA2kk/S220/Rlogo.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7848011355253090856.post-2944127928025731233</id><published>2009-07-28T12:29:00.018+05:30</published><updated>2009-10-29T18:39:11.369+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='IS Retail Training hyderabad'/><category scheme='http://www.blogger.com/atom/ns#' term='sap is retail'/><category scheme='http://www.blogger.com/atom/ns#' term='online training hyderabad'/><category scheme='http://www.blogger.com/atom/ns#' term='sap online training'/><title type='text'>SAP IS Retail Online Training</title><content type='html'>Dear Aspirant,&lt;br /&gt;&lt;br /&gt;Greetings from SAP Trainers.&lt;br /&gt;&lt;br /&gt;Exceptional SAP courses (SD, CRM &amp; IS – Retail) available, fully tailored to meet market requirements with the added bonus of free SAP Server Access for 2 months.&lt;br /&gt;&lt;br /&gt;You will be trained with a certified Consultant with industry experience.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;SAP IS Retail 30Hr. Duration and course fee is $200 only&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;For more Details&lt;br /&gt;Email : 4saptrainer@gmail.com&lt;br /&gt;Skype ID : saptrainers&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7848011355253090856-2944127928025731233?l=ravifirst.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ravifirst.blogspot.com/feeds/2944127928025731233/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ravifirst.blogspot.com/2009/07/opening-file-in-php.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/2944127928025731233'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/2944127928025731233'/><link rel='alternate' type='text/html' href='http://ravifirst.blogspot.com/2009/07/opening-file-in-php.html' title='SAP IS Retail Online Training'/><author><name>Ravi's</name><uri>http://www.blogger.com/profile/14359502815484562942</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_WxhoysBC8gY/StgCRfR-X5I/AAAAAAAAAJQ/l5Cd32MA2kk/S220/Rlogo.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7848011355253090856.post-9080036573473223946</id><published>2009-07-27T15:28:00.003+05:30</published><updated>2009-10-29T18:39:36.680+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='sap crm'/><category scheme='http://www.blogger.com/atom/ns#' term='online training hyderabad'/><category scheme='http://www.blogger.com/atom/ns#' term='crm online training'/><category scheme='http://www.blogger.com/atom/ns#' term='sap online training'/><title type='text'>SAP CRM Online Training</title><content type='html'>Dear Aspirant,&lt;br /&gt;&lt;br /&gt;Greetings from SAP Trainers.&lt;br /&gt;&lt;br /&gt;Exceptional SAP courses (SD, CRM &amp; IS – Retail) available, fully tailored to meet market requirements with the added bonus of free SAP Server Access for 2 months.&lt;br /&gt;&lt;br /&gt;You will be trained with a certified Consultant with industry experience.&lt;br /&gt;&lt;br /&gt;This course not will only deliver the SAP module training,but also the understanding of ASAP methodology.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;SAP CRM 30Hr. Duration and course fee is $150 only&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;For more Details&lt;br /&gt;Email : 4saptrainer@gmail.com&lt;br /&gt;Skype ID : saptrainers&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7848011355253090856-9080036573473223946?l=ravifirst.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ravifirst.blogspot.com/feeds/9080036573473223946/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ravifirst.blogspot.com/2009/07/sap-crm-online-training.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/9080036573473223946'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/9080036573473223946'/><link rel='alternate' type='text/html' href='http://ravifirst.blogspot.com/2009/07/sap-crm-online-training.html' title='SAP CRM Online Training'/><author><name>Ravi's</name><uri>http://www.blogger.com/profile/14359502815484562942</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_WxhoysBC8gY/StgCRfR-X5I/AAAAAAAAAJQ/l5Cd32MA2kk/S220/Rlogo.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7848011355253090856.post-7445480047246938704</id><published>2009-07-26T11:07:00.003+05:30</published><updated>2009-10-29T18:40:01.816+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='sap sd'/><category scheme='http://www.blogger.com/atom/ns#' term='sap'/><category scheme='http://www.blogger.com/atom/ns#' term='online training hyderabad'/><category scheme='http://www.blogger.com/atom/ns#' term='sd online training'/><category scheme='http://www.blogger.com/atom/ns#' term='sap online training'/><title type='text'>SAP SD Online Training</title><content type='html'>Dear Aspirant,&lt;br /&gt;&lt;br /&gt;Greetings from SAP Trainers.&lt;br /&gt;&lt;br /&gt;Exceptional SAP courses (SD, CRM &amp; IS – Retail) available, fully tailored to meet market requirements with the added bonus of free SAP Server Access for 2 months.&lt;br /&gt;&lt;br /&gt;You will be trained with a certified Consultant with industry experience.&lt;br /&gt;&lt;br /&gt;This course not will only deliver the SAP module training,but also the understanding of ASAP methodology.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;SAP SD 30Hr. Duration and course fee is $150 only&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;For more Details&lt;br /&gt;Email : 4saptrainer@gmail.com&lt;br /&gt;Skype ID : saptrainers&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7848011355253090856-7445480047246938704?l=ravifirst.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ravifirst.blogspot.com/feeds/7445480047246938704/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ravifirst.blogspot.com/2009/07/sap-sd-online-training.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/7445480047246938704'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/7445480047246938704'/><link rel='alternate' type='text/html' href='http://ravifirst.blogspot.com/2009/07/sap-sd-online-training.html' title='SAP SD Online Training'/><author><name>Ravi's</name><uri>http://www.blogger.com/profile/14359502815484562942</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_WxhoysBC8gY/StgCRfR-X5I/AAAAAAAAAJQ/l5Cd32MA2kk/S220/Rlogo.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7848011355253090856.post-4663422027340516373</id><published>2009-07-26T11:00:00.002+05:30</published><updated>2009-07-26T11:05:06.679+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='download free php'/><category scheme='http://www.blogger.com/atom/ns#' term='PHP'/><category scheme='http://www.blogger.com/atom/ns#' term='PHP vs IIS'/><title type='text'>Why PHP ?</title><content type='html'>&gt; PHP runs on different platforms (Windows, Linux, Unix, etc.) &lt;br /&gt;&lt;br /&gt;&gt; PHP is compatible with almost all servers used today (Apache, IIS, etc.) &lt;br /&gt;&lt;br /&gt;&gt; PHP is FREE to download from the official PHP resource: &lt;a href="http://www.php.net/downloads.php"&gt;www.php.net&lt;/a&gt; &lt;br /&gt;&lt;br /&gt;&gt; PHP is easy to learn and runs efficiently on the server side&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7848011355253090856-4663422027340516373?l=ravifirst.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ravifirst.blogspot.com/feeds/4663422027340516373/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ravifirst.blogspot.com/2009/07/why-php.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/4663422027340516373'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/4663422027340516373'/><link rel='alternate' type='text/html' href='http://ravifirst.blogspot.com/2009/07/why-php.html' title='Why PHP ?'/><author><name>Ravi's</name><uri>http://www.blogger.com/profile/14359502815484562942</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_WxhoysBC8gY/StgCRfR-X5I/AAAAAAAAAJQ/l5Cd32MA2kk/S220/Rlogo.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7848011355253090856.post-5061632760827497107</id><published>2009-07-26T10:56:00.003+05:30</published><updated>2009-07-26T11:04:32.661+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='PHP'/><category scheme='http://www.blogger.com/atom/ns#' term='PHP + MYSQL'/><category scheme='http://www.blogger.com/atom/ns#' term='cross-platform'/><category scheme='http://www.blogger.com/atom/ns#' term='MYSQL'/><category scheme='http://www.blogger.com/atom/ns#' term='what is MYSQL'/><title type='text'>What is MYSQL ?</title><content type='html'>&gt; MySQL is a database server &lt;br /&gt;&lt;br /&gt;&gt; MySQL is ideal for both small and large applications &lt;br /&gt;&lt;br /&gt;&gt; MySQL supports standard SQL &lt;br /&gt;&lt;br /&gt;&gt; MySQL compiles on a number of platforms &lt;br /&gt;&lt;br /&gt;&gt; MySQL is free to &lt;a href="http://www.mysql.com/downloads/index.html"&gt;download&lt;/a&gt; and use &lt;br /&gt;&lt;br /&gt;&lt;strong&gt;PHP + MYSQL&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&gt; PHP combined with MySQL are cross-platform (you can develop in Windows and serve on a Unix platform)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7848011355253090856-5061632760827497107?l=ravifirst.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ravifirst.blogspot.com/feeds/5061632760827497107/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ravifirst.blogspot.com/2009/07/what-is-mysql.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/5061632760827497107'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/5061632760827497107'/><link rel='alternate' type='text/html' href='http://ravifirst.blogspot.com/2009/07/what-is-mysql.html' title='What is MYSQL ?'/><author><name>Ravi's</name><uri>http://www.blogger.com/profile/14359502815484562942</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_WxhoysBC8gY/StgCRfR-X5I/AAAAAAAAAJQ/l5Cd32MA2kk/S220/Rlogo.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7848011355253090856.post-8877420629953895761</id><published>2009-07-26T10:50:00.006+05:30</published><updated>2009-07-26T11:05:28.144+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='download free php'/><category scheme='http://www.blogger.com/atom/ns#' term='PHP'/><category scheme='http://www.blogger.com/atom/ns#' term='what is php'/><category scheme='http://www.blogger.com/atom/ns#' term='server side scripting'/><category scheme='http://www.blogger.com/atom/ns#' term='what is php file'/><title type='text'>What is PHP  &amp;  PHP FILE ?</title><content type='html'>PHP is a server-side scripting language.&lt;br /&gt;&lt;br /&gt;Before you getting started with PHP you should have a basic understanding of the following:&lt;br /&gt;&lt;br /&gt;&gt; HTML/XHTML &lt;br /&gt;&gt; JavaScript &lt;br /&gt;&lt;br /&gt;PHP stands for &lt;strong&gt;PHP: Hypertext Preprocessor&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;PHP is a server-side scripting language, like ASP &lt;br /&gt;&lt;br /&gt;PHP scripts are executed on the server &lt;br /&gt;&lt;br /&gt;PHP supports many databases (MySQL, Informix, Oracle, Sybase, Solid, PostgreSQL, Generic ODBC, etc.) &lt;br /&gt;&lt;br /&gt;PHP is an open source software &lt;br /&gt;&lt;br /&gt;PHP is free to &lt;a href="http://www.php.net/downloads.php"&gt;download&lt;/a&gt; and use &lt;br /&gt;&lt;br /&gt;&lt;strong&gt;PHP FILE&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&gt; PHP files can contain text, HTML tags and scripts &lt;br /&gt;&gt; PHP files are returned to the browser as plain HTML  &lt;br /&gt;&gt; PHP files have a file extension of ".php", ".php3", or ".phtml"&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7848011355253090856-8877420629953895761?l=ravifirst.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ravifirst.blogspot.com/feeds/8877420629953895761/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ravifirst.blogspot.com/2009/07/what-is-php-php-file.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/8877420629953895761'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/8877420629953895761'/><link rel='alternate' type='text/html' href='http://ravifirst.blogspot.com/2009/07/what-is-php-php-file.html' title='What is PHP  &amp;  PHP FILE ?'/><author><name>Ravi's</name><uri>http://www.blogger.com/profile/14359502815484562942</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_WxhoysBC8gY/StgCRfR-X5I/AAAAAAAAAJQ/l5Cd32MA2kk/S220/Rlogo.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7848011355253090856.post-5613345995693349107</id><published>2009-07-25T13:59:00.003+05:30</published><updated>2009-07-25T14:07:07.969+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='stored procedures'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL FAQs'/><category scheme='http://www.blogger.com/atom/ns#' term='advanced search'/><category scheme='http://www.blogger.com/atom/ns#' term='sql server'/><category scheme='http://www.blogger.com/atom/ns#' term='case sensitive search in sql server'/><title type='text'>Perform Case Sensitive Searches in SQL Server</title><content type='html'>By default, SQL Server 7.0 installation sets up SQL Server to run in a case insensitive mode. For most applications this may work great, but there are certain situations were case sensitive searches are required. For instance, if a web site needs to have passwords that are case sensitive a method needs to be devised to perform case-sensitive queries. The following script performs a case-sensitive search. &lt;br /&gt;&lt;br /&gt;First let’s create a table:&lt;br /&gt;&lt;br /&gt;&lt;div style='width:390px;height:auto;overflow:scroll'&gt;&lt;br /&gt;CREATE TABLE test &lt;br /&gt;(&lt;br /&gt; id  INT NOT NULL,&lt;br /&gt; msg  VARCHAR(100) NOT NULL&lt;br /&gt;)&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Now let’s insert some case sensitive data into it:&lt;br /&gt;&lt;br /&gt;&lt;div style='width:390px;height:auto;overflow:scroll'&gt;&lt;br /&gt;INSERT INTO test (id, msg) VALUES (1, 'bUSY');&lt;br /&gt;INSERT INTO test (id, msg) VALUES (2, 'BUSY');&lt;br /&gt;INSERT INTO test (id, msg) VALUES (3, 'busy');&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;  In our test we are searching for a ‘bUSY’ value in the msg column of the test table. So the syntax of the same query, if the SQL Server was set to be case sensitive, would be:&lt;br /&gt;&lt;br /&gt;&lt;div style='width:390px;height:auto;overflow:scroll'&gt;&lt;br /&gt;SELECT * FROM test where msg = ‘bUSY’;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;   This query will return all rows in the test table. Now, here is the script that will perform the case sensitive search.&lt;br /&gt;&lt;br /&gt;&lt;div style='width:390px;height:290px;overflow:scroll'&gt;&lt;br /&gt;DECLARE @table VARCHAR( 30 ) &lt;br /&gt;DECLARE @col VARCHAR( 30 ) &lt;br /&gt;DECLARE @searchVal VARCHAR( 195 ) &lt;br /&gt;&lt;br /&gt;SET @table = 'test'&lt;br /&gt;SET @col = 'msg'&lt;br /&gt;SET @searchVal = 'bUSY'&lt;br /&gt;&lt;br /&gt;DECLARE @sql VARCHAR( 255 ) &lt;br /&gt;DECLARE @colLength VARCHAR( 3 ) &lt;br /&gt;&lt;br /&gt;SELECT @colLength = CONVERT( varchar(3), DATALENGTH( @searchVal ) ) &lt;br /&gt;&lt;br /&gt;SELECT @sql = 'SELECT * ' + &lt;br /&gt;' FROM ' + @table + &lt;br /&gt;' WHERE' + &lt;br /&gt;' CONVERT( varbinary( ' + @colLength + '), ' + @col + ') = ' + &lt;br /&gt;' CONVERT( varbinary( ' + @colLength + '), "' + @searchVal + '")' + &lt;br /&gt;' AND ' + @col + '="' + @searchVal + '"' &lt;br /&gt;&lt;br /&gt;EXEC( @sql )&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7848011355253090856-5613345995693349107?l=ravifirst.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ravifirst.blogspot.com/feeds/5613345995693349107/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ravifirst.blogspot.com/2009/07/perform-case-sensitive-searches-in-sql.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/5613345995693349107'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/5613345995693349107'/><link rel='alternate' type='text/html' href='http://ravifirst.blogspot.com/2009/07/perform-case-sensitive-searches-in-sql.html' title='Perform Case Sensitive Searches in SQL Server'/><author><name>Ravi's</name><uri>http://www.blogger.com/profile/14359502815484562942</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_WxhoysBC8gY/StgCRfR-X5I/AAAAAAAAAJQ/l5Cd32MA2kk/S220/Rlogo.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7848011355253090856.post-3750158658234023605</id><published>2009-07-25T13:55:00.002+05:30</published><updated>2009-07-25T13:57:48.598+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='constraining table'/><category scheme='http://www.blogger.com/atom/ns#' term='cascade delete'/><category scheme='http://www.blogger.com/atom/ns#' term='procedural language'/><category scheme='http://www.blogger.com/atom/ns#' term='mutating table'/><category scheme='http://www.blogger.com/atom/ns#' term='triggers'/><category scheme='http://www.blogger.com/atom/ns#' term='oracle faqs'/><title type='text'>Mutating and Constraining table?</title><content type='html'>"Mutating" means "changing". A mutating table is a table that is currently being modified by an update, delete, or insert statement. When a trigger tries to reference a table that is in state of flux (being changed), it is considered "mutating" and raises an error since Oracle should not return data that has not yet reached its final state. &lt;br /&gt;&lt;br /&gt;Another way this error can occur is if the trigger has statements to change the primary, foreign or unique key columns of the table off which it fires. If you must have triggers on tables that have referential constraints, the workaround is to enforce the referential integrity through triggers as well. &lt;br /&gt;&lt;br /&gt;There are several restrictions in Oracle regarding triggers: &lt;br /&gt;&lt;br /&gt;• A row-level trigger cannot query or modify a mutating table. (Of course, NEW and OLD still can be accessed by the trigger) . &lt;br /&gt;&lt;br /&gt;• A statement-level trigger cannot query or modify a mutating table if the trigger is fired as the result of a CASCADE delete.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7848011355253090856-3750158658234023605?l=ravifirst.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ravifirst.blogspot.com/feeds/3750158658234023605/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ravifirst.blogspot.com/2009/07/mutating-and-constraining-table.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/3750158658234023605'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/3750158658234023605'/><link rel='alternate' type='text/html' href='http://ravifirst.blogspot.com/2009/07/mutating-and-constraining-table.html' title='Mutating and Constraining table?'/><author><name>Ravi's</name><uri>http://www.blogger.com/profile/14359502815484562942</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_WxhoysBC8gY/StgCRfR-X5I/AAAAAAAAAJQ/l5Cd32MA2kk/S220/Rlogo.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7848011355253090856.post-8327143005613452978</id><published>2009-07-25T13:47:00.001+05:30</published><updated>2009-07-25T13:54:50.135+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='procedural language'/><category scheme='http://www.blogger.com/atom/ns#' term='loop through tables in pl/sql'/><category scheme='http://www.blogger.com/atom/ns#' term='PL/SQL'/><category scheme='http://www.blogger.com/atom/ns#' term='cursors'/><category scheme='http://www.blogger.com/atom/ns#' term='oracle faqs'/><title type='text'>Loop through tables in PL/SQL</title><content type='html'>Look at the following nested loop code example. &lt;br /&gt;&lt;div style='width:390px;height:auto;overflow:scroll'&gt;&lt;br /&gt; DECLARE&lt;br /&gt;    CURSOR dept_cur IS&lt;br /&gt;    SELECT deptno&lt;br /&gt;      FROM dept&lt;br /&gt;     ORDER BY deptno;&lt;br /&gt;    -- Employee cursor all employees for a dept number&lt;br /&gt;    CURSOR emp_cur (v_dept_no DEPT.DEPTNO%TYPE) IS&lt;br /&gt;    SELECT ename&lt;br /&gt;      FROM emp&lt;br /&gt;     WHERE deptno = v_dept_no;&lt;br /&gt; BEGIN&lt;br /&gt;    FOR dept_rec IN dept_cur LOOP&lt;br /&gt;       dbms_output.put_line('Employees in Department '||TO_CHAR(dept_rec.deptno));&lt;br /&gt;       FOR emp_rec in emp_cur(dept_rec.deptno) LOOP&lt;br /&gt;          dbms_output.put_line('...Employee is '||emp_rec.ename);&lt;br /&gt;       END LOOP;&lt;br /&gt;   END LOOP;&lt;br /&gt; END;&lt;br /&gt; /&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7848011355253090856-8327143005613452978?l=ravifirst.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ravifirst.blogspot.com/feeds/8327143005613452978/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ravifirst.blogspot.com/2009/07/loop-through-tables-in-plsql.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/8327143005613452978'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/8327143005613452978'/><link rel='alternate' type='text/html' href='http://ravifirst.blogspot.com/2009/07/loop-through-tables-in-plsql.html' title='Loop through tables in PL/SQL'/><author><name>Ravi's</name><uri>http://www.blogger.com/profile/14359502815484562942</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_WxhoysBC8gY/StgCRfR-X5I/AAAAAAAAAJQ/l5Cd32MA2kk/S220/Rlogo.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7848011355253090856.post-6069307184278611449</id><published>2009-07-25T13:44:00.002+05:30</published><updated>2009-07-25T13:46:57.527+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='procedural language'/><category scheme='http://www.blogger.com/atom/ns#' term='DBMS_PIPE'/><category scheme='http://www.blogger.com/atom/ns#' term='PL/SQL'/><category scheme='http://www.blogger.com/atom/ns#' term='operating system command from PL/SQL'/><category scheme='http://www.blogger.com/atom/ns#' term='oracle faqs'/><title type='text'>Executing an operating system command from PL/SQL</title><content type='html'>There is no direct way to execute operating system commands from PL/SQL in Oracle7. However, one can write an external program (using one of the precompiler languages, OCI or Perl with Oracle access modules) to act as a listener on a database pipe (SYS.DBMS_PIPE). Your PL/SQL program then put requests to run commands in the pipe, the listener picks it up and run the requests. Results are passed back on a different database pipe. &lt;br /&gt;&lt;br /&gt;       In Oracle8 one can call external 3GL code in a dynamically linked library (DLL or shared object). One just write a library in C/ C++ to do whatever is required. Defining this C/C++ function to PL/SQL makes it executable.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7848011355253090856-6069307184278611449?l=ravifirst.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ravifirst.blogspot.com/feeds/6069307184278611449/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ravifirst.blogspot.com/2009/07/executing-operating-system-command-from.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/6069307184278611449'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/6069307184278611449'/><link rel='alternate' type='text/html' href='http://ravifirst.blogspot.com/2009/07/executing-operating-system-command-from.html' title='Executing an operating system command from PL/SQL'/><author><name>Ravi's</name><uri>http://www.blogger.com/profile/14359502815484562942</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_WxhoysBC8gY/StgCRfR-X5I/AAAAAAAAAJQ/l5Cd32MA2kk/S220/Rlogo.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7848011355253090856.post-2321785474220394481</id><published>2009-07-25T13:42:00.001+05:30</published><updated>2009-07-25T13:43:58.126+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='procedural language'/><category scheme='http://www.blogger.com/atom/ns#' term='PL/SQL'/><category scheme='http://www.blogger.com/atom/ns#' term='What is NULL'/><category scheme='http://www.blogger.com/atom/ns#' term='NULL'/><category scheme='http://www.blogger.com/atom/ns#' term='comparing NULL with NULL'/><category scheme='http://www.blogger.com/atom/ns#' term='oracle faqs'/><title type='text'>What is the result of comparing NULL with NULL?</title><content type='html'>NULL is neither equal to NULL, nor it is not equal to NULL. Any comparison to NULL is evaluated to NULL. &lt;br /&gt;&lt;br /&gt;Look at this code example to convince yourself. &lt;br /&gt;&lt;br /&gt; declare&lt;br /&gt;   a number := NULL;&lt;br /&gt;   b number := NULL;&lt;br /&gt; begin&lt;br /&gt;   if a=b then&lt;br /&gt;      dbms_output.put_line('True, NULL = NULL');&lt;br /&gt;   elsif a&lt;&gt;b then&lt;br /&gt;      dbms_output.put_line('False, NULL &lt;&gt; NULL');&lt;br /&gt;   else&lt;br /&gt;      dbms_output.put_line('Undefined NULL is neither = nor &lt;&gt; to NULL');&lt;br /&gt;   end if;&lt;br /&gt; end;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7848011355253090856-2321785474220394481?l=ravifirst.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ravifirst.blogspot.com/feeds/2321785474220394481/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ravifirst.blogspot.com/2009/07/what-is-result-of-comparing-null-with.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/2321785474220394481'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/2321785474220394481'/><link rel='alternate' type='text/html' href='http://ravifirst.blogspot.com/2009/07/what-is-result-of-comparing-null-with.html' title='What is the result of comparing NULL with NULL?'/><author><name>Ravi's</name><uri>http://www.blogger.com/profile/14359502815484562942</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_WxhoysBC8gY/StgCRfR-X5I/AAAAAAAAAJQ/l5Cd32MA2kk/S220/Rlogo.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7848011355253090856.post-813552671918641492</id><published>2009-07-25T13:40:00.001+05:30</published><updated>2009-07-25T13:42:09.917+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='procedural language'/><category scheme='http://www.blogger.com/atom/ns#' term='PL/SQL'/><category scheme='http://www.blogger.com/atom/ns#' term='%TYPE vs %ROWTYPE'/><category scheme='http://www.blogger.com/atom/ns#' term='oracle faqs'/><category scheme='http://www.blogger.com/atom/ns#' term='%TYPE'/><category scheme='http://www.blogger.com/atom/ns#' term='%ROWTYPE'/><title type='text'>Difference between %TYPE and %ROWTYPE?</title><content type='html'>The %TYPE and %ROWTYPE constructs provide data independence, reduces maintenance costs, and allows programs to adapt as the database changes to meet new business needs. &lt;br /&gt;&lt;br /&gt;   %ROWTYPE is used to declare a record with the same types as found in the specified database table, view or cursor.&lt;br /&gt;&lt;br /&gt; Example:&lt;br /&gt; DECLARE&lt;br /&gt;    v_EmpRecord  emp%ROWTYPE;&lt;br /&gt;&lt;br /&gt;    %TYPE is used to declare a field with the same type as that of a specified table's column. &lt;br /&gt;&lt;br /&gt;Example:&lt;br /&gt; DECLARE&lt;br /&gt;    v_EmpNo  emp.empno%TYPE;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7848011355253090856-813552671918641492?l=ravifirst.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ravifirst.blogspot.com/feeds/813552671918641492/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ravifirst.blogspot.com/2009/07/difference-between-type-and-rowtype.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/813552671918641492'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/813552671918641492'/><link rel='alternate' type='text/html' href='http://ravifirst.blogspot.com/2009/07/difference-between-type-and-rowtype.html' title='Difference between %TYPE and %ROWTYPE?'/><author><name>Ravi's</name><uri>http://www.blogger.com/profile/14359502815484562942</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_WxhoysBC8gY/StgCRfR-X5I/AAAAAAAAAJQ/l5Cd32MA2kk/S220/Rlogo.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7848011355253090856.post-7242171936866651555</id><published>2009-07-25T13:35:00.003+05:30</published><updated>2009-07-25T13:39:47.327+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='procedural language'/><category scheme='http://www.blogger.com/atom/ns#' term='execute immediate'/><category scheme='http://www.blogger.com/atom/ns#' term='Dynamic SQL statements from PL/SQL'/><category scheme='http://www.blogger.com/atom/ns#' term='dynamic statements'/><category scheme='http://www.blogger.com/atom/ns#' term='oracle faqs'/><title type='text'>use Dynamic SQL statements from PL/SQL</title><content type='html'>Starting from Oracle8i one can use the "EXECUTE IMMEDIATE" statement to execute dynamic SQL and PL/SQL statements (statements created at run-time). Look at these examples. &lt;br /&gt;&lt;br /&gt;Note that statements are NOT terminated by semicolons: &lt;br /&gt;&lt;div style='width:390px;height:auto;overflow:scroll'&gt;&lt;br /&gt;&lt;br /&gt; EXECUTE IMMEDIATE 'CREATE TABLE x (a NUMBER)';&lt;br /&gt;&lt;br /&gt; -- Using bind variables...&lt;br /&gt; sql_stmt := 'INSERT INTO dept VALUES (:1, :2, :3)';&lt;br /&gt; EXECUTE IMMEDIATE sql_stmt USING dept_id, dept_name, location;&lt;br /&gt;&lt;br /&gt;        -- Returning a cursor...&lt;br /&gt; sql_stmt := 'SELECT * FROM emp WHERE empno = :id';&lt;br /&gt; EXECUTE IMMEDIATE sql_stmt INTO emp_rec USING emp_id;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;   One can also use the older DBMS_SQL package (V2.1 and above) to execute dynamic statements.&lt;br /&gt;&lt;br /&gt;Look at these examples: &lt;br /&gt;&lt;div style='width:390px;height:auto;overflow:scroll'&gt;&lt;br /&gt; CREATE OR REPLACE PROCEDURE DYNSQL AS&lt;br /&gt;   cur integer;&lt;br /&gt;   rc  integer;&lt;br /&gt; BEGIN&lt;br /&gt;   cur := DBMS_SQL.OPEN_CURSOR;&lt;br /&gt;   DBMS_SQL.PARSE(cur, 'CREATE TABLE X (Y DATE)', DBMS_SQL.NATIVE);&lt;br /&gt;   rc := DBMS_SQL.EXECUTE(cur);&lt;br /&gt;   DBMS_SQL.CLOSE_CURSOR(cur);&lt;br /&gt; END;&lt;br /&gt; /&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;More complex DBMS_SQL example using bind variables: &lt;br /&gt;&lt;br /&gt;&lt;div style='width:390px;height:250px;overflow:scroll'&gt;&lt;br /&gt; CREATE OR REPLACE PROCEDURE DEPARTMENTS(NO IN DEPT.DEPTNO%TYPE) AS&lt;br /&gt;   v_cursor integer;&lt;br /&gt;   v_dname  char(20);&lt;br /&gt;   v_rows   integer;&lt;br /&gt; BEGIN&lt;br /&gt;   v_cursor := DBMS_SQL.OPEN_CURSOR;&lt;br /&gt;   DBMS_SQL.PARSE(v_cursor, 'select dname from dept where deptno &gt; :x', DBMS_SQL.V7);&lt;br /&gt;   DBMS_SQL.BIND_VARIABLE(v_cursor, ':x', no);&lt;br /&gt;   DBMS_SQL.DEFINE_COLUMN_CHAR(v_cursor, 1, v_dname, 20);&lt;br /&gt;   v_rows := DBMS_SQL.EXECUTE(v_cursor);&lt;br /&gt;   loop&lt;br /&gt;     if DBMS_SQL.FETCH_ROWS(v_cursor) = 0 then&lt;br /&gt;        exit;&lt;br /&gt;     end if;&lt;br /&gt;     DBMS_SQL.COLUMN_VALUE_CHAR(v_cursor, 1, v_dname);&lt;br /&gt;     DBMS_OUTPUT.PUT_LINE('Deptartment name: '||v_dname);&lt;br /&gt;   end loop;&lt;br /&gt;   DBMS_SQL.CLOSE_CURSOR(v_cursor);&lt;br /&gt; EXCEPTION&lt;br /&gt;   when others then&lt;br /&gt;        DBMS_SQL.CLOSE_CURSOR(v_cursor);&lt;br /&gt;        raise_application_error(-20000, 'Unknown Exception Raised: '||sqlcode||' '||sqlerrm);&lt;br /&gt; END;&lt;br /&gt; /&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7848011355253090856-7242171936866651555?l=ravifirst.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ravifirst.blogspot.com/feeds/7242171936866651555/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ravifirst.blogspot.com/2009/07/use-dynamic-sql-statements-from-plsql.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/7242171936866651555'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/7242171936866651555'/><link rel='alternate' type='text/html' href='http://ravifirst.blogspot.com/2009/07/use-dynamic-sql-statements-from-plsql.html' title='use Dynamic SQL statements from PL/SQL'/><author><name>Ravi's</name><uri>http://www.blogger.com/profile/14359502815484562942</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_WxhoysBC8gY/StgCRfR-X5I/AAAAAAAAAJQ/l5Cd32MA2kk/S220/Rlogo.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7848011355253090856.post-6546288181309062793</id><published>2009-07-25T13:33:00.003+05:30</published><updated>2009-07-25T13:35:23.096+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='procedural language'/><category scheme='http://www.blogger.com/atom/ns#' term='execute immediate'/><category scheme='http://www.blogger.com/atom/ns#' term='truncate'/><category scheme='http://www.blogger.com/atom/ns#' term='ddl'/><category scheme='http://www.blogger.com/atom/ns#' term='oracle faqs'/><category scheme='http://www.blogger.com/atom/ns#' term='ddl statements fromPL/SQL'/><title type='text'>DDL statements from PL/SQL</title><content type='html'>One can call DDL statements like CREATE, DROP, TRUNCATE, etc. from PL/SQL by using the "EXECUTE IMMEDIATE" statement. Users running Oracle versions below 8i can look at the DBMS_SQL package (see FAQ about Dynamic SQL). &lt;br /&gt; &lt;br /&gt;     begin&lt;br /&gt;    EXECUTE IMMEDIATE 'CREATE TABLE X(A DATE)';&lt;br /&gt;     end;&lt;br /&gt;&lt;br /&gt;NOTE: The DDL statement in quotes should not be terminated with a semicolon.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7848011355253090856-6546288181309062793?l=ravifirst.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ravifirst.blogspot.com/feeds/6546288181309062793/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ravifirst.blogspot.com/2009/07/ddl-statements-from-plsql.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/6546288181309062793'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/6546288181309062793'/><link rel='alternate' type='text/html' href='http://ravifirst.blogspot.com/2009/07/ddl-statements-from-plsql.html' title='DDL statements from PL/SQL'/><author><name>Ravi's</name><uri>http://www.blogger.com/profile/14359502815484562942</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_WxhoysBC8gY/StgCRfR-X5I/AAAAAAAAAJQ/l5Cd32MA2kk/S220/Rlogo.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7848011355253090856.post-4973743245666800175</id><published>2009-07-25T13:27:00.003+05:30</published><updated>2009-07-25T13:32:49.597+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='INIT.ORA'/><category scheme='http://www.blogger.com/atom/ns#' term='write file from PL/SQL'/><category scheme='http://www.blogger.com/atom/ns#' term='raise_application_error'/><category scheme='http://www.blogger.com/atom/ns#' term='procedural language'/><category scheme='http://www.blogger.com/atom/ns#' term='Read file from PL/SQL'/><category scheme='http://www.blogger.com/atom/ns#' term='DBMS_OUTPUT'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL*Plus SPOOL command'/><category scheme='http://www.blogger.com/atom/ns#' term='UTL_FILE package'/><category scheme='http://www.blogger.com/atom/ns#' term='oracle faqs'/><title type='text'>Read/write files from PL/SQL?</title><content type='html'>Included in Oracle 7.3 is an UTL_FILE package that can read and write operating system files. The directory you intend writing to has to be in your INIT.ORA file (see UTL_FILE_DIR=... parameter). Before Oracle 7.3 the only means of writing a file was to use DBMS_OUTPUT with the SQL*Plus SPOOL command. &lt;br /&gt;&lt;br /&gt;Copy this example to get started: &lt;br /&gt;&lt;br /&gt;&lt;div style='width:390px;overflow:scroll;height:auto;'&gt;&lt;br /&gt; DECLARE&lt;br /&gt;   fileHandler UTL_FILE.FILE_TYPE;&lt;br /&gt; BEGIN&lt;br /&gt;   fileHandler := UTL_FILE.FOPEN('/tmp', 'myfile', 'w');&lt;br /&gt;   UTL_FILE.PUTF(fileHandler, 'Look ma, I''m writing to a file!!!\n');&lt;br /&gt;   UTL_FILE.FCLOSE(fileHandler);&lt;br /&gt; EXCEPTION&lt;br /&gt;   WHEN utl_file.invalid_path THEN&lt;br /&gt;      raise_application_error(-20000, 'ERROR: Invalid path for file or path not in INIT.ORA.');&lt;br /&gt; END;&lt;br /&gt; /&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7848011355253090856-4973743245666800175?l=ravifirst.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ravifirst.blogspot.com/feeds/4973743245666800175/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ravifirst.blogspot.com/2009/07/readwrite-files-from-plsql.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/4973743245666800175'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/4973743245666800175'/><link rel='alternate' type='text/html' href='http://ravifirst.blogspot.com/2009/07/readwrite-files-from-plsql.html' title='Read/write files from PL/SQL?'/><author><name>Ravi's</name><uri>http://www.blogger.com/profile/14359502815484562942</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_WxhoysBC8gY/StgCRfR-X5I/AAAAAAAAAJQ/l5Cd32MA2kk/S220/Rlogo.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7848011355253090856.post-3451703977723956444</id><published>2009-07-25T13:18:00.001+05:30</published><updated>2009-07-25T13:21:16.502+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='procedural language'/><category scheme='http://www.blogger.com/atom/ns#' term='debugging PL/SQL'/><category scheme='http://www.blogger.com/atom/ns#' term='DBMS_OUTPUT'/><category scheme='http://www.blogger.com/atom/ns#' term='Print the screen from PL/SQL'/><category scheme='http://www.blogger.com/atom/ns#' term='set serveroutput'/><category scheme='http://www.blogger.com/atom/ns#' term='oracle faqs'/><title type='text'>Print the screen from PL/SQL</title><content type='html'>One can use the DBMS_OUTPUT package to write information to an output buffer. This buffer can be displayed on the screen from SQL*Plus if you issue the SET SERVEROUTPUT ON; command. &lt;br /&gt;&lt;br /&gt;For example: &lt;br /&gt; set serveroutput on&lt;br /&gt; begin&lt;br /&gt;    dbms_output.put_line('Look Ma, I can print from PL/SQL!!!');&lt;br /&gt; end;&lt;br /&gt; /&lt;br /&gt;&lt;br /&gt;DBMS_OUTPUT is useful for debugging PL/SQL programs. However, if you print too much, the output buffer will overflow. In that case, set the buffer size to a larger value, eg.: set serveroutput on size 200000 &lt;br /&gt;&lt;br /&gt;If you forget to set serveroutput on type SET SERVEROUTPUT ON once you remember, and then EXEC NULL;. If you haven't cleared the DBMS_OUTPUT buffer with the disable or enable procedure, SQL*Plus will display the entire contents of the buffer when it executes this dummy PL/SQL block.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7848011355253090856-3451703977723956444?l=ravifirst.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ravifirst.blogspot.com/feeds/3451703977723956444/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ravifirst.blogspot.com/2009/07/print-screen-from-plsql.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/3451703977723956444'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/3451703977723956444'/><link rel='alternate' type='text/html' href='http://ravifirst.blogspot.com/2009/07/print-screen-from-plsql.html' title='Print the screen from PL/SQL'/><author><name>Ravi's</name><uri>http://www.blogger.com/profile/14359502815484562942</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_WxhoysBC8gY/StgCRfR-X5I/AAAAAAAAAJQ/l5Cd32MA2kk/S220/Rlogo.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7848011355253090856.post-1924792617595217321</id><published>2009-07-25T13:15:00.001+05:30</published><updated>2009-07-25T13:17:54.334+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='procedural language'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL*DBA'/><category scheme='http://www.blogger.com/atom/ns#' term='decode'/><category scheme='http://www.blogger.com/atom/ns#' term='binary wrapper'/><category scheme='http://www.blogger.com/atom/ns#' term='oracle faqs'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL*Plus'/><category scheme='http://www.blogger.com/atom/ns#' term='protect pl/sql code'/><title type='text'>How to Protect PL/SQL Code</title><content type='html'>PL/SQL V2.2, available with Oracle7.2, implements a binary wrapper for PL/SQL programs to protect the source code. &lt;br /&gt;&lt;br /&gt;This is done via a standalone utility that transforms the PL/SQL source code into portable binary object code (somewhat larger than the original). This way you can distribute software without having to worry about exposing your proprietary algorithms and methods. SQL*Plus and SQL*DBA will still understand and know how to execute such scripts. Just be careful, there is no "decode" command available. &lt;br /&gt;&lt;br /&gt;The syntax is:&lt;br /&gt;&lt;br /&gt; wrap iname=myscript.sql oname=xxxx.plb&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7848011355253090856-1924792617595217321?l=ravifirst.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ravifirst.blogspot.com/feeds/1924792617595217321/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ravifirst.blogspot.com/2009/07/how-to-protect-plsql-code.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/1924792617595217321'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/1924792617595217321'/><link rel='alternate' type='text/html' href='http://ravifirst.blogspot.com/2009/07/how-to-protect-plsql-code.html' title='How to Protect PL/SQL Code'/><author><name>Ravi's</name><uri>http://www.blogger.com/profile/14359502815484562942</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_WxhoysBC8gY/StgCRfR-X5I/AAAAAAAAAJQ/l5Cd32MA2kk/S220/Rlogo.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7848011355253090856.post-4004510519941358992</id><published>2009-07-25T13:11:00.003+05:30</published><updated>2009-07-25T13:15:43.570+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='procedural language'/><category scheme='http://www.blogger.com/atom/ns#' term='PL/SQL'/><category scheme='http://www.blogger.com/atom/ns#' term='Joining Queries from Oracle and SQL Server Databases'/><category scheme='http://www.blogger.com/atom/ns#' term='oracle faqs'/><category scheme='http://www.blogger.com/atom/ns#' term='history of pl/sql code changes'/><title type='text'>How to keep a history of PL/SQL code changes?</title><content type='html'>One can build a history of PL/SQL code changes by setting up an AFTER CREATE schema (or database) level trigger (available from Oracle 8.1.7). This way one can easily revert to previous code should someone make any catastrophic changes. &lt;br /&gt;&lt;br /&gt;Look at this example: &lt;br /&gt;&lt;br /&gt;&lt;div style='width:390px;height:350px;overflow:scroll;'&gt;&lt;br /&gt;        CREATE TABLE SOURCE_HIST                     -- Create history table&lt;br /&gt;          AS SELECT SYSDATE CHANGE_DATE, USER_SOURCE.*&lt;br /&gt;             FROM   USER_SOURCE WHERE 1=2;&lt;br /&gt;&lt;br /&gt;        CREATE OR REPLACE TRIGGER change_hist        -- Store code in hist table&lt;br /&gt;               AFTER CREATE ON SCOTT.SCHEMA          -- Change SCOTT to your schema name&lt;br /&gt;        DECLARE&lt;br /&gt;        BEGIN&lt;br /&gt;          if DICTIONARY_OBJ_TYPE in ('PROCEDURE', 'FUNCTION',&lt;br /&gt;                          'PACKAGE', 'PACKAGE BODY', 'TYPE') then&lt;br /&gt;             -- Store old code in SOURCE_HIST table&lt;br /&gt;             INSERT INTO SOURCE_HIST&lt;br /&gt;                SELECT sysdate, user_source.* FROM USER_SOURCE&lt;br /&gt;                WHERE  TYPE = DICTIONARY_OBJ_TYPE&lt;br /&gt;                  AND  NAME = DICTIONARY_OBJ_NAME;&lt;br /&gt;          end if;&lt;br /&gt;        EXCEPTION&lt;br /&gt;          WHEN OTHERS THEN&lt;br /&gt;               raise_application_error(-20000, SQLERRM);&lt;br /&gt;        END;&lt;br /&gt;        /&lt;br /&gt;        show errors&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7848011355253090856-4004510519941358992?l=ravifirst.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ravifirst.blogspot.com/feeds/4004510519941358992/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ravifirst.blogspot.com/2009/07/how-to-keep-history-of-plsql-code.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/4004510519941358992'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/4004510519941358992'/><link rel='alternate' type='text/html' href='http://ravifirst.blogspot.com/2009/07/how-to-keep-history-of-plsql-code.html' title='How to keep a history of PL/SQL code changes?'/><author><name>Ravi's</name><uri>http://www.blogger.com/profile/14359502815484562942</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_WxhoysBC8gY/StgCRfR-X5I/AAAAAAAAAJQ/l5Cd32MA2kk/S220/Rlogo.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7848011355253090856.post-5682363159512406586</id><published>2009-07-25T13:08:00.000+05:30</published><updated>2009-07-25T13:10:46.457+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Search PL/SQL code for a string/ key value?'/><category scheme='http://www.blogger.com/atom/ns#' term='procedural language'/><category scheme='http://www.blogger.com/atom/ns#' term='PL/SQL'/><category scheme='http://www.blogger.com/atom/ns#' term='Oracle'/><category scheme='http://www.blogger.com/atom/ns#' term='oracle faqs'/><title type='text'>Search PL/SQL code for a string/ key value?</title><content type='html'>The following query is handy if you want to know where a certain table, field or expression is referenced in your PL/SQL source code. &lt;br /&gt;    &lt;br /&gt;    SELECT TYPE, NAME, LINE&lt;br /&gt;    FROM   USER_SOURCE&lt;br /&gt;    WHERE  UPPER(TEXT) LIKE '%&amp;KEYWORD%';&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7848011355253090856-5682363159512406586?l=ravifirst.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ravifirst.blogspot.com/feeds/5682363159512406586/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ravifirst.blogspot.com/2009/07/search-plsql-code-for-string-key-value.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/5682363159512406586'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/5682363159512406586'/><link rel='alternate' type='text/html' href='http://ravifirst.blogspot.com/2009/07/search-plsql-code-for-string-key-value.html' title='Search PL/SQL code for a string/ key value?'/><author><name>Ravi's</name><uri>http://www.blogger.com/profile/14359502815484562942</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_WxhoysBC8gY/StgCRfR-X5I/AAAAAAAAAJQ/l5Cd32MA2kk/S220/Rlogo.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7848011355253090856.post-1896095095240779688</id><published>2009-07-25T13:05:00.002+05:30</published><updated>2009-07-25T13:08:01.893+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='stored procedures'/><category scheme='http://www.blogger.com/atom/ns#' term='packages'/><category scheme='http://www.blogger.com/atom/ns#' term='PL/SQL'/><category scheme='http://www.blogger.com/atom/ns#' term='USER_OBJECTS'/><category scheme='http://www.blogger.com/atom/ns#' term='Oracle'/><category scheme='http://www.blogger.com/atom/ns#' term='oracle faqs'/><category scheme='http://www.blogger.com/atom/ns#' term='LAST_DDL_TIME'/><category scheme='http://www.blogger.com/atom/ns#' term='functions'/><title type='text'>How can one see if somebody modified any code?</title><content type='html'>Code for stored procedures, functions and packages is stored in the Oracle Data Dictionary. One can detect code changes by looking at the LAST_DDL_TIME column in the USER_OBJECTS dictionary view. &lt;br /&gt;&lt;br /&gt;Example: &lt;br /&gt;&lt;div style='width:390px;height:auto;overflow:scroll'&gt;&lt;br /&gt;        SELECT OBJECT_NAME,&lt;br /&gt;               TO_CHAR(CREATED,       'DD-Mon-RR HH24:MI') CREATE_TIME,&lt;br /&gt;               TO_CHAR(LAST_DDL_TIME, 'DD-Mon-RR HH24:MI') MOD_TIME,&lt;br /&gt;               STATUS&lt;br /&gt;        FROM   USER_OBJECTS&lt;br /&gt;        WHERE  LAST_DDL_TIME &gt; '&amp;CHECK_FROM_DATE';&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7848011355253090856-1896095095240779688?l=ravifirst.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ravifirst.blogspot.com/feeds/1896095095240779688/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ravifirst.blogspot.com/2009/07/how-can-one-see-if-somebody-modified.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/1896095095240779688'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/1896095095240779688'/><link rel='alternate' type='text/html' href='http://ravifirst.blogspot.com/2009/07/how-can-one-see-if-somebody-modified.html' title='How can one see if somebody modified any code?'/><author><name>Ravi's</name><uri>http://www.blogger.com/profile/14359502815484562942</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_WxhoysBC8gY/StgCRfR-X5I/AAAAAAAAAJQ/l5Cd32MA2kk/S220/Rlogo.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7848011355253090856.post-7976426813560729541</id><published>2009-07-25T13:02:00.002+05:30</published><updated>2009-07-25T13:05:22.301+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='procedures'/><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='procedural language'/><category scheme='http://www.blogger.com/atom/ns#' term='PL/SQL'/><category scheme='http://www.blogger.com/atom/ns#' term='job roles'/><category scheme='http://www.blogger.com/atom/ns#' term='triggers'/><category scheme='http://www.blogger.com/atom/ns#' term='oracle faqs'/><title type='text'>Should one use PL/SQL or Java to code procedures and triggers?</title><content type='html'>Internally the Oracle database supports two procedural languages, namely PL/SQL and Java. This leads to questions like "Which of the two is the best?" and "Will Oracle ever desupport PL/SQL in favour of Java?". &lt;br /&gt;Many Oracle applications are based on PL/SQL and it would be difficult of Oracle to ever desupport PL/SQL. In fact, all indications are that PL/SQL still has a bright future ahead of it. Many enhancements are still being made to PL/SQL. For example, Oracle 9iDB supports native compilation of Pl/SQL code to binaries. &lt;br /&gt;PL/SQL and Java appeal to different people in different job roles. The following table briefly describes the difference between these two language environments: &lt;br /&gt;&lt;br /&gt;PL/SQL: &lt;br /&gt;•  Data centric and tightly integrated into the database &lt;br /&gt;•  Proprietary to Oracle and difficult to port to other database systems &lt;br /&gt;•  Data manipulation is slightly faster in PL/SQL than in Java &lt;br /&gt;•  Easier to use than Java (depending on your background) &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Java: &lt;br /&gt;•  Open standard, not proprietary to Oracle &lt;br /&gt;•  Incurs some data conversion overhead between the Database and Java type systems &lt;br /&gt;•  Java is more difficult to use (depending on your background)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7848011355253090856-7976426813560729541?l=ravifirst.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ravifirst.blogspot.com/feeds/7976426813560729541/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ravifirst.blogspot.com/2009/07/should-one-use-plsql-or-java-to-code.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/7976426813560729541'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/7976426813560729541'/><link rel='alternate' type='text/html' href='http://ravifirst.blogspot.com/2009/07/should-one-use-plsql-or-java-to-code.html' title='Should one use PL/SQL or Java to code procedures and triggers?'/><author><name>Ravi's</name><uri>http://www.blogger.com/profile/14359502815484562942</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_WxhoysBC8gY/StgCRfR-X5I/AAAAAAAAAJQ/l5Cd32MA2kk/S220/Rlogo.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7848011355253090856.post-4881592753900509112</id><published>2009-07-25T12:59:00.001+05:30</published><updated>2009-07-25T13:02:19.748+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='data'/><category scheme='http://www.blogger.com/atom/ns#' term='data-centric program'/><category scheme='http://www.blogger.com/atom/ns#' term='PL/SQL'/><category scheme='http://www.blogger.com/atom/ns#' term='inheritance'/><category scheme='http://www.blogger.com/atom/ns#' term='function overloading'/><category scheme='http://www.blogger.com/atom/ns#' term='Oracle'/><category scheme='http://www.blogger.com/atom/ns#' term='What is PL/SQL'/><category scheme='http://www.blogger.com/atom/ns#' term='database'/><title type='text'>What is PL/SQL ?</title><content type='html'>PL/SQL is Oracle's Procedural Language extension to SQL. PL/SQL's language syntax, structure and data types are similar to that of ADA. The PL/SQL language includes object oriented programming techniques such as encapsulation, function overloading, information hiding (all but inheritance). PL/SQL is commonly used to write data-centric programs to manipulate data in an Oracle database.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7848011355253090856-4881592753900509112?l=ravifirst.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ravifirst.blogspot.com/feeds/4881592753900509112/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ravifirst.blogspot.com/2009/07/what-is-plsql.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/4881592753900509112'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/4881592753900509112'/><link rel='alternate' type='text/html' href='http://ravifirst.blogspot.com/2009/07/what-is-plsql.html' title='What is PL/SQL ?'/><author><name>Ravi's</name><uri>http://www.blogger.com/profile/14359502815484562942</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_WxhoysBC8gY/StgCRfR-X5I/AAAAAAAAAJQ/l5Cd32MA2kk/S220/Rlogo.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7848011355253090856.post-2904835722936016600</id><published>2009-07-23T13:18:00.000+05:30</published><updated>2009-07-23T13:19:59.681+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='ADO.NET'/><category scheme='http://www.blogger.com/atom/ns#' term='Prevent Unnecessary Database Hit in ADO.NET'/><title type='text'>Prevent Unnecessary Database Hit in ADO.NET</title><content type='html'>One of the most useful of all features of ADO.NET is that you can attach messages to each row of data in a DataSet object. The SqlDataAdapter class attaches error messages to the rows of a DataSet if a specific database action has not been successfully completed. We can then check whether there are any errors in a DataSet prior to sending the same for updating the database using the HasErrors property of the DataSet instance. This, if used judiciously, can prevent an unnecessary database hit. Please refer to the code snippet that follows:&lt;br /&gt;&lt;br /&gt;DataSet newDataSet = previousDataSet.GetChanges(DataRowState.Modified);&lt;br /&gt;&lt;br /&gt;    if (newDataSet.HasErrors)&lt;br /&gt;    {&lt;br /&gt;      // If there are errors take appropriate action   &lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    else&lt;br /&gt;    {&lt;br /&gt;&lt;br /&gt;      // Necessary code to update the database&lt;br /&gt;    }&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7848011355253090856-2904835722936016600?l=ravifirst.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ravifirst.blogspot.com/feeds/2904835722936016600/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ravifirst.blogspot.com/2009/07/prevent-unnecessary-database-hit-in.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/2904835722936016600'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/2904835722936016600'/><link rel='alternate' type='text/html' href='http://ravifirst.blogspot.com/2009/07/prevent-unnecessary-database-hit-in.html' title='Prevent Unnecessary Database Hit in ADO.NET'/><author><name>Ravi's</name><uri>http://www.blogger.com/profile/14359502815484562942</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_WxhoysBC8gY/StgCRfR-X5I/AAAAAAAAAJQ/l5Cd32MA2kk/S220/Rlogo.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7848011355253090856.post-8072085043670300415</id><published>2009-07-23T13:14:00.002+05:30</published><updated>2009-07-23T13:18:03.165+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Microsoft .net'/><category scheme='http://www.blogger.com/atom/ns#' term='using Using in .NET'/><title type='text'>USING the "Using" Statement in .NET</title><content type='html'>The using statement can be used to specify a boundary for the object outside of which, the object is destroyed automatically. The runtime invokes the Dispose method of the objects that are specified within this statement when the control comes out of this block. This is why this is a preferred choice when using exceptions for managing resources in .NET. Refer to the following code that uses the “using” statement:&lt;br /&gt;&lt;br /&gt;string connectionString = ...; // Some connection string&lt;br /&gt;&lt;br /&gt;using (SqlConnection sqlConnection = new SqlConnection(connectionString))&lt;br /&gt;{&lt;br /&gt;  sqlConnection.Open();&lt;br /&gt;  //Some code&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;Note that when the end of the using block would be encountered, the Dispose () method will be immediately called on the instance. Note that when the Dispose() method is called on this connection instance, it checks to see if the connection is opened; if open it would close it implicitly prior to disposing off the instance. &lt;br /&gt;&lt;br /&gt;The above code gets translated implicitly to:&lt;br /&gt;&lt;br /&gt;string connectionString = ...; // Some connection string&lt;br /&gt;&lt;br /&gt;SqlConnection sqlConnection = new SqlConnection(connectionString));&lt;br /&gt;&lt;br /&gt;try&lt;br /&gt;{&lt;br /&gt;  sqlConnection.Open();&lt;br /&gt;  //Some code&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;finally&lt;br /&gt;{&lt;br /&gt;   ((IDispose)sqlConnection).Dispose();&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;Remember to keep the try block as short as possible. Note that in the code example above, we have just opened the connection in the try block. Do not use any unnecessary code/logic in the try block that is not supposed to throw any exception. Do not catch any exception that you cannot handle and avoid rethrowing exceptions unnecessarily as it is very expensive.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7848011355253090856-8072085043670300415?l=ravifirst.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ravifirst.blogspot.com/feeds/8072085043670300415/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ravifirst.blogspot.com/2009/07/using-using-statement-in-net.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/8072085043670300415'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/8072085043670300415'/><link rel='alternate' type='text/html' href='http://ravifirst.blogspot.com/2009/07/using-using-statement-in-net.html' title='USING the &quot;Using&quot; Statement in .NET'/><author><name>Ravi's</name><uri>http://www.blogger.com/profile/14359502815484562942</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_WxhoysBC8gY/StgCRfR-X5I/AAAAAAAAAJQ/l5Cd32MA2kk/S220/Rlogo.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7848011355253090856.post-4506866451326286997</id><published>2009-07-23T13:11:00.003+05:30</published><updated>2009-07-23T13:14:43.946+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='ADO.NET'/><category scheme='http://www.blogger.com/atom/ns#' term='working with exceptions in ADO.NET'/><category scheme='http://www.blogger.com/atom/ns#' term='Microsoft .net'/><category scheme='http://www.blogger.com/atom/ns#' term='exceptions in ado.net'/><title type='text'>Exceptions in ADO.NET 2.0</title><content type='html'>&lt;span style="font-weight:bold;"&gt;What are Exceptions?&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;An exception is an error that occurs at runtime. If it is not handled properly, it terminates the normal flow of the program. According to MSDN, “An exception is any error condition or unexpected behavior encountered by an executing program. Exceptions can be raised because of a fault in your code or in code you call (such as a shared library), unavailable operating system resources, unexpected conditions the common language runtime encounters (such as code that cannot be verified), and so on. Your application can recover from some of these conditions, but not others. While you can recover from most application exceptions, you cannot recover from most runtime exceptions.”&lt;br /&gt;&lt;br /&gt;The .NET runtime creates an exception object to represent an exception when it occurs. It also creates an Exception Information Table for each executable. There are four different types of exception handlers, namely&lt;br /&gt;&lt;br /&gt;A finally handler&lt;br /&gt;A fault handler&lt;br /&gt;A type-filtered handler&lt;br /&gt;A user-filtered handler&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Exceptions in ADO.NET&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;In ADO.NET 1.1, there was no common base class for ADO.NET exceptions. According to Frans Bouma, "every provider has its own exception for reporting errors, and they're not derived from a generic ADO.NET exception. This thus makes it hard to catch db specific exceptions in generic code and handle it". With ADO.NET 2.0 however, we have a new common exception base class called the System.Data.Common.DbException class. The generic DbException class in ADO.NET 2.0 exposes all the information a provider specific exception would require. This class enables catching the provider specific exceptions in a generic manner.&lt;br /&gt;&lt;br /&gt;However, exceptions should be avoided at all cost. Exceptions are expensive; they slow down the application, and use resources, regardless of whether or not they are handled. In addition, "logic by exception" can make debugging very tedious.&lt;br /&gt;Exception Handlers&lt;br /&gt;&lt;br /&gt;Exceptions are handled using the try, catch and finally blocks. The try block contains code that raises an exception. The exceptions that are raised in the try block are caught in one or more appropriate catch blocks. Why appropriate? The reason is that if an exception has occurred, only one of the catch blocks would be executed that is most appropriate to the type of the exception that has occurred. The finally block contains any necessary cleanup code. It should be noted that a try block should contain one or more catch blocks or at least a finally block. Why is a finally block required?&lt;br /&gt;&lt;br /&gt;A finally block is executed whether or not an exception occurs. Hence, it is particularly useful for cleanup operations. MSDN states, “the purpose of a finally statement is to ensure that the necessary cleanup of objects, usually objects that are holding external resources, happens immediately, even if an exception is thrown”. Let us consider that we have opened a database connection in a try block. If an exception occurs, it is caught in the catch block just after the try block as shown in the code snippet below:&lt;br /&gt;&lt;br /&gt;&lt;div style="width:390px;height:160px;overflow:scroll"&gt;&lt;br /&gt;string connectionString = ...; // Some connection string&lt;br /&gt;SqlConnection sqlConnection = null;&lt;br /&gt;try&lt;br /&gt;{&lt;br /&gt;sqlConnection = new SqlConnection(connectionString);&lt;br /&gt;          sqlConnection.Open();&lt;br /&gt;          //Some code&lt;br /&gt;}&lt;br /&gt; &lt;br /&gt;catch (Exception ex)&lt;br /&gt;{&lt;br /&gt;//Some exception handling code&lt;br /&gt;}&lt;br /&gt; &lt;br /&gt;finally&lt;br /&gt;{&lt;br /&gt;           sqlConnection.Close();&lt;br /&gt;}&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Remember that the connections that are opened as late as possible and released as early as possible. They should be closed immediately we are done using them. Database connections should be closed as soon as you are done using them for efficient connection pooling and hence enhanced performance. It is advisable to open the database connections in the try block and close them in the finally block. This would ensure that the connections would be properly closed irrespective of whether an exception has occurred or not. In the code example above, the connection is guaranteed to be closed as we have made a call to the Close() method on the SqlConnection instance in the finally block. I would however prefer to use the “using” statement for handling exceptions when using unmanaged resources.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7848011355253090856-4506866451326286997?l=ravifirst.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ravifirst.blogspot.com/feeds/4506866451326286997/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ravifirst.blogspot.com/2009/07/exceptions-in-adonet-20.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/4506866451326286997'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/4506866451326286997'/><link rel='alternate' type='text/html' href='http://ravifirst.blogspot.com/2009/07/exceptions-in-adonet-20.html' title='Exceptions in ADO.NET 2.0'/><author><name>Ravi's</name><uri>http://www.blogger.com/profile/14359502815484562942</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_WxhoysBC8gY/StgCRfR-X5I/AAAAAAAAAJQ/l5Cd32MA2kk/S220/Rlogo.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7848011355253090856.post-6041470325110936993</id><published>2009-07-23T13:09:00.000+05:30</published><updated>2009-07-23T13:10:35.039+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='ADO.NET'/><category scheme='http://www.blogger.com/atom/ns#' term='Microsoft .net'/><category scheme='http://www.blogger.com/atom/ns#' term='Microsoft'/><title type='text'>Why ADO.NET 2.0</title><content type='html'>With a view to mitigate the performance drawbacks of the earlier version of ADO.NET and add more flexibility, Microsoft has introduced more new features in ADO.NET 2.0 — features that have profound differences from ADO.NET 1.1, its earlier counterpart.&lt;br /&gt;&lt;br /&gt;The performance of DataSets with high volumes of data has posed performance problems in the earlier version of ADO.NET. With ADO.NET 2.0 however, the indexing engine of the DataTable has been completely re-written to facilitate much faster processing of data. According to MSDN, "The indexing engine for the DataTable has been completely rewritten in ADO.NET 2.0 and scales much better for large datasets. This results in faster basic inserts, updates, and deletes, and therefore faster Fill and Merge operations". There have been numerous enhancements to the DataSet and the DataTable classes too.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7848011355253090856-6041470325110936993?l=ravifirst.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ravifirst.blogspot.com/feeds/6041470325110936993/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ravifirst.blogspot.com/2009/07/why-adonet-20.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/6041470325110936993'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/6041470325110936993'/><link rel='alternate' type='text/html' href='http://ravifirst.blogspot.com/2009/07/why-adonet-20.html' title='Why ADO.NET 2.0'/><author><name>Ravi's</name><uri>http://www.blogger.com/profile/14359502815484562942</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_WxhoysBC8gY/StgCRfR-X5I/AAAAAAAAAJQ/l5Cd32MA2kk/S220/Rlogo.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7848011355253090856.post-5584021921132691111</id><published>2009-07-23T13:02:00.003+05:30</published><updated>2009-07-23T13:09:23.362+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='whats new in ado.net 2.0'/><category scheme='http://www.blogger.com/atom/ns#' term='ADO.NET'/><category scheme='http://www.blogger.com/atom/ns#' term='data paging'/><category scheme='http://www.blogger.com/atom/ns#' term='bulk copy'/><category scheme='http://www.blogger.com/atom/ns#' term='common provider model'/><category scheme='http://www.blogger.com/atom/ns#' term='cpm'/><title type='text'>What is new in ADO.NET 2.0</title><content type='html'>&lt;span style="font-weight:bold;"&gt;ADO.NET 2.0 — The new features&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The salient features of ADO.NET 2.0 are, but are not restricted to:&lt;br /&gt;&lt;br /&gt;    * Enhancements to the DataSet and Datatable classes&lt;br /&gt;    * Optimized DataSet Serialization&lt;br /&gt;    * Conversion of a DataReader to a DataSet or a DataTable and vice versa&lt;br /&gt;    * Data Paging&lt;br /&gt;    * Batch Updates — Reduction in database roundtrips&lt;br /&gt;    * Asynchronous Data Access&lt;br /&gt;    * Common Provider Model&lt;br /&gt;    * Bulk Copy &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style:italic;"&gt;Enhancements to the DataSet and the DataTable classes&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;In ADO.NET 2.0, the DataTable supports two methods Load and Save. Note that the DataSet class supports both these methods from the earlier version of ADO.NET. While the Load method can load data from XML into the DataTable instance, the Save method can persist the DataTable instance to a persistence storage media. Further, unlike in ADO.NET 1.1, the DataTable class now supports serialization. It should be noted that in ADO.NET 1.1, only the DataSet class supported serialization. Moreover, the DataTable class in ADO.NET 2.0 contains a method called CreateTableReader that returns a DataTableReader instance that can be used not only to read forward only data but also in a disconnected mode of operation.&lt;br /&gt;&lt;br /&gt;Further, the DataTable class in ADO.NET 2.0 is serializable, unlike in ADO.NET 1.1 where one had to store the DataTable instance inside a DataSet instance to make it serializable.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style:italic;"&gt;Optimized DataSet Serialization&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The DataSet object in ADO.NET is an in-memory representation of disconnected, cached set of data and provides a consistent relational programming model regardless of the data source. When we require sending a DataSet class instance across process boundaries, the DataSet needs to be serialized. But, what is Serialization? Serialization is the process of converting an in-memory object into a serial stream of bytes. Serialization and De-Serialization is mostly used to transport objects or to persist the state of the objects to a persistent storage media (e.g. to a file or database).&lt;br /&gt;&lt;br /&gt;Unfortunately, the DataSet class in the earlier version of ADO.NET used to serialize data as XML even if the BinarySerializer was specified. This resulted in slower serialization and an overhead of large sized serialized data. In ADO.NET 2.0 however, DataSet serialization has been improved to a large extent and you can now use the RemotingFormat property of the DataSet class to specify that the data is to be stored directly in binary format. Hence, the DataSet class ADO.NET 2.0, unlike ADO.NET 1.1, supports both XML and Binary Serialization formats. This is shown in the code example below.&lt;br /&gt;&lt;br /&gt;&lt;div style="width:390px;height:300px;overflow:scroll"&gt;&lt;br /&gt;BinaryFormatter binaryFormatter = new BinaryFormatter();&lt;br /&gt;&lt;br /&gt;FileStream fileStream = new FileStream("c:\\emp.dat", FileMode.CreateNew);&lt;br /&gt;&lt;br /&gt;DataSet empDataSet = GetEmployeeDataSet(); //This is a custom method that creates, populates and then returns a DataSet instance.&lt;br /&gt;&lt;br /&gt;empDataSet.RemotingFormat = SerializationFormat.Binary;&lt;br /&gt;&lt;br /&gt;//Serialize the employee Data Set instance as binary. In order to serialize the&lt;br /&gt;//same instance as XML, specify SerializationFormat.XML&lt;br /&gt;&lt;br /&gt;binaryFormatter.Serialize(fileStream,empDataSet);&lt;br /&gt;&lt;br /&gt;fileStream.Close();&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style:italic;"&gt;Conversion of a DataReader to DataSet or DataTable and vice-versa&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;ADO.NET 2.0 allows loading a DataReader object into a DataSet or a DataTable and vice versa. Both the DataSet and the DataTable classes in ADO.NET 2.0 contain the Load method that can be used to load a DataReader instance into a DataSet or a DataTable.&lt;br /&gt;&lt;br /&gt;The following piece of code shows how a DataTable can be loaded in a DataReader instance.&lt;br /&gt;&lt;br /&gt;&lt;div style="width:390px;height:120px;overflow:scroll"&gt;&lt;br /&gt;string connectionString = ....; //Some connection string&lt;br /&gt;&lt;br /&gt;SqlConnection sqlConnection = new SqlConnection(connectionString);&lt;br /&gt;&lt;br /&gt;sqlConnection.Open();&lt;br /&gt;&lt;br /&gt;SqlCommand sqlCommand = new SqlCommand("Select * from Employee", sqlConnection);&lt;br /&gt;&lt;br /&gt;SqlDataReader sqlDataReader = sqlCommand.ExecuteReader(CommandBehavior.CloseConnection);&lt;br /&gt;&lt;br /&gt;DataTable dataTable = new DataTable("Employee");&lt;br /&gt;&lt;br /&gt;dataTable.Load(sqlDataReader);&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;The GetDataReader method of both the DataSet and the DataTable classes can be used to retrieve a DataReader instance from either a DataSet or a DataTable. If ithe DataSet instance on which the method is called contains multiple DataTable instances, the resultant DataReader would also contain multiple resultsets.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style:italic;"&gt;Data Paging&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Data Paging is a very powerful feature in ADO.NET. It can be recollected that in the earlier version of ADO.NET we needed to make use of stored procedures for incorporating Data Paging functionality in our applications. Now, with ADO.NET 2.0, it is much simplified with the introduction of the ExecutePageReader method in the SqlDataReader class. The following code snippet illustrates how this feature can be achieved.&lt;br /&gt;&lt;br /&gt;&lt;div style="width:390px;height:auto;overflow:scroll"&gt;&lt;br /&gt;string connectionString = ....; //some connection string&lt;br /&gt;&lt;br /&gt;SqlConnection sqlConnection = new SqlConnection(connectionString);&lt;br /&gt;&lt;br /&gt;sqlConnection.Open();&lt;br /&gt;&lt;br /&gt;SqlCommand sqlCommand = new SqlCommand("Select * from Employee", sqlConnection);&lt;br /&gt;&lt;br /&gt;SqlDataReader sqlDataReader = sqlCommand.ExecutePageReader(CommandBehavior.CloseConnection, 1, 25);&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style:italic;"&gt;Batch Updates — Reducing Database Roundtrips&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Database round trips degrade the performance of applications to a large extent due to increased network traffic. The Batch update of ADO.NET 2.0 promises to improve the performance of applications to a large extent by reducing the number of round trips to the database. In the earlier version of ADO.NET, if we made any changes to the DataSet and then saved the DataSet using the Update method of the DataAdapter class, it made round trips to the database for each modified row in the DataSet. This was a major performance hindrance.&lt;br /&gt;&lt;br /&gt;But, how does it know which row or rows have been changed? When we make changes to a DataRow, its RowState changes to reflect the change. Now, for every row that has been changed (depending on whether the RowState property has been changed or not), the DataAdapter communicates with the database in such a type of operation. This is a terrible performance drawback with large volumes of data. In ADO.NET 2.0 however, there is a property known as UpdateBatchSize that can be used to specify a group or batch of rows for a particular hit to the database. It provides the number of rows to be updated in a batch. In other words, the UpdateBatchSize property of the DataAdapter class actually determines the number of changed rows changed rows that send to the database server in a single operation.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style:italic;"&gt;Asynchronous Data Access&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;In the earlier version of ADO.NET, the ExecuteReader, ExecuteScalar and the ExecuteNonQuery methods used to block the current executing thread. However, ADO.NET 2.0 supports asynchronous data access mode.In ADO.NET 2.0, these methods come with Begin and End methods that support asynchronous execution.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style:italic;"&gt;The Common Provider Model&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;In the earlier version of ADO.NET, if we wanted to implement a provider independent Data Access Layer, we had to implement the Factory Design Pattern where a class would have been responsible for returning the specific type of Command,Data Reader, DataAdapter or Connection. In ADO.NET 2.0 we can create provider-independent data access code even without referencing the provider-specific classes using the System.Data.Common namespace that exposes a number of factory classes.&lt;br /&gt;&lt;br /&gt;The DbProviderFactory class contains two methods called the GetFactoryClasses method and the Getfactory method. While the former is responsible for retrieving all the providers supported, the later can be used to retrieve the specific provider. Refer to the code snippet below that demonstrates how we can make use of this class to create a sql connection seamlessly.&lt;br /&gt;&lt;br /&gt;DbProviderFactory dbProviderFactory = DbProviderFactories.GetFactory("System.Data.SqlClient");&lt;br /&gt;DbConnection dbConnection = dbProviderFactory.CreateConnection();&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style:italic;"&gt;Bulk Copy Feature&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;In the earlier version of ADO.NET, copying a large volume of data from a source data store to a destination table in SQL database had performance drawbacks due to the repeated database accesses that were required. The SqlBulkCopy feature in ADO.NET 2.0 enables us to copy a large volume of data between a source data store and a destination data table. This class can be used to specify the source and the target data sources for this copy operation. The following code snippet illustrates how this feature can be implemented.&lt;br /&gt;&lt;br /&gt;&lt;div style="width:390px;height:160px;overflow:scroll"&gt;&lt;br /&gt;SqlConnection connectionObjSource = new SqlConnection(Conn_str);&lt;br /&gt;&lt;br /&gt;connectionObjSource.Open();&lt;br /&gt;&lt;br /&gt;SqlConnection connectionObjTarget = new SqlConnection(Conn_str1);&lt;br /&gt;&lt;br /&gt;connectionObjTarget.Open();&lt;br /&gt;&lt;br /&gt;SqlCommand sqlCommand = new SqlCommand("Select * from Employee", connectionObjSource);&lt;br /&gt;&lt;br /&gt;SqlDataReader sqlDataReader = sqlCommand.ExecuteReader(CommandBehavior.CloseConnection);&lt;br /&gt;&lt;br /&gt;DataTable dt = new DataTable("Employee");&lt;br /&gt;&lt;br /&gt;SqlBulkCopy sqlBulkcopy = new SqlBulkCopy(connectionObjTarget);&lt;br /&gt;&lt;br /&gt;bulkcopy.DestinationTableName = "Employees";&lt;br /&gt;&lt;br /&gt;bulkcopy.WriteToServer(sqlDataReader);&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7848011355253090856-5584021921132691111?l=ravifirst.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ravifirst.blogspot.com/feeds/5584021921132691111/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ravifirst.blogspot.com/2009/07/what-is-new-in-adonet-20.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/5584021921132691111'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/5584021921132691111'/><link rel='alternate' type='text/html' href='http://ravifirst.blogspot.com/2009/07/what-is-new-in-adonet-20.html' title='What is new in ADO.NET 2.0'/><author><name>Ravi's</name><uri>http://www.blogger.com/profile/14359502815484562942</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_WxhoysBC8gY/StgCRfR-X5I/AAAAAAAAAJQ/l5Cd32MA2kk/S220/Rlogo.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7848011355253090856.post-8399381308362500589</id><published>2009-07-23T12:52:00.004+05:30</published><updated>2009-07-23T13:01:22.063+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='ADO.NET'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL server Transactions'/><category scheme='http://www.blogger.com/atom/ns#' term='Working with Transactions in ADO.NET'/><title type='text'>Transactions in ADO.NET</title><content type='html'>&lt;span style="font-weight:bold;"&gt;What is a Transaction&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;  A transaction is a group of operations combined into a logical unit of work that is either guaranteed to be executed as a whole or rolled back. Transactions help the database in satisfying all the ACID (Atomic, Consistent, Isolated, and Durable). Transaction processing is an indispensible part of ADO.NET. It guarantees that a block of statements will either be executed in its entirety or rolled back,( i.e., none of the statements will be executed). Transaction processing has improved a lot in ADO.NET 2.0. This article discusses how we can work with transactions in both ADO.NET 1.1 and 2.0 versions.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Implementing Transactions in ADO.NET&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Note that in ADO.NET, the transactions are started by calling the BeginTransaction method of the connection class. This method returns an object of type SqlTransaction. Other ADO.NET connection classes like OleDbConnection, OracleConnection also have similar methods. Once you are done executing the necessary statements within the transaction unit/block, make a call to the Commit method of the given SqlTransaction object, or you can roll back the transaction using the Rollback method, depending on your requirements (if any error occurs when the transaction unit/block was executed).&lt;br /&gt;To work with transactions in ADO.NET, you require an open connection instance and a transaction instance. Then you need to invoke the necessary methods as stated later in this article.  Transactions are supported in ADO.NET by the SqlTransaction class that belongs to the System.Data.SqlClient namespace.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style:italic;"&gt;The two main properties of this class are as follows:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;    * Connection:  This indicates the SqlConnection instance that the transaction instance is associated with&lt;br /&gt;    * IsolationLevel: This specifies the IsolationLevel of the transaction &lt;br /&gt;&lt;br /&gt;The following are the methods of this class that are noteworthy:&lt;br /&gt;&lt;span style="font-style:italic;"&gt;Commit&lt;/span&gt;()   This method is called to commit the transaction&lt;br /&gt;&lt;span style="font-style:italic;"&gt;Rollback&lt;/span&gt;()  This method can be invoked to roll back a transaction. Note that a transaction can only be rolled back after it has been committed.&lt;br /&gt;&lt;span style="font-style:italic;"&gt;Save&lt;/span&gt;()       This method creates a save point in the transaction. This save point can be used to rollback a portion of the transaction at a later point in time. The following are the steps to implement transaction processing in ADO.NET.&lt;br /&gt;&lt;br /&gt;    * Connect to the database&lt;br /&gt;    * Create a SqlCommand instance with the necessary parameters&lt;br /&gt;    * Open the database connection using the connection instance&lt;br /&gt;    * Call the BeginTransaction method of the Connection object to mark the beginning of the transaction&lt;br /&gt;    * Execute the sql statements using the command instance&lt;br /&gt;    * Call the Commit method of the Transaction object to complete the&lt;br /&gt;      transaction, or the Rollback method to cancel or abort the transaction&lt;br /&gt;    * Close the connection to the database &lt;br /&gt;&lt;br /&gt;The following code snippet shows how we can implement transaction processing using ADO.NET in our applications.&lt;br /&gt;&lt;br /&gt;&lt;div style="width:390px;height:300px;overflow:scroll"&gt;&lt;br /&gt;string connectionString = ...; //Some connection string&lt;br /&gt;SqlConnection sqlConnection = new SqlConnection(connectionString);&lt;br /&gt;sqlConnection.Open();&lt;br /&gt;&lt;br /&gt;SqlTransaction sqlTransaction = sqlConnection.BeginTransaction();&lt;br /&gt;&lt;br /&gt;SqlCommand sqlCommand = new SqlCommand();&lt;br /&gt;sqlCommand.Transaction = sqlTransaction;&lt;br /&gt;&lt;br /&gt;try&lt;br /&gt;{&lt;br /&gt;  sqlCommand.CommandText = "Insert into Employee (EmpCode, EmpName) VALUES (1, 'Joydip')";&lt;br /&gt;  sqlCommand.ExecuteNonQuery();&lt;br /&gt;  sqlCommand.CommandText = "Insert into Dept (DeptCode, DeptName, EmpCode) VALUES (9, 'Software', 1)";&lt;br /&gt;  sqlCommand.ExecuteNonQuery();&lt;br /&gt;  sqlTransaction.Commit();&lt;br /&gt;  //Usual code&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;catch(Exception e)&lt;br /&gt;{&lt;br /&gt;  sqlTransaction.Rollback();&lt;br /&gt;  //Usual code&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;finally&lt;br /&gt;{&lt;br /&gt;  sqlConnection.Close();&lt;br /&gt;}&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;The next piece of code illustrates how we can use the “using” statement for the above code. According to MSDN, the "using" statement, "defines a scope, outside of which an object or objects will be disposed. A using statement can be exited either when the end of the using statement is reached or if an exception is thrown and control leaves the statement block before the end of the statement".&lt;br /&gt;&lt;br /&gt;&lt;div style="width:390px;height:230px;overflow:scroll"&gt;&lt;br /&gt;using (SqlConnection sqlConnection = new SqlConnection(connectionString))&lt;br /&gt;{&lt;br /&gt;    SqlCommand command = connection.CreateCommand();&lt;br /&gt;    SqlTransaction transaction = null;&lt;br /&gt;   &lt;br /&gt;    try&lt;br /&gt;    {&lt;br /&gt;        sqlConnection.Open();&lt;br /&gt;        transaction = sqlConnection.BeginTransaction();&lt;br /&gt;       &lt;br /&gt;        command.Transaction = transaction;&lt;br /&gt;        &lt;br /&gt;        command.CommandText = "Insert into employee (empID, empName) values (1, 'Joydip');&lt;br /&gt;        command.ExecuteNonQuery();&lt;br /&gt;       &lt;br /&gt;        command.CommandText = "Insert into dept (deptID,deptName,empID) values (9,'Software',1)";&lt;br /&gt;        command.ExecuteNonQuery();&lt;br /&gt;       &lt;br /&gt;        transaction.Commit();&lt;br /&gt;    }&lt;br /&gt;    catch(Exception ex)&lt;br /&gt;    {&lt;br /&gt;        transaction.Rollback();&lt;br /&gt;        throw ex;&lt;br /&gt;    }&lt;br /&gt;    finally&lt;br /&gt;    {&lt;br /&gt;        sqlConnection.Close();&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;The Microsoft's ADO.NET version 2.0 added a lot of new features to its earlier counterpart to add moer flexibility and ease of use. As far as transactions are concerned, a new namespace called System.Transactions has been introduced that promises a significantly improved support for distributed transactions. It contains a class called TransactionScope that can run a set of statements. It can also determine whether the objects in the scope have support for transactions. If the transaction has completed successfully, the changes are committed to the database else it is rolled back. We need to specify whether the transaction block is complete by making a call to the TransactionScope.Complete method explicitly, else, the transaction would be rolled back when the transaction instance would be discarded by the implicit Dispose method.&lt;br /&gt;The following piece of code illustrates what we have learnt so far in this section.&lt;br /&gt;&lt;br /&gt;&lt;div style="width:390px;height:110px;overflow:scroll"&gt;&lt;br /&gt;bool IsConsistent = false;&lt;br /&gt;using (System.Transactions.TransactionScope transactionScope = new System.Transactions.TransactionScope())&lt;br /&gt;{&lt;br /&gt;      SqlConnection sqlConnection = newSqlConnection(connectionString);&lt;br /&gt;      string sqlString = "Update emp set empName = 'Joydip Kanjilal' where empID = 9";&lt;br /&gt;      SqlCommand cmd1 = newSqlCommand(sql, cn);&lt;br /&gt;      sqlConnection.Open();&lt;br /&gt;      cmd1.ExecuteNonQuery();&lt;br /&gt;      sqlConnection.Close();&lt;br /&gt;      transactionScope.Consistent = IsConsistent;&lt;br /&gt;}&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;   &lt;br /&gt;TransactionScope also has support for distributed transactions. We can implement transactions for multiple database connections using it. The following piece of code shows how we can implement transactional support for multiple databases using the TransactionScope class.&lt;br /&gt;&lt;br /&gt;&lt;div style="width:390px;height:140px;overflow:scroll"&gt;&lt;br /&gt;using (TransactionScope transactionScope = new TransactionScope())&lt;br /&gt;{&lt;br /&gt;   using (SqlConnection codesDatabaseConnection = new SqlConnection(codesDatabaseConnectionString))&lt;br /&gt;   {&lt;br /&gt;      SqlCommand sqlCommandCodes = codesDatabaseConnection.CreateCommand();&lt;br /&gt;      sqlCommandCodes.CommandText = "Insert Into codes (codeID,codeText) values (1,'Test')";&lt;br /&gt;      codesDatabaseConnection.Open();&lt;br /&gt;      sqlCommandCodes.ExecuteNonQuery();&lt;br /&gt;      codesDatabaseConnection.Close();&lt;br /&gt;   }&lt;br /&gt;&lt;br /&gt;   using (SqlConnection statesDatabaseConnection = new SqlConnection(statesDatabaseConnectionString))&lt;br /&gt;   {&lt;br /&gt;      SqlCommand sqlCommandStates = statesDatabaseConnection.CreateCommand();&lt;br /&gt;      sqlCommandStates.CommandText = "Insert into States(stateID,stateName) values (1, 'Test')";&lt;br /&gt;      codesDatabaseConnection.Open();&lt;br /&gt;      sqlCommandStates.ExecuteNonQuery();&lt;br /&gt;      statesDatabaseConnection.Close();&lt;br /&gt;   }&lt;br /&gt;&lt;br /&gt;   transactionScope.Complete();&lt;br /&gt;}&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Points to be noted&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;It should be noted that the SqlTransaction object returned by the BeginTransaction () method has to be assigned to the Transaction property of the Command object; else an InvalidOperationException will be thrown by the application when the first query is executed. Likewise, the Connection instance should be open by invoking the Open method on it prior to starting a new transaction; else an InvalidOperationException would be thrown. In order to improve the performance of applications, we should try to keep the transactions (the transaction units/blocks that contain the statements to be executed in a batch as a whole) as short as possible. This will help minimize the lock contention and hence increase throughput. Further, we should analyze whether or not we actually require a transaction for a batch of statements. Try not to unnecessarily have transactional statements in you code as it might have a performance drawback due to the reasons stated above.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Conclusion&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The usage of transactions guarantee the execution of a batch of statements sequentially in its entirety or roll them back hence preserving the database integrity and data consistency. In a nutshell, in order to work with transactions, invoke the BeginTransaction() method of the appropriate database connection instance and then call either the Commit() or Rollback() method on the returned transaction object reference depending on the circumstances. However, it should be noted that transactions hold locks and may cause contention issues; they should be as short as it is possible. Hence, this is a major performance drawback in using transactions in our code. But, if used properly, it can facilitate the design and implementation of robust applications with data security and consistency. This article has discusses transactions in details in a lucid language with code examples to illustrate the concepts.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7848011355253090856-8399381308362500589?l=ravifirst.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ravifirst.blogspot.com/feeds/8399381308362500589/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ravifirst.blogspot.com/2009/07/transactions-in-adonet.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/8399381308362500589'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/8399381308362500589'/><link rel='alternate' type='text/html' href='http://ravifirst.blogspot.com/2009/07/transactions-in-adonet.html' title='Transactions in ADO.NET'/><author><name>Ravi's</name><uri>http://www.blogger.com/profile/14359502815484562942</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_WxhoysBC8gY/StgCRfR-X5I/AAAAAAAAAJQ/l5Cd32MA2kk/S220/Rlogo.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7848011355253090856.post-556470181560980839</id><published>2009-07-23T12:29:00.005+05:30</published><updated>2009-07-23T12:42:25.180+05:30</updated><title type='text'>Date Time Using Javascript</title><content type='html'>Hi Buddies,&lt;br /&gt;&lt;br /&gt;To display Date time on your web page copy this script and paste where ever you want to display&lt;br /&gt;&lt;br /&gt;&lt;div style="overflow: scroll; width: 350px; height: 250px;"&gt;&lt;br /&gt;&lt;pre&gt;&lt;code&gt;&amp;lt;script&amp;gt;&lt;br /&gt;var mydate=new Date()&lt;br /&gt;var year=mydate.getYear()&lt;br /&gt;if (year &lt; 1000)&lt;br /&gt;year+=1900&lt;br /&gt;var day=mydate.getDay()&lt;br /&gt;var month=mydate.getMonth()&lt;br /&gt;var daym=mydate.getDate()&lt;br /&gt;if (daym&lt;10)&lt;br /&gt;daym="0"+daym&lt;br /&gt;var dayarray=new Array("Sun","Mon","Tue","Wed","Thu","Fri","Sat")&lt;br /&gt;var montharray=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec")&lt;br /&gt;document.write("&amp;lt;P ALIGN=RIGHT&amp;gt; &amp;lt;FONT color=white SIZE=-3 weight=bold FACE=VERDANA,ARIAL&amp;gt;" + montharray[month]+" "+daym+", "+year+ "&amp;lt;/FONT&amp;gt;");&lt;br /&gt; &amp;lt;script&amp;gt;&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7848011355253090856-556470181560980839?l=ravifirst.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ravifirst.blogspot.com/feeds/556470181560980839/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ravifirst.blogspot.com/2009/07/date-time-using-javascript.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/556470181560980839'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/556470181560980839'/><link rel='alternate' type='text/html' href='http://ravifirst.blogspot.com/2009/07/date-time-using-javascript.html' title='Date Time Using Javascript'/><author><name>Ravi's</name><uri>http://www.blogger.com/profile/14359502815484562942</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_WxhoysBC8gY/StgCRfR-X5I/AAAAAAAAAJQ/l5Cd32MA2kk/S220/Rlogo.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7848011355253090856.post-1868407891828236923</id><published>2009-07-23T12:22:00.002+05:30</published><updated>2009-07-23T12:26:50.032+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='stored procedures'/><category scheme='http://www.blogger.com/atom/ns#' term='delete duplicate rows sql server'/><category scheme='http://www.blogger.com/atom/ns#' term='sql server DBA'/><category scheme='http://www.blogger.com/atom/ns#' term='getting started with Stored Procedures'/><title type='text'>Getting Started with Stored Procedures</title><content type='html'>To begin writing stored procedures, the following are essential:&lt;br /&gt;&lt;br /&gt;   1. A database management system.&lt;br /&gt;       &lt;br /&gt;   2. A database built inside the database management system (see the end of this article for a sample).&lt;br /&gt;       &lt;br /&gt;   3. A text editor, such as Notepad or Query Analyzer.&lt;br /&gt;&lt;br /&gt;Items 1 and 2 are absolutely essential. You can’t write stored procedures without a database. They would be useless. Sometimes, I write my procedures in Notepad (or another text editor), and copy them into the New Stored Procedure window in SQL Server. The New Stored Procedure window is a bit small, and in Notepad I can spread things out a bit (you’ll see later).&lt;br /&gt;&lt;br /&gt;Next, you will have to decide what you want your stored procedure to do. It can be tempting to just dive right into the task at hand, but it is always prudent to sketch out some ideas first. Some considerations should be:&lt;br /&gt;&lt;br /&gt;    * Do you want to view data in the database (SELECT), insert new records (INSERT INTO), or do I want to change an existing record (UPDATE)?&lt;br /&gt;       &lt;br /&gt;    * With which tables will you have to work? Does it make sense to create a VIEW first?&lt;br /&gt;       &lt;br /&gt;    * How often will this procedure actually be used? &lt;br /&gt;&lt;br /&gt;Once you have struggled with these questions (something of an exaggeration, I guess), you will be ready to start coding!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7848011355253090856-1868407891828236923?l=ravifirst.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ravifirst.blogspot.com/feeds/1868407891828236923/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ravifirst.blogspot.com/2009/07/getting-started-with-stored-procedures.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/1868407891828236923'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/1868407891828236923'/><link rel='alternate' type='text/html' href='http://ravifirst.blogspot.com/2009/07/getting-started-with-stored-procedures.html' title='Getting Started with Stored Procedures'/><author><name>Ravi's</name><uri>http://www.blogger.com/profile/14359502815484562942</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_WxhoysBC8gY/StgCRfR-X5I/AAAAAAAAAJQ/l5Cd32MA2kk/S220/Rlogo.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7848011355253090856.post-6673152971681328670</id><published>2009-07-23T12:21:00.001+05:30</published><updated>2009-07-23T12:22:51.102+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='stored procedures'/><category scheme='http://www.blogger.com/atom/ns#' term='sql server'/><category scheme='http://www.blogger.com/atom/ns#' term='what is stored procedure'/><category scheme='http://www.blogger.com/atom/ns#' term='sql server DBA'/><title type='text'>What are Stored Procedures</title><content type='html'>Have you ever written SQL statements, like inserts, selects, and updates? Then you have already written most of a stored procedure. A stored procedure is an already written SQL statement that is saved in the database. If you find yourself using the same query over and over again, it would make sense to put it into a stored procedure. When you put this SQL statement in a stored procedure, you can then run the stored procedure from the database's command environment (I am a SQL Server kind of guy, and run stored procedures from the Query Analyzer), using the exec command.&lt;br /&gt;&lt;br /&gt;An example is:&lt;br /&gt;&lt;br /&gt;exec usp_displayallusers&lt;br /&gt;&lt;br /&gt;The name of the stored procedure is "usp_displayallusers", and "exec" tells SQL Server to execute the code in the stored procedure. (Note: "usp_" in front of the stored procedure name is used to designate this stored procedure as a user-created stored procedure.) The code inside the stored procedure can be something as simple as:&lt;br /&gt;&lt;br /&gt;SELECT * FROM USERLIST&lt;br /&gt;&lt;br /&gt;This "select" statement will return all data in the USERLIST table. You may think, skeptically, that stored procedures aren’t terribly useful. Just save the query and run it when you need to. Too easy, right?&lt;br /&gt;&lt;br /&gt;Well, there is more to the story. Many queries get more complex than "select * from . . ."  Also, you may want to call the stored procedure from an application, such as an ASP page, Visual Basic application, or a Java servlet. With a stored procedure, you can store all the logic in the database, and use a simple command to call the stored procedure. Later, if you decide to migrate from ASP to J2EE, you only need to change the application layer, which will be significantly easier. Much of the business logic will remain in the database.&lt;br /&gt;&lt;br /&gt;Enough background—let’s write some stored procedures.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7848011355253090856-6673152971681328670?l=ravifirst.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ravifirst.blogspot.com/feeds/6673152971681328670/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ravifirst.blogspot.com/2009/07/what-are-stored-procedures.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/6673152971681328670'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/6673152971681328670'/><link rel='alternate' type='text/html' href='http://ravifirst.blogspot.com/2009/07/what-are-stored-procedures.html' title='What are Stored Procedures'/><author><name>Ravi's</name><uri>http://www.blogger.com/profile/14359502815484562942</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_WxhoysBC8gY/StgCRfR-X5I/AAAAAAAAAJQ/l5Cd32MA2kk/S220/Rlogo.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7848011355253090856.post-7009605618516320731</id><published>2009-07-23T12:15:00.003+05:30</published><updated>2009-07-23T12:20:39.549+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='stored procedures'/><category scheme='http://www.blogger.com/atom/ns#' term='benifits of stored procedures'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL FAQs'/><category scheme='http://www.blogger.com/atom/ns#' term='delete duplicate rows sql server'/><category scheme='http://www.blogger.com/atom/ns#' term='advantages of stored procedures'/><title type='text'>Benefits of Stored Procedures</title><content type='html'>Why should you use stored procedures? Let's take a look at the key benefits of this technology:&lt;br /&gt;&lt;br /&gt;    a) Precompiled execution. SQL Server compiles each stored procedure once and then reutilizes the execution plan. This results in tremendous performance boosts when stored procedures are called repeatedly.&lt;br /&gt; &lt;br /&gt;   b) Reduced client/server traffic. If network bandwidth is a concern in your environment, you'll be happy to learn that stored procedures can reduce long SQL queries to a single line that is transmitted over the wire.&lt;br /&gt;&lt;br /&gt;    c) Efficient reuse of code and programming abstraction. Stored procedures can be used by multiple users and client programs. If you utilize them in a planned manner, you'll find the development cycle takes less time.&lt;br /&gt;&lt;br /&gt;    d) Enhanced security controls. You can grant users permission to execute a stored procedure independently of underlying table permissions.&lt;br /&gt;&lt;br /&gt;      Stored procedures are very similar to user-defined functions, but there are subtle differences. &lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Structure&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;        Stored procedures are extremely similar to the constructs seen in other programming languages. They accept data in the form of input parameters that are specified at execution time. These input parameters (if implemented) are utilized in the execution of a series of statements that produce some result. This result is returned to the calling environment through the use of a recordset, output parameters and a return code. That may sound like a mouthful, but you'll find that stored procedures are actually quite simple.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Example&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Let's take a look at a practical example. Assume we have the table shown at the bottom of this page, named Inventory. This information is updated in real-time and warehouse managers are constantly checking the levels of products stored at their warehouse and available for shipment. In the past, each manager would run queries similar to the following:&lt;br /&gt;&lt;br /&gt;    SELECT Product, Quantity&lt;br /&gt;    FROM Inventory&lt;br /&gt;    WHERE Warehouse = 'FL'&lt;br /&gt;&lt;br /&gt;This resulted in very inefficient performance at the SQL Server. Each time a warehouse manager executed the query, the database server was forced to recompile the query and execute it from scratch. It also required the warehouse manager to have knowledge of SQL and appropriate permissions to access the table information.&lt;br /&gt;&lt;br /&gt;We can simplify this process through the use of a stored procedure. Let's create a procedure called sp_GetInventory that retrieves the inventory levels for a given warehouse. Here's the SQL code:&lt;br /&gt;&lt;br /&gt;    CREATE PROCEDURE sp_GetInventory&lt;br /&gt;    @location varchar(10)&lt;br /&gt;    AS&lt;br /&gt;    SELECT Product, Quantity&lt;br /&gt;    FROM Inventory&lt;br /&gt;    WHERE Warehouse = @location&lt;br /&gt;&lt;br /&gt;Our Florida warehouse manager can then access inventory levels by issuing the command&lt;br /&gt;&lt;br /&gt;    EXECUTE sp_GetInventory 'FL'&lt;br /&gt;&lt;br /&gt;The New York warehouse manager can use the same stored procedure to access that area's inventory.&lt;br /&gt;&lt;br /&gt;    EXECUTE sp_GetInventory 'NY'&lt;br /&gt;&lt;br /&gt;Granted, this is a simple example, but the benefits of abstraction can be seen here. The warehouse manager does not need to understand SQL or the inner workings of the procedure. From a performance perspective, the stored procedure will work wonders. The SQL Sever creates an execution plan once and then reutilizes it by plugging in the appropriate parameters at execution time.&lt;br /&gt;&lt;br /&gt;Now that you've learned the benefits of stored procedures, get out there and use them! Try a few examples and measure the performance enhancements achieved -- you'll be amazed!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7848011355253090856-7009605618516320731?l=ravifirst.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ravifirst.blogspot.com/feeds/7009605618516320731/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ravifirst.blogspot.com/2009/07/benefits-of-stored-procedures.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/7009605618516320731'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/7009605618516320731'/><link rel='alternate' type='text/html' href='http://ravifirst.blogspot.com/2009/07/benefits-of-stored-procedures.html' title='Benefits of Stored Procedures'/><author><name>Ravi's</name><uri>http://www.blogger.com/profile/14359502815484562942</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_WxhoysBC8gY/StgCRfR-X5I/AAAAAAAAAJQ/l5Cd32MA2kk/S220/Rlogo.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7848011355253090856.post-7325556441006120063</id><published>2009-07-22T00:33:00.003+05:30</published><updated>2009-07-22T00:38:31.770+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='t-sql'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL FAQs'/><category scheme='http://www.blogger.com/atom/ns#' term='sql server DBA'/><category scheme='http://www.blogger.com/atom/ns#' term='performance tuning'/><category scheme='http://www.blogger.com/atom/ns#' term='tips'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL SERVER PERFORMANCE TUNING TIPS'/><category scheme='http://www.blogger.com/atom/ns#' term='Performance Tuning Tips for Creating Visual Basic Applications'/><category scheme='http://www.blogger.com/atom/ns#' term='sql interview'/><title type='text'>SQL Server Performance Tuning Tips - IV</title><content type='html'>&lt;strong&gt;Performance Tuning Tips for Creating Visual Basic Applications&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;52. While ADO (and other VB object libraries) make database manipulation easy for the programmer, using these shortcuts can kill SQL Server performance. As a rule of thumb, encapsulate your DML (Data Manipulation Language) in stored procedures and run them from your VB application. This bypasses object library overhead (such as reducing cursors) and reduces the chatter between the VB application and SQL Server over the network. &lt;br /&gt;So what does this mean in practice? Essentially, avoid using the ADO recordset object to modify (INSERT, UPDATE, DELETE) data in your VB code. Instead, use Transact-SQL, encapsulated in stored procedures, to modify data in a SQL Server database. An ADO recordset should be used as a method of reading data, not modifying data. [6.5, 7.0, 2000] &lt;br /&gt; &lt;br /&gt;53. When using an ADO recordset to return data from SQL Server, the most efficient way is to use what is often called a firehose cursor. The firehouse cursor is really an incorrect term because it is not a cursor. A firehose cursor is just a method to quickly move data from SQL Server to the client that requested it.&lt;br /&gt;Essentially, a firehose cursor sends the requested data (from the query) to an output buffer on SQL Server. Once the output buffer is full, it waits until the client can retrieve the data from the output buffer. Then the output buffer is filled again. This process repeats over and over until all of the data is sent to the client. Another advantage of this method is that records are only locked long enough to be moved to the output buffer.&lt;br /&gt;When you open an ADO RecordSet and use its default settings, a firehose cursor is automatically used by default. If you want to specify a firehouse cursor manually, you can do so by using these property settings:&lt;br /&gt;• CursorType = adForwardOnly &lt;br /&gt;• CursorLocation = adUseServer &lt;br /&gt;• LockType = adLockReadOnly &lt;br /&gt;• CacheSize = 1 &lt;br /&gt;When the client receives the data from the firehose cursor, the data should be read into a local data structure for local use by the client. [6.5, 7.0, 2000]&lt;br /&gt; &lt;br /&gt;54. When accessing data on a SQL Server, write your VB code so as to minimize the number of round-trips between the application and SQL Server. Each and every time you use ADO to execute Transact-SQL code to get data from SQL Server, multiple, time-consuming steps have to occur. For example:&lt;br /&gt;• Your VB code must generate a request to SQL Server in the form of a Transact-SQL statement. &lt;br /&gt;• The statement is sent to the database through the Connection object. &lt;br /&gt;• The request from the Connection object has to be translated into packets that can be sent over the network. &lt;br /&gt;• The packets move over the network. &lt;br /&gt;• When the packets arrive at SQL Server, they must be converted back into a form useable by SQL Server. &lt;br /&gt;• SQL Server must then process the Transact-SQL statement. Assuming a stored procedure is not used, then this code must be optimized and compiled, then executed. &lt;br /&gt;• The results, in the form of TDS (Tabular Data Stream), are then translated into packets that can be sent over the network. &lt;br /&gt;• The packets move over the network, again. &lt;br /&gt;• When the packets arrive at SQL Server, they must be converted back into TDS format. &lt;br /&gt;• When ADO received the TDS data, it is converted into a recordset, ready to be used by the application. &lt;br /&gt;If you know much about the technical details of networking, then you know that the above steps have been oversimplified. The point to remember is that round-trips between your application and SQL Server are expensive in time and resources, and you need to do your best in your code to minimize them. [6.5, 7.0, 2000] &lt;br /&gt; &lt;br /&gt;55. One way to help reduce round-trips between your application and SQL Server is to move the data you need at the client from SQL Server in a single query, not in multiple queries. I have seen some applications that only retrieve one row at a time, making a round-trip for every row needed by the application. This can be very expensive in resources and it hurts performance. Of course, you can't always know what rows will be needed ahead of time, but the better you can guess, even if you guess and return too many rows, returning them in one round-trip is usually more efficient than retrieving only one row at a time. [6.5, 7.0, 2000] &lt;br /&gt; &lt;br /&gt;56. When retrieving data from a SQL Server 7 database, take full advantage of views when appropriate. This is especially true if you are not encapsulating your Transact-SQL in stored procedures as recommended. While calling a view is not usually as efficient as using a stored procedure to retrieve data, it is much more efficient that using embedded Transact-SQL in your ASP code or COM components. [6.5, 7.0, 2000] &lt;br /&gt; &lt;br /&gt;57. Don't use DAO to access SQL Server, it is performance suicide. Also avoid ODBCDirect. Instead, use RDO or ADO. [6.5, 7.0, 2000] &lt;br /&gt; &lt;br /&gt;58. When creating a connection using ADO, be sure you use the OLE DB provider, not the older ODBC provider for SQL Server, or the ODBC provider for OLE DB. The parameter you will use in your connection string is "provider=sqloledb". The OLE DB provider performs much more efficiently than the ODBC provider, providing better performance. [7.0, 2000] &lt;br /&gt;&lt;br /&gt;59. Use stored procedures instead of embedding Transact-SQL in your VB code. This significantly reduces network traffic and speeds up query execution. [6.5, 7.0, 2000] &lt;br /&gt; &lt;br /&gt;60. If you are VB developer and need to access SQL Server data, but don't have the time or interest in learning how to write stored procedures, consider using the GetRows method of the RecordSet object. The GetRows method is used to pull all the records from the recordset into an array, which is much faster than using embedded Transact-SQL to download a RecordSet to your application. [6.5, 7.0, 2000] &lt;br /&gt; &lt;br /&gt;61. If possible in your application, use stored procedures to "batch" a set of related Transact-SQL statements together, instead of calling a separate stored procedure for every database task you want to perform. This helps to reduce network traffic and server overhead. [6.5, 7.0, 2000] &lt;br /&gt; &lt;br /&gt;62. If you have a related group, or batch, or Transact-SQL statements you want to execute, but you don't want to use a stored procedure, as generally recommended for dealing with batches of Transact-SQL statements, one option you can use to boost performance if your VB code is to concatenate two or more separate Transact-SQL statements into a single batch and execute them as a single message. This is much more efficient that sending the Transact-SQL code to SQL Server as many different messages. [6.5, 7.0, 2000] &lt;br /&gt; &lt;br /&gt;63. When SELECTing data from your application to be returned to it from SQL Server, limit the amount of rows returned to only those that are needed now. If necessary, force the user to enter selection criteria to limit the results set. [6.5, 7.0, 2000] &lt;br /&gt; &lt;br /&gt;64. If your application allows users to run queries, but you are unable in your application to easily prevent users from returning hundreds, even thousands of unnecessary rows of data they don't need, consider using the TOP operator within the query. This way, you can limit how may rows are returned, even if the user doesn't enter any criteria to help reduce the number or rows returned to the client. [6.5, 7.0, 2000] &lt;br /&gt; &lt;br /&gt;65. If your application needs to perform looping, try to put the loop inside a stored procedure so it can be executed on the server without having to make round trips between the client and server. [6.5, 7.0, 2000] &lt;br /&gt; &lt;br /&gt;66. When creating transactions in your application, don't create them using ADO's methods. Instead, encapsulate the transaction in stored procedure so that it executes on the server. [6.5, 7.0, 2000] &lt;br /&gt; &lt;br /&gt;67. Keep as much of the business logic of your application as possible off the client. In two-tier designs, put the business logic in stored procedures on the server. In n-tier designs, put the business logic in components on MTS. [6.5, 7.0, 2000] &lt;br /&gt; &lt;br /&gt;68. If you have the need to filter or sort data on-the-fly at the client, let ADO do this for you at the client. When the data is first requested by the client from the server (ideally using a stored procedure), have all the data the client wants to "play" with sent to the client. Once the recordset is at the client, then ADO methods can be used to filter or sort the data. This helps to reduce network traffic and takes some of the load off of the server. [6.5, 7.0, 2000] &lt;br /&gt; &lt;br /&gt;69. By default, the CacheSize property of the ADO Recordset object determines how many rows are fetched from a server-side cursor at a time. The default is one. This means each row of the recordset is returned one at a time from the server to the client. This is very inefficient. The CacheSize property needs to be set to a much higher figure, such as between 100 and 500, depending on the number of rows that are to be eventually returned from the server to the client. [6.5, 7.0, 2000] &lt;br /&gt; &lt;br /&gt;70. When calling SQL Server stored procedures from the ADO Command object, don't use the Refresh method to identify the parameters of a stored procedure. This produces extra network traffic and slows performance. Instead, explicitly create the parameters yourself using ADO code. [7.0, 2000] &lt;br /&gt; &lt;br /&gt;71. ADO allows you to create four different types of SQL Server cursors. Each has its own place, and you will want to choose the cursor that uses the least possible resources for the task at hand. When at all possible, attempt to use the Forward-Only cursor, which uses the least amount of overhead of the four cursor types. [6.5, 7.0, 2000] &lt;br /&gt;&lt;br /&gt;72. Avoid using the MoveFirst method of the RecordSet object when using a Forward-Only cursor. In effect, when you use this method, it re-executes the entire query and repopulates the Forward-Only cursor, increasing server overhead. [6.5, 7.0, 2000] &lt;br /&gt;&lt;br /&gt;73. If you create COM objects to encapsulate database access, try to follow these two suggestions if you want optimum speed: 1) use in-process dlls; and 2) use early-binding. [6.5, 7.0, 2000] &lt;br /&gt;&lt;br /&gt;74. Consider using ADO's ability to create disconnected recordsets to help reduce the load on SQL Server. [6.5, 7.0, 2000] &lt;br /&gt;&lt;br /&gt;75. When storing your SQL Server data into VB variables, always use strongly typed variables. Avoid using the variant data type (which is not always possible), as it has greater overhead than the other data types. [6.5, 7.0, 2000] &lt;br /&gt;&lt;br /&gt;76. If you create object variables in your VB code to refer to COM objects that hold SQL Server data, be sure to strongly type them. Avoid using the AS OBJECT keywords, instead, always explicitly specify the type of object you want to create. [6.5, 7.0, 2000] &lt;br /&gt;&lt;br /&gt;77. When instantiating COM objects to hold SQL Server data, create them explicitly, not implicitly. [6.5, 7.0, 2000] &lt;br /&gt;&lt;br /&gt;78. If you will be calling the same stored procedure, view, or SQL statements over and over again in your code, don't create a new Command object each time. Instead, reuse the Command object. [6.5, 7.0, 2000] &lt;br /&gt;&lt;br /&gt;79. When looping through recordsets, be sure you bind columns to field objects before the looping begins. Don't use the Fields collection of the Recordset object to assign values for fields in a Recordset within each loop, it incurs much more overhead. [6.5, 7.0, 2000] &lt;br /&gt;&lt;br /&gt;80. If you know that the results of a query from within a stored procedure you call will return only one row of data (and not an entire recordset), don't open an ADO Recordset for the purpose of retrieving the data. Instead, use a stored procedure output parameter. [6.5, 7.0, 2000] &lt;br /&gt;&lt;br /&gt;81. If your application needs to insert a large binary value into an image data column, perform this task using a stored procedure, not using an INSERT statement embedded in your application. The reason for this is because the application must first convert the binary value into a character string (which doubles its size, thus increasing network traffic and taking more time) before it can be sent to the server. And when the server receives the character string, it then has to convert it back to the binary format (taking even more time). Using a stored procedure avoids all this. [6.5, 7.0, 2000] &lt;br /&gt;&lt;br /&gt;82. When ADO is used to open more than one ForwardOnly recordset on a single Connection object at a time, only the first recordset is opened using the Connection object you previously created. Additional new connections don't use the same Connection object. Instead, separate connections are created for each ForwardOnly recordset you create after the first. This occurs because SQL Server can only open one ForwardOnly cursor per connection. The more connections you create, the greater the stress on SQL Server and performance and scalability suffer. &lt;br /&gt;To avoid this problem, don't use a ForwardOnly recordset. Static, Keyset, and Dynamic recordsets don't have this problem. Another option is to use a client side cursor instead of SQL Server cursor. Or you can close each recordset before opening another on the same connection. [6.5, 7.0, 2000] &lt;br /&gt; &lt;br /&gt;83. When making your connection to SQL Server, choose DSN-less connections for the fastest connection. Not only does it make database connections faster, it allows you to use the OLE DB provider, which is not available using a DSN-based connection. The OLE DB provider is the fastest provider you can use to access SQL Server. &lt;br /&gt;If you do need to use a DSN, select System DSNs over File DSNs, because they are faster when making connections. [7.0, 2000] &lt;br /&gt; &lt;br /&gt;84. When creating a Connection object, always create it explicitly, not implicitly. Opening a Connection object explicitly consumes less resources than opening it implicitly, and it also allows you to more efficiently manage multiple connections and to reassign the various roles that the Connections objects perform within your application. [6.5, 7.0, 2000] &lt;br /&gt; &lt;br /&gt;85. When using recordsets, be sure to open them explicitly, not implicitly. When recordsets are opened implicitly, you cannot control the default cursor and lock types, which are, respectively, forward-only and read-only. If you always open your recordsets explicitly, then you can specify which cursor and lock types you want to invoke for this particular situation, specifying the types with the least amount of overhead to accomplish the task at hand. [6.5, 7.0, 2000]  &lt;br /&gt; &lt;br /&gt;86. When using ADO to make connections to SQL Server, always be sure you explicitly close any Connection, Recordset, or Command objects you have opened. While letting an object go out of scope will in affect close the object, it is not the same as explicitly closing an object. By explicitly closing these objects and setting them to nothing, you do two things. First, you remove the object sooner than later, helping to free up resources. Second, you eliminate the possibility of "connection creep". Connection creep occurs when connection or resource pooling is used and when connections are not properly closed and released from the pool. This helps to defeat the purpose of pooling and reduces SQL Server's performance. [6.5, 7.0, 2000] &lt;br /&gt; &lt;br /&gt;87. If you are connecting to SQL Server via either OLE DB (version 2.0 or higher) or ODBC (version 3.0 or higher), SQL Server connection pooling is automatically implemented for you. Because of this, you don't have to write special code to implement connection pooling yourself. In addition, you don't want to even reuse an ADO connection object, which is commonly done by many VB developers. &lt;br /&gt;If you want to take the best advantage of database connection pooling, and optimize your VB application's SQL Server data access, the best advice you can receive is to be sure that you only open a database connection just before you need it, and then close it immediately after you are done with it. Don't leave database connections open if you are not using them. &lt;br /&gt;When you create or tear down a database connection in your VB code, you aren't really creating a new connection or tearing down a current connection. What is happening is that your connection requests are send to OLE DB or ODBC, and they determine if a connection needs to be created or torn down. If a new connection is needed, then one is created, or one is used from the current connection pool. And if you request that a connection be torn down, it will actually pool the unused connection until it is needed, or tear it down if it is not reused within a given time period. [6.5, 7.0, 2000]  &lt;br /&gt; &lt;br /&gt;88. In order for connection pooling to work correctly, be sure each connection you open uses the same ConnectionString parameters. Connection pooling only works if all of the parameters for the ConnectionString are identical. If they are all not identical, then a new connection will be opened, circumventing connection pooling. [6.5, 7.0, 2000]  &lt;br /&gt; &lt;br /&gt;89. If appropriate for your application, locate the application's data access components on the SQL Server where the data is, instead of at the client. This can significantly reduce network traffic and overhead and boost data throughput. [6.5, 7.0, 2000] &lt;br /&gt; &lt;br /&gt;90. When creating a Command object to execute a stored procedure against SQL Server, you can use either the adCmdText or the adCmdStoredProc property to tell ADO that you want to execute a stored procedure. Always use the adCmdStoredProc property, which uses RPCs between the client and SQL Server. This acts to bypass parameter translation and boosts performance from 20 to 30 percent over using the adCmdText property. [6.5, 7.0, 2000] &lt;br /&gt; &lt;br /&gt;91. If you need to execute a stored procedure from a Command object, and if the stored procedure will not return any rows, you can boost performance of the Command object by setting the adExecuteNoRecords option. This tells the Command object to not ask for a returning rowset, which saves a little overhead and reduce memory usage. [6.5, 7.0, 2000] &lt;br /&gt; &lt;br /&gt;92. If you need your VB application to generate a unique value for use in a primary key column in a SQL Server table, performance will be slightly better if you let SQL Server, instead of your VB application, create the unique value. SQL Server can generate unique keys using either an Identity (using the Integer data type) column or by using the NEWID function in a UniqueIdentifier column. Of these two, Identify columns offer better performance. [6.5, 7.0, 2000] &lt;br /&gt; &lt;br /&gt;93. When creating COM components to access SQL Server, try to design the component to have as few properties as possible. For example, instead of having a property for every column of data you want to send back or forth between the database and your application, create one generic property that can be used to send all of the columns at one time. What this does is reduce the number of calls that must be made by the component, reducing overhead on the component and SQL Server. [6.5, 7.0, 2000] &lt;br /&gt; &lt;br /&gt;94. When setting Connection Object properties, use the following dot notation instead of using the fully qualified object property notation, whenever appropriate, as it is faster.&lt;br /&gt;&lt;br /&gt;Use this format for optimum speed: &lt;br /&gt;WITH cn&lt;br /&gt;.ConnectionTimeout = 100&lt;br /&gt;.ConnectionString = "xyz"&lt;br /&gt;.Cursor Location = adUseClient&lt;br /&gt;END cn &lt;br /&gt;Not this format: &lt;br /&gt;cn.ConnectionTimeout = 100&lt;br /&gt;cn.ConnectionString = "xyz"&lt;br /&gt;cn.Cursor Location = adUseClient &lt;br /&gt;If you are one of those people who need to prove this claim for yourself, try running the following code:&lt;br /&gt;&lt;br /&gt;Public Declare Function GetTickCount Lib "kernel32" () As Long&lt;br /&gt;Sub T1()&lt;br /&gt;Dim i As Long&lt;br /&gt;Dim cn As ADODB.Connection&lt;br /&gt;Dim Fast As Long&lt;br /&gt;Dim Slow As Long&lt;br /&gt;&lt;br /&gt;Set cn = New ADODB.Connection&lt;br /&gt;&lt;br /&gt;With cn&lt;br /&gt;.ConnectionTimeout = 100&lt;br /&gt;.ConnectionString = "xyz"&lt;br /&gt;.CursorLocation = adUseClient&lt;br /&gt;End With&lt;br /&gt;cn.ConnectionTimeout = 100&lt;br /&gt;cn.ConnectionString = "xyz"&lt;br /&gt;cn.CursorLocation = adUseClient&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;For i = 1 To 100000&lt;br /&gt;Fast = Fast - GetTickCount&lt;br /&gt;With cn&lt;br /&gt;.ConnectionTimeout = 100&lt;br /&gt;.ConnectionString = "xyz"&lt;br /&gt;.CursorLocation = adUseClient&lt;br /&gt;End With&lt;br /&gt;Fast = Fast + GetTickCount&lt;br /&gt;&lt;br /&gt;Slow = Slow - GetTickCount&lt;br /&gt;cn.ConnectionTimeout = 100&lt;br /&gt;cn.ConnectionString = "xyz"&lt;br /&gt;cn.CursorLocation = adUseClient&lt;br /&gt;Slow = Slow + GetTickCount&lt;br /&gt;Next&lt;br /&gt;MsgBox "Fast=" &amp; Fast &amp; vbCrLf &amp; "Slow=" &amp; Slow&lt;br /&gt;End Sub&lt;br /&gt;&lt;br /&gt;Thanks to Gareth Edwards for the above example code.&lt;br /&gt;&lt;br /&gt;[6.5, 7.0, 2000] &lt;br /&gt; &lt;br /&gt;95. Don't use VB objects to act as a data holder (to store data) in your SQL Server-based applications. Instead, use an array or a collection of user-defined types (UDTs). While using objects you create to store data can be convenient, it also creates a lot of unnecessary overhead. Each time you have to instantiate and then destroy an object hurts performance and scalability. How do you know if an object you have created is storing data that should be stored elsewhere? If the class has mostly properties and few if any methods, then this is a good clue. [6.5, 7.0, 2000] &lt;br /&gt; &lt;br /&gt;96. Don't instantiate, initialize, use, and then destroy an object within a loop. If the loop repeats itself much at all, you create an inordinate amount of overhead for your application. Instead, reuse the same object in the loop. One of the best ways to do this is to include a reinitialize method for the object that can be called from within the loop. [6.5, 7.0, 2000]  &lt;br /&gt; &lt;br /&gt;97. For maximum performance, consolidate most, if not all, of your COM components in a single DLL. COM components instantiated from a single DLL instantiate faster than if they are called from multiple DLLs. [6.5, 7.0, 2000]  &lt;br /&gt; &lt;br /&gt;98. If you decide not to use a stored procedure to access SQL Server, but instead choose to use an embedded SQL statement in your VB code, and if that embedded SQL statement will be repeated, such as in a loop, consider setting the ADO Command object's "Prepared" property to "True". &lt;br /&gt;What this property does is to tell SQL Server to compile and save a copy of your SQL statement in SQL Server's cache. The first time the SQL statement is executed, the statement has to be compiled and stored in memory. But in subsequent calls, the statement is called from the cache, boosting performance because it does not have to be recompiled each time it is called. &lt;br /&gt;If the SQL statement will only be executed once, then don't set this option, as it will actually decrease performance for SQL statements that are run only once. The performance boost only comes if the SQL statement is run multiple times. [7.0, 2000] &lt;br /&gt; &lt;br /&gt;99. If you use collections in your VB 6 or ASP code, consider instead using dictionaries in order to boost the performance of your application. While you are probably familiar with what and how collections are used, you may not be familiar with dictionaries. The dictionary class (the Scripting.Dictionary Object) is part of the Microsoft Scripting Runtime library, which is delivered with the VB 6 and ASP development environments. &lt;br /&gt;Like collections, dictionaries can hold any type of data, and items can be retrieved by using a key, or iterated using the "For Each" syntax. But dictionaries are different in that offer properties and methods not available for collections. And the biggest difference is that they are much faster, about twice as fast. If you haven't learned about dictionaries yet, you need to take the time now to learn about their numerous advantages. [6.5, 7.0, 2000]  &lt;br /&gt; &lt;br /&gt;100. To speed up string manipulation in VB (never a fast performing task), consider the following suggestions that can speed string manipulation performance: &lt;br /&gt;• When feasible, use fixed-length strings instead of variable-length strings. &lt;br /&gt;• Try to minimize string concatenation. &lt;br /&gt;• Try to minimize string comparisons. &lt;br /&gt;• Try to avoid calculating the length of a string more than once. If you need this data more than once, and the string length does not change, then calculate the length once and store this value in a variable for reuse. &lt;br /&gt;• When passing a string to an in-process function, try to pass it by reference instead of by value. &lt;br /&gt;• Most VB string functions have two forms, one that produces a variant and one that produces a string (generally has a "$" after the function name). The version that produces the string is faster, and should generally be used. &lt;br /&gt;• Consider using byte arrays instead of strings. &lt;br /&gt;[6.5, 7.0, 2000]&lt;br /&gt; &lt;br /&gt;101. If you still have any legacy VB applications that still use VB-SQL to access SQL Server, you may want to consider rewriting the app. VB-SQL not only provides slow access, it is no longer supported by Microsoft. [6.5]  &lt;br /&gt; &lt;br /&gt;102. If you are the sort of VB developer who likes to design their applications around objects, you want to keep in mind that over-encapsulating data access within objects can hurt performance. For example, from an OO design approach, you might consider encapsulating data access to each individual table in a SQL Server database, creating a separate class for each table. While this may appeal to your OO design goals, it is inefficient from a performance perspective. &lt;br /&gt;Too much encapsulation can lead to situations where you don't take advantage of SQL Server's built-in optimization abilities, it causes too many round-trips to the database, and it can use more database connections than absolutely required. Instead of over-encapsulating your data access in class, a more efficient approach is to use stored procedures to encapsulate your business logic. Stored procedures eliminate these three drawbacks. [6.5, 7.0, 2000] &lt;br /&gt; &lt;br /&gt;103. If you use send Transact-SQL code as part of your VB ADO code directly to SQL Server, without using a stored procedure (which we don't recommend if you want best performance, use a stored procedure instead) you want ADO to execute the Transact-SQL code using the sp_executesql system stored procedure, not for ADO to create a temporary stored procedure in one step, execute the temporary stored procedure in the second step, and then drop the temporary stored procedure in a third step. As you can imagine, this is a total of three crosses of the network, and it can greatly increase overhead and hurt performance. &lt;br /&gt;How do you know if your ADO code is behaving well? Use the SQL Server Profiler to trace the activity between your VP application and SQL Server. If you see that SQL Server is creating temporary stored procedures, and not using sp_executesql, then you need to review your ADO code, looking for ways to optimize it. [7.0, 2000] &lt;br /&gt; &lt;br /&gt;104. Limit the amount of rows you return from a database to populate a pick-list or drop-down box. Lots of rows not only slows down your application, it also makes it less convenient for your user to select the item or items they need. Have you ever had to select from over 100 choices? It is not easy. &lt;br /&gt;If you need to give your user a lot of choices, instead of displaying them in one large pick-list or drop-down list, provide a way for the user to filter out any options that are not applicable to them. For the best performance, perform the filtering at the client, not the SQL Server.&lt;br /&gt;&lt;br /&gt;Ideally, you should use a stored procedure to retrieve the minimum amount of rows you need, then if there are still a lot of rows to to deal with (from the user's perspective), provide a mechanism for the user to filter the list using the various ADO methods available to use for local filtering. This reduces the number of round trips from the client to SQL Server, helping to boost performance. [6.5, 7.0, 2000]&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7848011355253090856-7325556441006120063?l=ravifirst.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ravifirst.blogspot.com/feeds/7325556441006120063/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ravifirst.blogspot.com/2009/07/sql-server-performance-tuning-tips-iv.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/7325556441006120063'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/7325556441006120063'/><link rel='alternate' type='text/html' href='http://ravifirst.blogspot.com/2009/07/sql-server-performance-tuning-tips-iv.html' title='SQL Server Performance Tuning Tips - IV'/><author><name>Ravi's</name><uri>http://www.blogger.com/profile/14359502815484562942</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_WxhoysBC8gY/StgCRfR-X5I/AAAAAAAAAJQ/l5Cd32MA2kk/S220/Rlogo.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7848011355253090856.post-2707665352417700496</id><published>2009-07-22T00:29:00.002+05:30</published><updated>2009-07-22T00:33:31.450+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='sql Query'/><category scheme='http://www.blogger.com/atom/ns#' term='t-sql'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL FAQs'/><category scheme='http://www.blogger.com/atom/ns#' term='sql server DBA'/><category scheme='http://www.blogger.com/atom/ns#' term='performance tuning'/><category scheme='http://www.blogger.com/atom/ns#' term='tips'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL SERVER PERFORMANCE TUNING TIPS'/><category scheme='http://www.blogger.com/atom/ns#' term='Indexes in sql server'/><category scheme='http://www.blogger.com/atom/ns#' term='sql interview'/><title type='text'>SQL Server Performance Tuning Tips - III</title><content type='html'>&lt;strong&gt;Continued from SQL server performance tuning tips - II&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;36. If your SELECT statement contains a HAVING clause, write your query so that the WHERE clause does most of the work (removing undesired rows) instead of the HAVING clause do the work of removing undesired rows. Using the WHERE clause appropriately can eliminate unnecessary rows before they get to the GROUP BY and HAVING clause, saving some unnecessary work, and boosting performance.&lt;br /&gt;For example, in a SELECT statement with WHERE, GROUP BY, and HAVING clauses, here's what happens. First, the WHERE clause is used to select the appropriate rows that need to be grouped. Next, the GROUP BY clause divides the rows into sets of grouped rows, and then aggregates their values. And last, the HAVING clause then eliminates undesired aggregated groups. If the WHERE clause is used to eliminate as many of the undesired rows as possible, this means the GROUP BY and the HAVING clauses will have less work to do, boosting the overall performance of the query. [6.5, 7.0, 2000] &lt;br /&gt; &lt;br /&gt;37. If you need to write a SELECT statement to retrieve data from a single table, don't SELECT the data from a view that points to multiple tables. Instead, SELECT the data from the table directly, or from a view that only contains the table you are interested in. If you SELECT the data from the multi-table view, the query will experience unnecessary overhead, and performance will be hindered. [6.5, 7.0, 2000] &lt;br /&gt; &lt;br /&gt;38. If your application performs many wildcard (LIKE %) text searches on CHAR or VARCHAR columns, consider using SQL Server's full-text search option. The Search Service can significantly speed up wildcard searches of text stored in a database. [7.0, 2000] &lt;br /&gt; &lt;br /&gt;39. The GROUP BY clause can be used with or without an aggregate function. But if you want optimum performance, don't use the GROUP BY clause without an aggregate function. This is because you can accomplish the same end result by using the DISTINCT option instead, and it is faster. &lt;br /&gt;For example, you could write your query two different ways: &lt;br /&gt;USE Northwind&lt;br /&gt;SELECT OrderID&lt;br /&gt;FROM [Order Details]&lt;br /&gt;WHERE UnitPrice &gt; 10&lt;br /&gt;GROUP BY OrderID &lt;br /&gt;or &lt;br /&gt;USE Northwind&lt;br /&gt;SELECT DISTINCT OrderID&lt;br /&gt;FROM [Order Details]&lt;br /&gt;WHERE UnitPrice &gt; 10 &lt;br /&gt;Both of the above queries produce the same results, but the second one will use less resources and perform faster. [6.5, 7.0, 2000] Added 1-12-2001 &lt;br /&gt; &lt;br /&gt;40. Generally, it is better to perform multiple UPDATEs on records in one fell swoop (using one query), instead of running the UPDATE statement multiple times (using multiple queries). &lt;br /&gt;For example, you could accomplish the same goal two different ways: &lt;br /&gt;USE Northwind&lt;br /&gt;UPDATE Products&lt;br /&gt;SET UnitPrice = UnitPrice * 1.06&lt;br /&gt;WHERE UnitPrice &gt; 5&lt;br /&gt;&lt;br /&gt;GO&lt;br /&gt;&lt;br /&gt;USE Northwind&lt;br /&gt;UPDATE Products&lt;br /&gt;SET UnitPrice = ROUND(UnitPrice, 2)&lt;br /&gt;WHERE UnitPrice &gt; 5&lt;br /&gt;&lt;br /&gt;GO&lt;br /&gt;&lt;br /&gt;or&lt;br /&gt;&lt;br /&gt;USE Northwind&lt;br /&gt;UPDATE Products&lt;br /&gt;SET UnitPrice = ROUND(UnitPrice * 1.06, 2)&lt;br /&gt;WHERE UnitPrice &gt; 5&lt;br /&gt;&lt;br /&gt;GO&lt;br /&gt;&lt;br /&gt;As is obvious from this example, the first option requires two queries to accomplish the same task as the second query. Running one query instead of two or more usually produces the best performance. [6.5, 7.0, 2000]  &lt;br /&gt; &lt;br /&gt;41. Sometimes perception is more important that reality. For example, which of the following two queries is the fastest: &lt;br /&gt;• A query that takes 30 seconds to run, and then displays all of the required results. &lt;br /&gt;• A query that takes 60 seconds to run, but displays the first screen full of records in less than 1 second. &lt;br /&gt;Most DBAs would choose the first option as it takes less server resources and performs faster. But from many user's point-of-view, the second one may be more palatable. By getting immediate feedback, the user gets the impression that the application is fast, even though in the background, it is not.&lt;br /&gt;If you run into situations where perception is more important than raw performance, consider using the FAST query hint. The FAST query hint is used with the SELECT statement using this form:&lt;br /&gt;OPTION(FAST number_of_rows)&lt;br /&gt;where number_of_rows is the number of rows that are to be displayed as fast as possible.&lt;br /&gt;When this hint is added to a SELECT statement, it tells the Query Optimizer to return the specified number of rows as fast as possible, without regard to how long it will take to perform the overall query. Before rolling out an application using this hint, I would suggest you test it thoroughly to see that it performs as you expect. You may find out that the query may take about the same amount of time whether the hint is used or not. If this the case, then don't use the hint. [7.0, 2000] &lt;br /&gt; &lt;br /&gt;42. Instead of using temporary tables, consider using a derived table instead. A derived table is the result of using a SELECT statement in the FROM clause of an existing SELECT statement. By using derived tables instead of temporary tables, we can reduce I/O and boost our application's performance. [7.0, 2000] Added 3-9-2001 More info on derived tables. &lt;br /&gt; &lt;br /&gt;43. When using the WHILE statement, don't avoid the use of BREAK just because some people consider it bad programming form. Often when creating Transact-SQL code using the WHILE statement, you can avoid using BREAK by moving a few lines of code around. If this works in your case, then by all means don't use BREAK. But if your efforts to avoid using BREAK require you to add additional lines of code that makes your code run slower, then don't do that. Sometimes, using BREAK can speed up the execution of your WHILE statements. [6.5, 7.0, 2000]&lt;br /&gt;&lt;br /&gt;44. Computed columns in SQL Server 2000 can be indexed if they meet all of the following criteria: &lt;br /&gt;• The computed column's expression is deterministic. &lt;br /&gt;• The ANSI_NULL connection-level object was on when the table was created. &lt;br /&gt;• TEXT, NTEXT, or IMAGE data types are not used in the computed column. &lt;br /&gt;• The physical connection used to create the index, and all connections used to INSERT, UPDATE, or DELETE rows in the table must have these six SET options properly configured: ANSI_NULLS = ON, ANSI_PADDINGS = ON, ANSI_WARNINGS = ON, ARITHABORT = ON, CONCAT_NULL_YIELDS_NULL = ON, QUOTED_IDENTIFIER = ON, NUMERIC_ROUNDABORT = OFF. &lt;br /&gt;[2000] &lt;br /&gt;&lt;br /&gt;45. One of the advantages of using SQL Server for two-tier and three-tier applications is that you can offload much (if not most) of the data processing work from the other tiers and place it on SQL Server. The more work you can perform within SQL Server, the fewer the network roundtrips that need to be made between the various tiers and SQL Server. And generally the fewer the network roundtrips, the more scalable and faster the application becomes. &lt;br /&gt;But in some applications, such as those than involve complex math, SQL Server has traditionally been weak. In these cases, complex math often could not be performed within SQL Server, instead it had to be performed on another tier, causing more network roundtrips than desired. &lt;br /&gt;Now that SQL Server 2000 supports user-defined functions (UDFs), this is becoming less of a problem. UDFs allow developers to perform many complex math functions from within SQL Server, functions that previously could only be performed outside of SQL Server. By taking advantage of UDFs, more work can stay with SQL Server instead of being shuttled to another tier, reducing network roundtrips, and potentially boosting your application's performance. &lt;br /&gt;Obviously, boosting your application's performance is not as simple as moving math functions to SQL Server, but it is one more new feature of SQL Server 2000 that developers can take advantage of in order to boost their application's scalability and performance. [2000] &lt;br /&gt;&lt;br /&gt;46. When creating scalar user-defined functions, avoid as a matter of routine applying them to large result sets. This is because complex user-defined functions have the potential of involving high overhead, and there is no way to know for sure how they will affect performance when dealing with large result sets. Of course, if you know for sure that the user-defined function is not a performance problem, then using it is OK in larger results sets. You will want to test this theory before the user-defined function is put into production. [2000] &lt;br /&gt;&lt;br /&gt;47. SQL Server 2000 offers a new data type called "table." Its main purpose is for the temporary storage of a set of rows. A variable, of type "table," behaves as if it is a local variable. And like local variables, it has a limited scope, which is within the batch, function, or stored procedure in which it was declared. In most cases, a table variable can be used like a normal table. SELECTs, INSERTs, UPDATEs, and DELETEs can all be made against a table variable. &lt;br /&gt;For best performance, if you need a temporary table in your Transact-SQL code, try to use a table variable instead of creating a conventional temporary table instead. Table variables are created and manipulated in memory instead of the tempdb database, making them much faster. In addition, table variables found in stored procedures result in fewer compilations (than when using temporary tables), and transactions using table variables only last as long as the duration of an update on the table variable, requiring less locking and logging resources. [2000] &lt;br /&gt;&lt;br /&gt;48. Don't repeatedly reuse the same function to calculate the same result over and over within your Transact-SQL code. For example, if you need to reuse the value of the length of a string over and over within your code, perform the LEN function once on the string, and this assign the result to a variable, and then use this variable, over and over, as needed in your code. Don't recalculate the same value over and over again by reusing the LEN function each time you need the value, as it wastes SQL Server resources and hurts performance. [6.5, 7.0, 2000] &lt;br /&gt;&lt;br /&gt;49. Most of you are probably familiar with the aggregate SUM() function and how it works. Occasionally, it would be nice if SQL Server had a PRODUCT() function, which it does not. While SUM() is used to sum a group a data, the theoretical PRODUCT() function would find the product of a group of data. &lt;br /&gt;One way around the problem of there not being a PRODUCT() function in SQL Server is to use some combination of a cursor and/or temporary tables. As you can imagine, this would not be very efficient. A better choice would be to use a set-based function, like the theoretical PRODUCT() function. &lt;br /&gt;With a little algebra, you can simulate a PRODUCT() function in SQL Server using the built-in SQL Server LOG10(), POWER(), and SUM() function working together. This is because logarithms allow you to find the product of numbers by summing them. This was how the products of large numbers were found before the days of calculators. (Are you old enough to remember using logarithm tables in school? I am. Ouch!) &lt;br /&gt;Below is a very simple example of how you can use a combination of the LOG10(), POWER(), and SUM() functions in SQL Server to simulate a PRODUCT() function. You will probably want to modify it to meet your specific needs, such as to eliminate null data, zero data, or data that might be negative. &lt;br /&gt;SELECT column_name1, POWER(10,SUM(LOG10(column_name2))) AS Product&lt;br /&gt;FROM table_name&lt;br /&gt;GROUP BY column_name1 &lt;br /&gt;For example, let's look at the following to see how this works. &lt;br /&gt;Record 1 (1000, 2)&lt;br /&gt;Record 2 (1000, 2)&lt;br /&gt;Record 3 (1000, 2)&lt;br /&gt;Record 4 (1001, 3)&lt;br /&gt;Record 5 (1001, 3) &lt;br /&gt;Our goal here is find the product of all the records where column_name1 = 1000 and to find the product of all the records where column_name_name1 = 1001. When the above query is run, we get these results: &lt;br /&gt;1000, 8&lt;br /&gt;1001, 9 &lt;br /&gt;What has happened is that where column_name1 = 1000 (which are the first three records in our sample data), the values in column_name2 (which are 2 and 2 and 2) are multiplied together to return 8. In addition, where column_name1 = 1001 (which are the last two records in our sample data), the values in column_name2 (which are 3 and 3) are multiplied together to return 9. &lt;br /&gt;Creating your own PRODUCT() function produces much faster results than trying to accomplish the same task by using a cursor and/or temporary tables. [6.5, 7.0, 2000] Added 10-11-2001 &lt;br /&gt;&lt;br /&gt;50. Many developers choose to use an identify column at their primary key. By design, an identity column does not guarantee that that each newly created row will be consecutively numbered. This means they will most likely be occasional gaps in the identity column numbering scheme. For most applications, occasional gaps in the identity column present no problems. &lt;br /&gt;On the other hand, some developers don't like these occasional gaps, trying to avoid them. With some clever use of INSTEAD OF triggers in SQL Server 2000, it is possible prevent these numbering gaps. But at what cost? &lt;br /&gt;The problem with trying to force an identify column to number consecutively without gaps can lead to locking and scalability problems, hurting performance. So the recommendation is not to try to get around the identify column's built-in method of working. If you do, expect performance problems. [2000] &lt;br /&gt;&lt;br /&gt;51. Avoid using variables in the WHERE clause of a query located in a batch file. Let's find out why this may not be a good idea. &lt;br /&gt;First, let's look at the following code: &lt;br /&gt;SELECT employee_id&lt;br /&gt;FROM employees&lt;br /&gt;WHERE age = 30 and service_years = 10 &lt;br /&gt;Assuming that both the age and the service_years columns have indexes, and the table has many thousands of records, then SQL Server's Query Optimizer will select the indexes to perform the query and return results very quickly. &lt;br /&gt;Now, let's look at the same query, but written to be more generic, one that you might find in a generic batch file: &lt;br /&gt;DECLARE @age int&lt;br /&gt;SET @age = "30"&lt;br /&gt;DECLARE @service_years int&lt;br /&gt;SET @service_years = "10"&lt;br /&gt;SELECT employee_id&lt;br /&gt;FROM employees&lt;br /&gt;WHERE age = @age and service_years = @service_years &lt;br /&gt;When the above code is run, even though both the age and the service_years columns have indexes, they won't be used, and a table scan will be used instead, potentially greatly increasing the amount of time for the query to run. &lt;br /&gt;The reason the indexes are not used is because the Query Analyzer does not know the value of the variables when it selects an access method to perform the query. Because this is a batch file, only one pass is made of the Transact-SQL code, preventing the Query Optimizer from knowing what it needs to know in order to select an access method that uses the indexes. &lt;br /&gt;If you cannot avoid using variables in the WHERE clauses of batch scripts, consider using an INDEX query hint to tell the Query Optimizer to use the available indexes instead of ignoring them and performing a table scan. This of course that the indexes are highly selective. If the indexes are not highly selective, then a table scan most likely be more efficient than using the available indexes. [6.5, 7.0, 2000]&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7848011355253090856-2707665352417700496?l=ravifirst.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ravifirst.blogspot.com/feeds/2707665352417700496/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ravifirst.blogspot.com/2009/07/sql-server-performance-tuning-tips-iii.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/2707665352417700496'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/2707665352417700496'/><link rel='alternate' type='text/html' href='http://ravifirst.blogspot.com/2009/07/sql-server-performance-tuning-tips-iii.html' title='SQL Server Performance Tuning Tips - III'/><author><name>Ravi's</name><uri>http://www.blogger.com/profile/14359502815484562942</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_WxhoysBC8gY/StgCRfR-X5I/AAAAAAAAAJQ/l5Cd32MA2kk/S220/Rlogo.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7848011355253090856.post-4996586673780679879</id><published>2009-07-22T00:25:00.002+05:30</published><updated>2009-07-22T00:29:32.565+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='t-sql'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL FAQs'/><category scheme='http://www.blogger.com/atom/ns#' term='sql server'/><category scheme='http://www.blogger.com/atom/ns#' term='sql server DBA'/><category scheme='http://www.blogger.com/atom/ns#' term='tips'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL SERVER PERFORMANCE TUNING TIPS'/><category scheme='http://www.blogger.com/atom/ns#' term='sql interview'/><title type='text'>SQL Server Performance Tuning Tips - II</title><content type='html'>&lt;strong&gt;Continued from SQL server Performance Tunung Tips - I&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;16. When you have a choice of using a constraint or a trigger to perform the same task, always choose the constraint. The same goes if you have the option of using either a constraint or a rule, or a constraint or a default. Constraints require less overhead than triggers, rules, and defaults. [6.5, 7.0, 2000] &lt;br /&gt; &lt;br /&gt;17. Don't implement redundant integrity features in your database. For example, if you are using primary key and foreign key constraints to enforce referential integrity, don't add unnecessary overhead by also adding a trigger that performs the same function. The same goes for using both constraints and defaults or constraints and rules that perform redundant work. While this may sound obvious, it is not uncommon to find in SQL Server databases. [6.5, 7.0, 2000] &lt;br /&gt;&lt;br /&gt;18. If you have the choice of using a join or a subquery to perform the same task, generally the join is faster. But this is not always the case, you can may want to test the query using both methods to determine which is faster for your particular application. [6.5, 7.0, 2000] &lt;br /&gt;&lt;br /&gt;19. If your application needs to insert a large binary value into an image data column, perform this task using a stored procedure, not using an INSERT statement embedded in your application. The reason for this is because the application must first convert the binary value into a character string (which doubles its size, thus increasing network traffic and taking more time) before it can be sent to the server. And when the server receives the character string, it then has to convert it back to the binary format (taking even more time). Using a stored procedure avoids all this. [6.5, 7.0, 2000] &lt;br /&gt;&lt;br /&gt;20. If you need to create a primary key (using a value meaningless to the record, other than providing a unique value for a record), many developers will use either a identity field (with an integer data type) or a uniqueidentifier data type. If your application is not sensitive to either option, then you will most likely want to choose the identity field over the uniqueidentifier field. The reason for this is that the identity field (using the integer data type) only takes up 4 bytes, while the uniqueidentifier field takes 16 bytes. Using the identifier field will create a smaller and faster index. [7.0, 2000]&lt;br /&gt;&lt;br /&gt;21. When you have a choice of using the IN or the EXISTS clause in your Transact-SQL, you will generally want to use the EXISTS clause, as it is more efficient and performs faster. [6.5, 7.0, 2000] &lt;br /&gt; &lt;br /&gt;22. When you have a choice of using the IN or the BETWEEN clauses in your Transact-SQL, you will generally want to use the BETWEEN clause, as it is much more efficient. For example: &lt;br /&gt;SELECT customer_number, customer_name&lt;br /&gt;FROM customer&lt;br /&gt;WHERE customer_number in (1000, 1001, 1002, 1003, 1004) &lt;br /&gt;is much less efficient than this: &lt;br /&gt;SELECT customer_number, customer_name&lt;br /&gt;FROM customer&lt;br /&gt;WHERE customer_number BETWEEN 1000 and 1004 &lt;br /&gt;Assuming there is a useful index on customer_number, the Query Optimizer can locate a range of numbers much faster (using BETWEEN) than it can find a series of numbers using the IN clause (which is really just another form of the OR clause). [6.5, 7.0, 2000] &lt;br /&gt;&lt;br /&gt;23. If possible, try to avoid using the SUBSTRING function in your WHERE clauses. Depending on how it is constructed, using the SUBSTRING function can force a table scan instead of allowing the optimizer to use an index (assuming there is one). If the substring you are searching for does not include the first character of the column you are searching for, then a table scan is performed. [6.5, 7.0, 2000]  &lt;br /&gt;&lt;br /&gt;24. Where possible, avoid string concatenation, as it is not a fast process. [6.5, 7.0, 2000] &lt;br /&gt;&lt;br /&gt;25. If possible, try to avoid using data conversion functions in the WHERE clause. If you do, you may be forcing the optimizer to perform a table scan rather than using an applicable index. [6.5, 7.0, 2000]  &lt;br /&gt;&lt;br /&gt;26. If your application requires you to create temporary tables for use on a global or per connection use, consider the possibility of creating indexes for these temporary tables. While most temporary tables probably won't need, or even can use an index, some larger temporary tables can benefit from them. A properly designed index on a temporary table can be as great a benefit as a properly designed index on a standard database table. [6.5, 7.0, 2000]  &lt;br /&gt;&lt;br /&gt;27. Generally, you only want to encapsulate your Transact-SQL code in a transaction if it is going to modify the database. Transactions help to ensure database consistency and are an important tool in the developer's toolbox. But if you put non-database modifying Transact-SQL in a transaction, you are producing unnecessary overhead for your application and SQL Server. For example, Transact-SQL used for creating reports doesn't usually need the benefits (and the overhead) associated with transactions. [6.5, 7.0, 2000] &lt;br /&gt;&lt;br /&gt;28. Both the MIN() and MAX() functions can take advantage of indexes on columns. So if you perform these functions often, you might want to add an index to the relevant columns, assuming they don't already exit. [6.5, 7.0, 2000] &lt;br /&gt;&lt;br /&gt;29. Generally, avoid using optimizer hints in your queries. This is because it is generally very hard to outguess the Query Optimizer. Optimizer hints are special keywords that you include with your query to force how the Query Optimizer runs. If you decide to include a hint in a query, this forces the Query Optimizer to become static, preventing the Query Optimizer from dynamically adapting to the current environment for the given query. More often than not, this hurts, not helps performance.&lt;br /&gt;If you think that a hint might be necessary to optimize your query, be sure you first do all of the following first:&lt;br /&gt;• Update the statistics on the relevant tables. &lt;br /&gt;• If the problem query is inside a stored procedure, recompile it. &lt;br /&gt;• Review the search arguments to see if they are sargable, and if not, try to rewrite them so that they are sargable. &lt;br /&gt;• Review the current indexes, and make changes if necessary. &lt;br /&gt;If you have done all of the above, and the query is not running as you expect, then you may want to consider using an appropriate optimizer hint. &lt;br /&gt;If you haven't heeded my advice and have decided to use some hints, keep in mind that as your data changes, and as the Query Optimizer changes (through service packs and new releases of SQL Server), your hard-coded hints may no longer offer the benefits they once did. So if you use hints, you need to periodically review them to see if they are still performing as expected. [6.5, 7.0, 2000] &lt;br /&gt;&lt;br /&gt;30. If you want to boost the performance of a query that includes an AND operator in the WHERE clause, consider the following:&lt;br /&gt;• Of the search criterions in the WHERE clause, at least one of them should be based on a highly selective column that has an index. &lt;br /&gt;• If at least one of the search criterions in the WHERE clause is not highly selective, consider adding indexes to all of the columns referenced in the WHERE clause. [7.0, 2000]&lt;br /&gt; &lt;br /&gt;31. While views are often convenient to use, especially for restricting users from seeing data they should not see, they aren't good for performance. So if database performance is your goal, avoid using views (SQL Server 2000 Indexed Views are another story).&lt;br /&gt;Here's why. When the Query Optimizer gets a request to run a view, it runs it just as if you had run the view's SELECT statement from the Query Analyzer. If fact, a view runs slightly slower than the same SELECT statement run from the Query Analyzer--but you probably would not notice the difference--because of the additional overhead caused by the view. Unlike stored procedures, views offer no pre-optimization.&lt;br /&gt;Instead of embedding SELECT statements in a view, put them in a stored procedure instead for optimum performance. Not only do you get the added performance boost, you can also use the stored procedure to restrict user access to table columns they should not see. [6.5, 7.0, 2000] &lt;br /&gt;&lt;br /&gt;32. Try to avoid nesting views (referring to a view from within a view). While this is not prohibited, it makes it more difficult to identify the source of any performance problems. A better idea is to create separate views instead of nesting them. [6.5, 7.0, 2000] &lt;br /&gt;&lt;br /&gt;33. Don't use DISTINCT or ORDER BY in your SELECT statements unless you really need them. Both options can add a lot of additional overhead to your query, and they aren't always needed for your application. [6.5, 7.0, 2000]&lt;br /&gt;&lt;br /&gt;34. If your SELECT statement includes an IN option along with a list of values to be tested in the query, order the list of values so that the most frequently found values are placed at the first of the list, and the less frequently found values are placed at the end of the list. This can speed performance because the IN option returns true as soon as any of the values in the list produce a match. The sooner the match is made, the faster the query completes. [6.5, 7.0, 2000] &lt;br /&gt;&lt;br /&gt;35. If you need to use the SELECT INTO option, keep in mind that it can lock system tables, preventing others users from accessing the data they need. If you do need to use SELECT INTO, try to schedule it when your SQL Server is less busy, and try to keep the amount of data inserted to a minimum. [6.5, 7.0, 2000]&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7848011355253090856-4996586673780679879?l=ravifirst.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ravifirst.blogspot.com/feeds/4996586673780679879/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ravifirst.blogspot.com/2009/07/sql-server-performance-tuning-tips-ii.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/4996586673780679879'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/4996586673780679879'/><link rel='alternate' type='text/html' href='http://ravifirst.blogspot.com/2009/07/sql-server-performance-tuning-tips-ii.html' title='SQL Server Performance Tuning Tips - II'/><author><name>Ravi's</name><uri>http://www.blogger.com/profile/14359502815484562942</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_WxhoysBC8gY/StgCRfR-X5I/AAAAAAAAAJQ/l5Cd32MA2kk/S220/Rlogo.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7848011355253090856.post-3649973927379047279</id><published>2009-07-22T00:18:00.001+05:30</published><updated>2009-07-22T00:20:26.271+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='sql Query'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL FAQs'/><category scheme='http://www.blogger.com/atom/ns#' term='sql server'/><category scheme='http://www.blogger.com/atom/ns#' term='sql server DBA'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL SERVER PERFORMANCE TUNING TIPS'/><category scheme='http://www.blogger.com/atom/ns#' term='sql interview'/><category scheme='http://www.blogger.com/atom/ns#' term='Derived Tables in sql server'/><title type='text'>Derived Tables in SQL Server</title><content type='html'>&lt;strong&gt;Derived Tables&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Use 'Derived tables' wherever possible, as they perform better. Consider the following query to find the second highest salary from the Employees table:&lt;br /&gt;&lt;br /&gt;SELECT MIN(Salary) &lt;br /&gt;FROM Employees &lt;br /&gt;WHERE EmpID IN&lt;br /&gt;(&lt;br /&gt;SELECT TOP 2 EmpID &lt;br /&gt;FROM Employees &lt;br /&gt;ORDER BY Salary Desc&lt;br /&gt;) &lt;br /&gt;&lt;br /&gt;The same query can be re-written using a derived table, as shown below, and it performs twice as fast as the above query:&lt;br /&gt;&lt;br /&gt;SELECT MIN(Salary) &lt;br /&gt;FROM &lt;br /&gt;(&lt;br /&gt;SELECT TOP 2 Salary &lt;br /&gt;FROM Employees &lt;br /&gt;ORDER BY Salary DESC&lt;br /&gt;) AS A &lt;br /&gt;&lt;br /&gt;This is just an example, and your results might differ in different scenarios depending on the database design, indexes, volume of data, etc. So, test all the possible ways a query could be written and go with the most efficient one.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Benefits of Derived Tables&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;The biggest benefit of using derived tables over using temporary tables is that they require fewer steps, and everything happens in memory instead of a combination of memory and disk. The fewer the steps involved, along with less I/O, the faster the performance.&lt;br /&gt;Here are the steps when you use a temporary table:&lt;br /&gt;1) Lock tempdb database&lt;br /&gt;2) CREATE the temporary table (write activity)&lt;br /&gt;3) SELECT data &amp; INSERT data (read &amp; write activity)&lt;br /&gt;4) SELECT data from temporary table and permanent table(s) (read activity)&lt;br /&gt;5) DROP TABLE (write activity)&lt;br /&gt;4) Release the locks&lt;br /&gt;&lt;br /&gt;Compare the above to the number of steps it takes for a derived table:&lt;br /&gt;1) CREATE locks, unless isolation level of "read uncommitted" is used&lt;br /&gt;2) SELECT data (read activity)&lt;br /&gt;3) Release the locks&lt;br /&gt;&lt;br /&gt;Using derived tables instead of temporary tables reduces disk I/O and can boost performance. Now let's see how.&lt;br /&gt;&lt;br /&gt;Q, How to Run a Query on a Remote SQL Server&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;A, Use the OpenRowSet Function to Run a Query on a Remote SQL Server&lt;br /&gt;You can use the OPENROWSET( ) function to run a query on a remote SQL server by using the following syntax: &lt;br /&gt;&lt;br /&gt;SELECT * FROM OPENROWSET('SQLOLEDB', 'remote_server_name'; 'sa'; 'password','SQL statement')&lt;br /&gt;&lt;br /&gt;Here replace 'remote_server_name' with the name of the remote server on which you want to run the query. If necessary, replace 'sa' and 'password' with the name and password of a SQL login ID you want to use to log in to the remote server. Finally, replace 'SQL statement' with the SQL statement you want to run on the remote server&lt;br /&gt;&lt;br /&gt;Q, Why does my inline or embedded SQL run faster than my stored procedures?&lt;br /&gt;&lt;br /&gt;A, Recompilations might be the source of the slower stored procedure speed. To find out for sure, you need to do some performance investigation, such as looking at Showplans for each type of query versus calling the stored procedures and comparing query plan cache hits to cache misses. You can also try coding the object owner for referenced tables, views, and procedures inside your stored procedures, as the following example shows:&lt;br /&gt;SELECT * FROM dbo.mytable&lt;br /&gt;This technique helps you reuse plans and prevent cache misses.&lt;br /&gt;&lt;br /&gt;Q, How Can I Generate a Series of Random Integers With T-SQL? &lt;br /&gt;&lt;br /&gt;Here is a stored procedure that will generate a series of random numbers and return them in a result set.&lt;br /&gt;This SQL Server stored procedure returns a result set that containing a series of random integers.&lt;br /&gt;&lt;br /&gt;Inputs are:&lt;br /&gt;@begin_no - lowest number to be generated,&lt;br /&gt;@end_no - highest number to be generated&lt;br /&gt;&lt;br /&gt;Calling syntax: &lt;br /&gt;Exec sp_GenerateRandomNumberResultSet Begin, End&lt;br /&gt;&lt;br /&gt;CREATE procedure sp_GenerateRandomNumberResultSet&lt;br /&gt;@begin_no int=1, @end_no int=100 As&lt;br /&gt;&lt;br /&gt;Set nocount on&lt;br /&gt;&lt;br /&gt;Declare @rn int, @rec int, @cnt int&lt;br /&gt;Set @cnt=@end_no-@begin_no+1&lt;br /&gt;&lt;br /&gt;Create Table #t (RecNo int identity(1,1), RandNo int null)&lt;br /&gt;&lt;br /&gt;Set @rec=1&lt;br /&gt;While @rec&lt;=@cnt&lt;br /&gt;Begin&lt;br /&gt;Insert Into #t (RandNo) Values (null)&lt;br /&gt;Set @rec=@rec+1&lt;br /&gt;End&lt;br /&gt;&lt;br /&gt;Set @rec=1&lt;br /&gt;While @rec&lt;=@cnt&lt;br /&gt;Begin&lt;br /&gt;Set @rn=rand()*@cnt+@begin_no&lt;br /&gt;If @begin_no&lt;0 Set @rn=@rn-1&lt;br /&gt;Update #t Set RandNo=@rn&lt;br /&gt;Where RecNo=@rec&lt;br /&gt;And @rn Not In &lt;br /&gt;(Select RandNo&lt;br /&gt;From #t Where RandNo Is Not Null)&lt;br /&gt;If @@rowcount&gt;0 Set @rec=@rec+1&lt;br /&gt;End&lt;br /&gt;&lt;br /&gt;Set nocount off&lt;br /&gt;&lt;br /&gt;Select RandNo From #t&lt;br /&gt;&lt;br /&gt;Drop Table #t&lt;br /&gt;Go&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7848011355253090856-3649973927379047279?l=ravifirst.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ravifirst.blogspot.com/feeds/3649973927379047279/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ravifirst.blogspot.com/2009/07/derived-tables-in-sql-server.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/3649973927379047279'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/3649973927379047279'/><link rel='alternate' type='text/html' href='http://ravifirst.blogspot.com/2009/07/derived-tables-in-sql-server.html' title='Derived Tables in SQL Server'/><author><name>Ravi's</name><uri>http://www.blogger.com/profile/14359502815484562942</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_WxhoysBC8gY/StgCRfR-X5I/AAAAAAAAAJQ/l5Cd32MA2kk/S220/Rlogo.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7848011355253090856.post-3590637478072641824</id><published>2009-07-22T00:17:00.000+05:30</published><updated>2009-07-22T00:18:54.581+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='SQL FAQs'/><category scheme='http://www.blogger.com/atom/ns#' term='sql server'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL Server 7.0 versions'/><category scheme='http://www.blogger.com/atom/ns#' term='sql server DBA'/><category scheme='http://www.blogger.com/atom/ns#' term='tips'/><category scheme='http://www.blogger.com/atom/ns#' term='sql interview'/><title type='text'>SQL Server 7.0 versions</title><content type='html'>&lt;strong&gt;Understanding the different SQL Server 7.0 versions&lt;/strong&gt; &lt;br /&gt;&lt;br /&gt;To date, Microsoft has released six different versions of SQL Server 7.0. These versions include the Desktop, Standard, and Enterprise Editions, as well as the Developer, Microsoft Developer (MSDE), and Small Business Server Editions. While all of these versions are SQL Server 7.0, there are some key differences. First of all, you can run the Desktop Edition on Windows NT Workstation 4.0, Windows NT Server 4.0, and Windows 9x. The Desktop Edition doesn't support the Microsoft Search Service, OLAP Services, parallel queries, or transaction replication--and it can't be bought on its own. Instead, you must buy either the Standard or the Enterprise Edition to get the Desktop Edition. You can run the Standard Edition of SQL Server only on Windows NT Server 4.0 (or later). This version does support such features as the Microsoft Search Service, OLAP Services, parallel queries, and transactional replication. It also supports up to 4 CPUs and 2 GB of RAM. In contrast, the Enterprise Edition runs only on Windows NT Server 4.0 Enterprise Edition and supports Microsoft Cluster Server. It also supports all of the features supported in the Standard Edition--plus up to 32 CPUs and more than 2 GB of RAM. The Developer Edition of SQL Server is included with Visual Studio for developer use. This version supports a limited number of connections but does include debugging tools. The Microsoft Developer Edition (MSDE) of SQL Server is simply a run-time engine that's included as part of Microsoft Office 2000. Although the MSDE version includes some of the management utilities, it doesn't include all of them. The MSDE was designed for you to distribute as part of an application, not as a stand-alone product. Finally, the Small Business Server Edition is part of Microsoft's Small Business Server. This version of SQL Server is essentially the same as the Standard Edition but comes hard-coded with a limit of 100 users and a maximum database size of 10 GB.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7848011355253090856-3590637478072641824?l=ravifirst.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ravifirst.blogspot.com/feeds/3590637478072641824/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ravifirst.blogspot.com/2009/07/sql-server-70-versions.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/3590637478072641824'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/3590637478072641824'/><link rel='alternate' type='text/html' href='http://ravifirst.blogspot.com/2009/07/sql-server-70-versions.html' title='SQL Server 7.0 versions'/><author><name>Ravi's</name><uri>http://www.blogger.com/profile/14359502815484562942</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_WxhoysBC8gY/StgCRfR-X5I/AAAAAAAAAJQ/l5Cd32MA2kk/S220/Rlogo.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7848011355253090856.post-4342620141744466182</id><published>2009-07-22T00:15:00.001+05:30</published><updated>2009-07-22T00:17:22.025+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='SQL FAQs'/><category scheme='http://www.blogger.com/atom/ns#' term='sql server'/><category scheme='http://www.blogger.com/atom/ns#' term='Except operator'/><category scheme='http://www.blogger.com/atom/ns#' term='sql server DBA'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL SERVER PERFORMANCE TUNING TIPS'/><category scheme='http://www.blogger.com/atom/ns#' term='Getting the last identity value used'/><category scheme='http://www.blogger.com/atom/ns#' term='sql interview'/><title type='text'>Except operator in SQL Server</title><content type='html'>&lt;strong&gt;Getting the last identity value used&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Many times, you'll want to know the last identity (key) value that was used in an insert. The biggest reason for this is so that the same value can be reused when inserting a foreign key. This is done differently between SQL Server and DB2. In DB2, the identity values can be picked up by the application and reused using and Identity_Val_function(), which returns the most recently assigned value for an identity column. In SQL Server, the last identity value used in an insert can be retrieved with the @@identity function. &lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Except Operator&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;To find rows in one set that do not exist in another set, use the except operator (as defined in SQL-92 and SQL-99). For example, here's how you find column1 from Table1 that does not exist in column2 of Table2: &lt;br /&gt;Select column1 from Table1 Except Select column2 from Table2; The except operator will remove duplicates, and a single null value will be returned in the case of multiple null values. To return duplicates, use except all. Keep in mind, of course, that other proprietary implementations (such as Minus in Oracle) exist.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7848011355253090856-4342620141744466182?l=ravifirst.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ravifirst.blogspot.com/feeds/4342620141744466182/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ravifirst.blogspot.com/2009/07/except-operator-in-sql-server.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/4342620141744466182'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/4342620141744466182'/><link rel='alternate' type='text/html' href='http://ravifirst.blogspot.com/2009/07/except-operator-in-sql-server.html' title='Except operator in SQL Server'/><author><name>Ravi's</name><uri>http://www.blogger.com/profile/14359502815484562942</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_WxhoysBC8gY/StgCRfR-X5I/AAAAAAAAAJQ/l5Cd32MA2kk/S220/Rlogo.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7848011355253090856.post-6273160615060110111</id><published>2009-07-22T00:13:00.001+05:30</published><updated>2009-07-22T00:15:24.897+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='SQL FAQs'/><category scheme='http://www.blogger.com/atom/ns#' term='sql server 2005'/><category scheme='http://www.blogger.com/atom/ns#' term='sql server'/><category scheme='http://www.blogger.com/atom/ns#' term='Who Is Blocking SQL Server'/><category scheme='http://www.blogger.com/atom/ns#' term='sql server DBA'/><category scheme='http://www.blogger.com/atom/ns#' term='tips'/><category scheme='http://www.blogger.com/atom/ns#' term='sql interview'/><title type='text'>Who Is Blocking Your SQL Server</title><content type='html'>&lt;strong&gt;See Who Is Blocking Your SQL Server&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;If you have ever monitored any blocking problems in SQL Server, you know that sp_who only shows you the spid (SQL Server's internal Process ID) that is causing the blocking for each spid that is blocked. Often a blocked spid is shown as causing blocking for another spid. To see the spid (or spids) that started the whole mess off, execute the following SQL: &lt;br /&gt;&lt;br /&gt;SELECT p.spid&lt;br /&gt;,convert(char(12), d.name) db_name&lt;br /&gt;, program_name&lt;br /&gt;, convert(char(12), l.name) login_name&lt;br /&gt;, convert(char(12), hostname) hostname&lt;br /&gt;, cmd&lt;br /&gt;, p.status&lt;br /&gt;, p.blocked&lt;br /&gt;, login_time&lt;br /&gt;, last_batch&lt;br /&gt;, p.spid&lt;br /&gt;FROM      master..sysprocesses p&lt;br /&gt;JOIN      master..sysdatabases d ON p.dbid =  d.dbid&lt;br /&gt;JOIN      master..syslogins l ON p.suid = l.suid&lt;br /&gt;WHERE     p.blocked = 0&lt;br /&gt;AND       EXISTS (  SELECT 1&lt;br /&gt;          FROM      master..sysprocesses p2&lt;br /&gt;          WHERE     p2.blocked = p.spid )&lt;br /&gt;&lt;br /&gt;We built this into our own version of sp_who, called sp_hywho. See the listing below. Code for sp_hywho:&lt;br /&gt;&lt;br /&gt;if exists (select * from sysobjects &lt;br /&gt;   where id = object_id('dbo.sp_hywho') &lt;br /&gt;   and sysstat &amp; 0xf = 4)&lt;br /&gt;   drop procedure dbo.sp_hywho&lt;br /&gt;GO&lt;br /&gt;&lt;br /&gt;Create Procedure sp_hywho&lt;br /&gt;(    @vcDBName sysname = NULL )&lt;br /&gt;AS&lt;br /&gt;&lt;br /&gt;SET NOCOUNT ON&lt;br /&gt;&lt;br /&gt;IF EXISTS ( SELECT 1&lt;br /&gt;   FROM   master..sysprocesses p&lt;br /&gt;   WHERE   p.blocked = 0 &lt;br /&gt;   AND   EXISTS ( SELECT 1&lt;br /&gt;      FROM   master..sysprocesses p2&lt;br /&gt;      WHERE   p2.blocked = p.spid ) )&lt;br /&gt;BEGIN&lt;br /&gt;   PRINT "Blocking caused by:"&lt;br /&gt;   PRINT ""&lt;br /&gt;   SELECT   p.spid&lt;br /&gt;   ,convert(char(12), d.name) db_name&lt;br /&gt;   , program_name&lt;br /&gt;   , convert(char(12), l.name) login_name&lt;br /&gt;   , convert(char(12), hostname) hostname&lt;br /&gt;   , cmd           &lt;br /&gt;   , p.status        &lt;br /&gt;   , p.blocked&lt;br /&gt;   , login_time                  &lt;br /&gt;   , last_batch &lt;br /&gt;   , p.spid&lt;br /&gt;   FROM   master..sysprocesses p&lt;br /&gt;   JOIN   master..sysdatabases d ON p.dbid =  d.dbid &lt;br /&gt;   JOIN   master..syslogins l ON p.suid = l.suid &lt;br /&gt;   WHERE   p.blocked = 0 &lt;br /&gt;   AND   EXISTS ( SELECT 1&lt;br /&gt;      FROM   master..sysprocesses p2&lt;br /&gt;      WHERE   p2.blocked = p.spid ) &lt;br /&gt;   AND   (p.dbid = DB_ID( @vcDBName ) OR @vcDBName IS NULL)&lt;br /&gt;   ORDER BY 2,IsNull(Ltrim(program_name),"ZZZZZZZZZ"),4,5&lt;br /&gt;   PRINT ""&lt;br /&gt;END&lt;br /&gt;&lt;br /&gt;SELECT   p.spid&lt;br /&gt;,convert(char(12), d.name) db_name&lt;br /&gt;, program_name&lt;br /&gt;, convert(char(12), l.name) login_name&lt;br /&gt;, convert(char(12), hostname) hostname&lt;br /&gt;, cmd           &lt;br /&gt;, p.status        &lt;br /&gt;, p.blocked&lt;br /&gt;, login_time                  &lt;br /&gt;, last_batch &lt;br /&gt;, p.spid&lt;br /&gt;FROM   master..sysprocesses p&lt;br /&gt;JOIN   master..sysdatabases d ON p.dbid =  d.dbid &lt;br /&gt;JOIN   master..syslogins l ON p.suid = l.suid &lt;br /&gt;WHERE   (p.dbid = DB_ID( @vcDBName ) OR @vcDBName IS NULL)&lt;br /&gt;ORDER BY 2,IsNull(Ltrim(program_name),"ZZZZZZZZZ"),4,5&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;SET NOCOUNT OFF&lt;br /&gt;&lt;br /&gt;GO&lt;br /&gt;&lt;br /&gt;if exists (select * from sysobjects &lt;br /&gt;   where id = object_id('dbo.sp_hywho') &lt;br /&gt;   and sysstat &amp; 0xf = 4)&lt;br /&gt;   GRANT EXEC ON dbo.sp_hywho TO PUBLIC&lt;br /&gt;GO&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7848011355253090856-6273160615060110111?l=ravifirst.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ravifirst.blogspot.com/feeds/6273160615060110111/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ravifirst.blogspot.com/2009/07/who-is-blocking-your-sql-server.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/6273160615060110111'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/6273160615060110111'/><link rel='alternate' type='text/html' href='http://ravifirst.blogspot.com/2009/07/who-is-blocking-your-sql-server.html' title='Who Is Blocking Your SQL Server'/><author><name>Ravi's</name><uri>http://www.blogger.com/profile/14359502815484562942</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_WxhoysBC8gY/StgCRfR-X5I/AAAAAAAAAJQ/l5Cd32MA2kk/S220/Rlogo.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7848011355253090856.post-254865252457805712</id><published>2009-07-22T00:10:00.002+05:30</published><updated>2009-07-22T00:13:41.715+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='SQL FAQs'/><category scheme='http://www.blogger.com/atom/ns#' term='sql server'/><category scheme='http://www.blogger.com/atom/ns#' term='openrowset in sql server'/><category scheme='http://www.blogger.com/atom/ns#' term='sql server DBA'/><category scheme='http://www.blogger.com/atom/ns#' term='Joining Queries from Oracle and SQL Server Databases'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL SERVER PERFORMANCE TUNING TIPS'/><category scheme='http://www.blogger.com/atom/ns#' term='sql interview'/><title type='text'>Joining Queries from Oracle and SQL Server Databases</title><content type='html'>Question: I need a query that retrieves info from an Oracle table and a query that retrieves info from a SQL Server table. The info has to be joined together according to Record ID numbers. I have very limited access to the Oracle database but full control of the SQL Server database.How do I join two different queries from two different databases? &lt;br /&gt;&lt;br /&gt;Answer: To query to different data sources, you can make the Oracle server a linked server to the SQL Server server. A linked server can be any OLE DB data source and SQL Server currently supports the OLE DB data provider for Oracle. You can add a linked server by calling sp_AddLinkedServer and query information about linked servers with sp_LinkedServers. &lt;br /&gt;&lt;br /&gt;An easier way to add a linked server is to use Enterprise Manager. Add the server through the Linked Servers icon in the Security node. Once a server is linked, you can query it using a distributed query (you have to specify the full name). &lt;br /&gt;&lt;br /&gt;Here's an example of a distributed query (from the SQL Server Books Online) that queries the Employees table in SQL Server and the Orders table from Oracle: &lt;br /&gt;&lt;br /&gt;SELECT emp.EmloyeeID, ord.OrderID, ord.Discount&lt;br /&gt;FROM SQLServer1.Northwind.dbo.Employees AS emp,&lt;br /&gt;OracleSvr.Catalog1.SchemaX.Orders AS ord&lt;br /&gt;WHERE ord.EmployeeID = emp.EmployeeID&lt;br /&gt;AND ord.Discount &gt; 0&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Use the OpenRowSet Function to Run a Query on a Remote SQL Server&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;You can use the OPENROWSET( ) function to run a query on a remote SQL server by using the following syntax: &lt;br /&gt;&lt;br /&gt;SELECT *FROM OPENROWSET('SQLOLEDB', 'remote_server_name'; 'sa'; 'password','SQL statement')&lt;br /&gt;Here replace 'remote_server_name' with the name of the remote server on which you want to run the query. If necessary, replace 'sa' and 'password' with the name and password of a SQL login ID you want to use to log in to the remote server. Finally, replace 'SQL statement' with the SQL statement you want to run on the remote server&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Check Whether a Global Temporary Exists in a SQL Database&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Checking whether a table exists in a Microsoft SQL Server database is easy. You can use this query: &lt;br /&gt;&lt;br /&gt;SELECT 'x'&lt;br /&gt;FROM sysobjects&lt;br /&gt;WHERE type = 'U' and NAME = 'mytable'&lt;br /&gt;But this query will not work while searching for global temporary tables. Global temporary tables are stored in tempdb. &lt;br /&gt;Use this syntax for the search: &lt;br /&gt;&lt;br /&gt;DECLARE @temp_table VARCHAR(100)&lt;br /&gt;SET @temp_table = '##my_temp_table'&lt;br /&gt;IF NOT EXISTS (SELECT 'x'&lt;br /&gt;          FROM tempdb..sysobjects&lt;br /&gt;          WHERE type = 'U' and NAME = @temp_table)&lt;br /&gt;    PRINT 'temp table ' + @temp_table + ' does not exist'&lt;br /&gt;&lt;br /&gt;ELSE&lt;br /&gt;    PRINT 'temp table ' + @temp_table + ' exists.'&lt;br /&gt;Note: You cannot search for local temporary tables (# prefix tables) in this way. This is because SQL Server appends a unique number to the name you supply. For example, if you specified "#temp," the name in sysobjects would be something like "#temp____1234."&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7848011355253090856-254865252457805712?l=ravifirst.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ravifirst.blogspot.com/feeds/254865252457805712/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ravifirst.blogspot.com/2009/07/joining-queries-from-oracle-and-sql.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/254865252457805712'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/254865252457805712'/><link rel='alternate' type='text/html' href='http://ravifirst.blogspot.com/2009/07/joining-queries-from-oracle-and-sql.html' title='Joining Queries from Oracle and SQL Server Databases'/><author><name>Ravi's</name><uri>http://www.blogger.com/profile/14359502815484562942</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_WxhoysBC8gY/StgCRfR-X5I/AAAAAAAAAJQ/l5Cd32MA2kk/S220/Rlogo.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7848011355253090856.post-214889472449007697</id><published>2009-07-22T00:09:00.004+05:30</published><updated>2009-07-22T00:25:10.802+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='sql Query'/><category scheme='http://www.blogger.com/atom/ns#' term='t-sql'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL FAQs'/><category scheme='http://www.blogger.com/atom/ns#' term='sql server'/><category scheme='http://www.blogger.com/atom/ns#' term='sql server DBA'/><category scheme='http://www.blogger.com/atom/ns#' term='performance tuning'/><category scheme='http://www.blogger.com/atom/ns#' term='tips'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL SERVER PERFORMANCE TUNING TIPS'/><title type='text'>SQL Server Performance Tuning Tips - I</title><content type='html'>&lt;strong&gt;Transact-SQL SQL Server Performance Tuning Tips&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;1. Slow queries can be caused by a wide variety of reasons. Some include:&lt;br /&gt;• Lack of useful indexes &lt;br /&gt;• Lack of useful I/O striping &lt;br /&gt;• Out-of-date statistics or lack of useful statistics &lt;br /&gt;• Lack of physical memory &lt;br /&gt;• Slow network connection &lt;br /&gt;• Transact-SQL queries transferring large amounts of data from the server to the client &lt;br /&gt;• Blocked locks or deadlocks &lt;br /&gt;• Performing OLTP and OLAP queries on the same physical server &lt;br /&gt;• Poorly designed query &lt;br /&gt;Any one or more of the above items can cause slow query performance. Each of these problem areas, and more, are discussed in detail on this page and other pages on this website.&lt;br /&gt;&lt;br /&gt;2. This tip may sound obvious to most of you, but I have seen professional developers, in two major SQL Server-based applications used worldwide, not follow it. And that is to always include a WHERE clause in your SELECT statement to narrow the number of rows returned. If you don't use a WHERE clause, then SQL Server will perform a table scan of your table and return all of the rows. In some case you may want to return all rows, and not using a WHERE clause is appropriate in this case. But if you don't need all the rows returned, use a WHERE clause to limit the number of rows returned.&lt;br /&gt;&lt;br /&gt;3. Don't be afraid to make liberal use of in-line and block comments in your Transact-SQL code, they will not affect the performance of your application. &lt;br /&gt;&lt;br /&gt;4. If possible, avoid using SQL Server cursors. They generally use a lot of SQL Server resources and reduce the performance and scalability of your applications. If you need to perform row-by-row operations, try to find another method to perform the task. Some options are to perform the task at the client, use tempdb tables, use derived tables, use a correlated sub-query, or use the CASE statement. More often than not, there are non-cursor techniques that can be used to perform the same tasks as a SQL Server cursor.&lt;br /&gt;&lt;br /&gt;5. To help identify long running queries, use the SQL Server Profiler Create Trace Wizard to run the "TSQL By Duration" trace. You can specify the length of the long running queries you are trying to identify (such as over 1000 milliseconds), and then have these recorded in a log for you to investigate later.&lt;br /&gt;&lt;br /&gt;6. When using the UNION statement, keep in mind that by default it performs the equivalent of a SELECT DISTINCT on the results set. If you know that there will not be any duplication of rows created as a result of using the UNION statement, then use the UNION ALL statement instead. This variation of the statement does not look for duplicate rows and runs must faster than the UNION, which does look for duplicate rows, whether or not there are any.&lt;br /&gt;&lt;br /&gt;7. Carefully evaluate whether your query needs the DISTINCT clause or not. The DISTINCT clause slows down virtually every query it is in. Some developers automatically add this clause to every one of their SELECT statements, even when it is not necessary. This is a bad habit that should be stopped. In addition, keep in mind that in some cases, duplicate results in a query are not a problem. If this is the case, then don't use a DISTINCT clause.&lt;br /&gt;&lt;br /&gt;8. In your queries, don't return column data you don't need. For example, you should not use SELECT * to return all the columns from a table if you don't need all the data from each column. [6.5, 7.0, 2000]&lt;br /&gt;&lt;br /&gt;9. In your queries, don't return rows you don't need. Use the WHERE clause to return only those rows you need right now. [6.5, 7.0, 2000]&lt;br /&gt;&lt;br /&gt;10. If your users perform many ad hoc queries on your SQL Server data, and you find that many of these "poorly-written" queries take up an excessive amount of SQL Server resources, consider using the "query governor cost limit" configuration option to limit how long a query can run. You can specify the maximum amount of "seconds" a query will run, and whenever the query optimizer determines that a particular query will exceed the maximum limit, the query will be aborted before it even begins. Although the value you set for this setting is stated as "seconds", it does not mean seconds like we think of seconds. Instead, it relates to the actual estimated cost of the query as calculated by the query optimizer. You may have to experiment with this value until you find one that meets your needs. &lt;br /&gt;There are two ways to set this option. First, you can change it at the server level (all queries running on the server are affected by it) using sp_configure "query governor cost limit", or you can set it at the connection level (only this connection is affected) by using the SET QUERY_GOVERNOR_COST_LIMIT command. [7.0, 2000] &lt;br /&gt; &lt;br /&gt;11. If your application allows users to run queries, but you are unable in your application to easily prevent users from returning hundreds, even thousands of unnecessary rows of data they don't need, consider using the TOP operator within the SELECT statement. This way, you can limit how may rows are returned, even if the user doesn't enter any criteria to help reduce the number or rows returned to the client. For example, the statement: &lt;br /&gt;SELECT TOP 100 fname, lname FROM customers&lt;br /&gt;WHERE state = 'mo' &lt;br /&gt;limits the results to the first 100 rows returned, even if 10,000 rows actually meet the criteria of the WHERE clause. When the specified number of rows is reached, all processing on the query stops, potentially saving SQL Server overhead, and boosting performance. &lt;br /&gt;The TOP operator works by specifying a specific number of rows, like the example above, or by specifying a percentage value, like this: &lt;br /&gt;SELECT TOP 10 PERCENT fname, lname FROM customers&lt;br /&gt;WHERE state = 'mo' &lt;br /&gt;In the above example, only 10 percent of the available rows would be returned. [7.0, 2000]&lt;br /&gt; &lt;br /&gt;12. You may have heard of a SET command called SET ROWCOUNT. Like the TOP operator, it is designed to limit how many rows are returned from a SELECT statement. In effect, the SET ROWCOUNT and the TOP operator perform the same function. While is some cases, using either option works equally efficiently, there are some instances (such as rows returned from an unsorted heap) where the TOP operator is more efficient than using SET ROWCOUNT. Because of this, using the TOP operator is preferable to using SET ROWCOUNT to limit the number of rows returned by a query. [7.0, 2000]&lt;br /&gt; &lt;br /&gt;13. Try to avoid WHERE clauses that are non-sargable. Non-sargable search arguments in the WHERE clause, such as "IS NULL", "OR", "&lt;&gt;", "!=", "!&gt;", "!&lt;", "NOT", "NOT EXISTS", "NOT IN", "NOT LIKE", and "LIKE %500" can prevent the query optimizer from using an index to perform a search. In addition, expressions that include a function on a column, or expressions that have the same column on both sides of the operator, are not sargable. &lt;br /&gt;But not every WHERE clause that has a non-sargable expression in it is doomed to a table scan. If the WHERE clause includes both sargable and non-sargable clauses, then at least the sargable clauses can use an index (if one exists) to help access the data quickly. [6.5, 7.0, 2000] &lt;br /&gt; &lt;br /&gt;14. If many queries are run off very large tables, consider breaking down the tables into one or more logical subsets using views. This works best for data that is easily partitioned, such as data based on date or location. This way, users can query off the appropriate view instead of the base table, saving a lot of I/O overhead. [6.5, 7.0, 2000] &lt;br /&gt; &lt;br /&gt;15. If you application needs to retrieve summary data often, but you don't want to have the overhead of calculating it on the fly when it is needed, consider using a trigger that updates summary values after the initial transaction completes. While the trigger has some overhead, overall, it may be less that having to calculate the data every time the summary data is needed. You will have to decide which method is fastest in your environment. [6.5, 7.0, 2000]&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7848011355253090856-214889472449007697?l=ravifirst.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ravifirst.blogspot.com/feeds/214889472449007697/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ravifirst.blogspot.com/2009/07/sql-server-performance-tuning-tips-i.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/214889472449007697'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/214889472449007697'/><link rel='alternate' type='text/html' href='http://ravifirst.blogspot.com/2009/07/sql-server-performance-tuning-tips-i.html' title='SQL Server Performance Tuning Tips - I'/><author><name>Ravi's</name><uri>http://www.blogger.com/profile/14359502815484562942</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_WxhoysBC8gY/StgCRfR-X5I/AAAAAAAAAJQ/l5Cd32MA2kk/S220/Rlogo.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7848011355253090856.post-8435345529782894440</id><published>2009-07-22T00:04:00.003+05:30</published><updated>2009-07-22T00:10:44.287+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='stored procedures'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL FAQs'/><category scheme='http://www.blogger.com/atom/ns#' term='delete duplicate rows sql server'/><category scheme='http://www.blogger.com/atom/ns#' term='sql server DBA'/><category scheme='http://www.blogger.com/atom/ns#' term='percent sign in sql'/><category scheme='http://www.blogger.com/atom/ns#' term='sql interview'/><title type='text'>STORED PROCEDURES IN SQL SERVER</title><content type='html'>&lt;strong&gt;Pros and Cons of Extended Stored Procedures&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Question: What are the pros and cons of creating extended stored procedures?&lt;br /&gt;&lt;br /&gt;Answer: The pros are that you can implement additional functionality and access data from DLLs from within SQL Server. If you need to do something that can be done only in C or C++, or if you have data that can be accessed only outside of SQL Server, you can still provide a link to it. The biggest con to extended stored procedures is that they run in the same process space as SQL Server. So an errant DLL could overwrite memory and cause SQL Server to crash or even corrupt data. The biggest safeguard against these problems is thorough testing of the procedure&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Percent Sign in SQL&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Question: I have a table in which the key field has a value stored with a percent sign, like '1234%'. Using this value, I want to select from another table that can have values like '1234567', '1234678' and '1234098'. How do I go about it? &lt;br /&gt;&lt;br /&gt;Answer: The percent sign (%) is a wildcard in SQL Server. It can be used at the beginning or end of a string. So the following syntax will return all of the records you mentioned: &lt;br /&gt;&lt;br /&gt;SELECT * FROM TestTable WHERE Col LIKE '1234%'&lt;br /&gt;&lt;br /&gt;Col&lt;br /&gt;-------&lt;br /&gt;1234567&lt;br /&gt;1234678&lt;br /&gt;1234098&lt;br /&gt;If you want to do an exact match for '1234' without the percent sign, then you'll have to trim off the last character, like this: &lt;br /&gt;SELECT * FROM TestTable  WHERE Col LIKE LEFT('1234%', (LEN('1234%')-1))&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Delete Duplicate Rows with a Single SQL Statement&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Question: Is it possible to delete duplicate rows in a table without using a temporary table (i.e., just do it with a single SQL statement)?&lt;br /&gt;&lt;br /&gt;Answer: All you need to do is compare the table to itself to find out which candidates are duplicates. Do this by assigning aliases to the table so you can use it twice, once as A and again as B, like this: &lt;br /&gt;&lt;br /&gt;delete &lt;br /&gt;    from jobs&lt;br /&gt;where &lt;br /&gt;    job_desc in&lt;br /&gt;    (        &lt;br /&gt;        select &lt;br /&gt;              a.job_desc &lt;br /&gt;        from &lt;br /&gt;            jobs a, &lt;br /&gt;            jobs b &lt;br /&gt;        where &lt;br /&gt;            a.job_desc = b.job_desc &lt;br /&gt;        group by &lt;br /&gt;            a.job_desc &lt;br /&gt;        having &lt;br /&gt;             count(a.job_desc) &gt;1&lt;br /&gt;    )&lt;br /&gt;&lt;br /&gt;When you do this you'll get a count based on the column value you think is duplicated. I used "desc" because the IDs will be different, so the description is the thing that is the candidate for repetition. Join the table to itself on that candidate to find matches of it. Everything will match to itself at least once that's why you group by the thing you think is a duplicate. Applying the HAVING clause to it squeezes out all the "ones" or singletons, leaving only the rows that have counts that are more than one in other words, your duplicate rows. &lt;br /&gt;&lt;br /&gt;By the way, this code trashes all the records that are duplicates. If you want to save one, add a comparison for the IDs to be different in the WHERE clause.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7848011355253090856-8435345529782894440?l=ravifirst.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ravifirst.blogspot.com/feeds/8435345529782894440/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ravifirst.blogspot.com/2009/07/stored-procedures-in-sql-server.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/8435345529782894440'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/8435345529782894440'/><link rel='alternate' type='text/html' href='http://ravifirst.blogspot.com/2009/07/stored-procedures-in-sql-server.html' title='STORED PROCEDURES IN SQL SERVER'/><author><name>Ravi's</name><uri>http://www.blogger.com/profile/14359502815484562942</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_WxhoysBC8gY/StgCRfR-X5I/AAAAAAAAAJQ/l5Cd32MA2kk/S220/Rlogo.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7848011355253090856.post-2508230216107511696</id><published>2009-07-22T00:02:00.003+05:30</published><updated>2009-07-22T00:04:03.132+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='optimising sql queries'/><category scheme='http://www.blogger.com/atom/ns#' term='optimising sql server indexes'/><category scheme='http://www.blogger.com/atom/ns#' term='sql server DBA'/><category scheme='http://www.blogger.com/atom/ns#' term='performance tuning'/><category scheme='http://www.blogger.com/atom/ns#' term='tips'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL SERVER PERFORMANCE TUNING TIPS'/><category scheme='http://www.blogger.com/atom/ns#' term='sql interview'/><title type='text'>SQL SERVER PERFORMANCE TUNING TIPS</title><content type='html'>&lt;strong&gt;Miscellaneous SQL Server Performance Tuning Tips&lt;/strong&gt; &lt;br /&gt;&lt;br /&gt;1.  If you need to delete all the rows in a table, don't use DELETE to delete them all, as the DELETE statement is a logged operation and can take time. To perform the same task much faster, use the TRUNCATE TABLE instead, which is not a logged operation. Besides deleting all of the records in a table, this command will also reset the seed of any IDENTITY column back to its original value. [6.5, 7.0, 2000] Updated 7-3-2001 &lt;br /&gt;&lt;br /&gt;2. Don't run a screensaver on your production SQL Server, it can unnecessarily use CPU cycles that should be going to your application. The only exception to this is the "blank screen" screensaver, which is OK to use. [6.5, 7.0, 2000] &lt;br /&gt;&lt;br /&gt;3. Use sp_who and sp_who2 (sp_who2 is not documented in the SQL Server Books Online, but offers more details than sp_who) to provide locking and performance-related information about current connections to SQL Server. [6.5, 7.0, 2000] &lt;br /&gt;&lt;br /&gt;4. By default, you cannot use a UNC (Universal Naming Convention) name to specify a location of where to store a SQL Server database or log file. Instead, you must specify a drive letter that refers to a local physical drive or array. But what if you want to store your database or log file on another NT Server or a Network Appliance, Inc. storage system? You can, but you will have to set Trace Flag 1807 on your SQL Server to allow the use of UNC names. [7.0] &lt;br /&gt;&lt;br /&gt;5. For a quick and dirty way to check to see if your SQL Server has maxed out its memory (and causing your server to page), try this. Bring up the Task Manager and go to the "Performance" tab. &lt;br /&gt;Here, check out two numbers: the "Total" under "Commit Charge (k)" and the "Total" under "Physical Memory (k)". If the "Total" under "Commit Charge (k)" is greater than the "Total" under "Physical Memory (k)", then your server does not have enough physical memory to run efficiently as it is currently configured and is most likely causing your server to page unnecessarily. Excess paging will slow down your server's performance. &lt;br /&gt;  If you notice this problem, you will probably want to use the Performance Monitor to further investigate the cause of this problem. You will also want to check to see how much physical memory has been allocated to SQL Server. Most likely, this setting has been set incorrectly, and SQL Server has been set to use too much physical memory. Ideally, SQL Server should be set to allocate physical RAM dynamically. [6.5, 7.0, 2000] &lt;br /&gt;&lt;br /&gt;6. Internet Information Server (IIS) has the ability to send its log files directly to SQL Server for storage. Busy IIS servers can actually get bogged down trying to write log information directly to SQL Server, and because of this, it is generally not recommend to write a web logging information to SQL Server. Instead, logs should be written to text files, and later imported into SQL Server using BCP or DTS. [6.5, 7.0, 2000] &lt;br /&gt;&lt;br /&gt;7. SQL Server 7 has a database compatibility mode that allows applications written for previous versions of SQL Server to run under SQL Server 7. In you want maximum performance for your database, you don't want to run your database in compatibility mode. Instead, it should be running in native SQL Server 7 mode. Of course, this may require you to modify your application to make it SQL Server 7 compliant, but in most cases, the additional work required to update your application will be more than paid for with improved performance. [7.0, 2000] &lt;br /&gt;&lt;br /&gt;8. When experimenting with the tuning of your SQL Server, you may want to run the DBCC DROPCLEANBUFFERS command to remove all the test data from SQL Server's data cache (buffer) between tests to ensure fair testing. If you want to clear out the stored procedure cache, use this command, DBCC FREEPROCCACHE. Both of these commands are for testing purposes and should not be run on a production SQL Server. [7.0, 2000] &lt;br /&gt;&lt;br /&gt;9. Orphan SQL Server sessions can negatively affect SQL Server's performance. An orphan SQL Server session can occur when a client improperly disconnects from SQL Server, such as when the client looses power. When this happens, the client cannot tell SQL Server to properly close the connection, so the SQL Server connection remains open, even though it is not being used. This can affect SQL Server's performance two ways. First, they use up SQL Server connections, which takes up server resources. Secondly, it is possible that the orphan connections may be holding locks that block other users, or temp tables or cursors may be held open that also take up unnecessary server resources. NT Server periodically checks for inactive SQL Server sessions, and if it finds any, it will notify SQL Server so that the connection can be removed. Unfortunately, NT Server only performs this check every 1-2 hours, depending on the protocol used. If orphaned SQL Server sessions become a problem, NT Server's registry can be modified so that it checks more often for orphaned connections.&lt;br /&gt;Identifying an orphaned connection from SQL Server is very difficult, but if you can identify it, it can be removed by KILLing it using Enterprise Manager or Query Analyzer. [6.5, 7.0, 2000] Added 10-2-2000&lt;br /&gt;&lt;br /&gt;10. If your application opens a DB-Library connection to SQL Server 7.0 and it uses either the TCP/IP or IPX/SPX network libraries, and you are using SQL Server 7.0 with no service pack or Service Pack 1, then SQL Server will experience severe memory leaks each time a new connection is opened, that can significantly affect its performance. To resolve this problem, the best solution is to install Service Pack 2, which will correct the problem. If you cannot install the service pack, then another option is to use another network library, such as Named Pipes or Multiprotocol. [7.0] More from Microsoft Added 11-15-2000 &lt;br /&gt;&lt;br /&gt;11. For best performance, don't mix production databases and development (test or staging) databases on the same physical server. This not only serves to better separate the two functions (production and development), but prevents developers from using up server resources that could be better used by production users. [6.5, 7.0, 2000] Added 11-20-2000 &lt;br /&gt;&lt;br /&gt;12.  When we think of performance, we usually think about speeding up our application's performance. But another way to look at performance is to look at our performance as DBA's or Transact-SQL developers. &lt;br /&gt;For example, one of the easiest ways to speed up our Transact-SQL coding, in addition to maintaining and troubleshooting our code once it is written, it to format it in an easy to read format. &lt;br /&gt;While there are many different code formatting guidelines available, here are some basic ones you should consider following, if you aren't doing so already: &lt;br /&gt;• Begin each line of your Transact-SQL code with a SQL verb, and capitalize all Transact-SQL statements and clauses, such as: &lt;br /&gt;SELECT customer_number, customer_name&lt;br /&gt;FROM customer&lt;br /&gt;WHERE customer_number &gt; 1000&lt;br /&gt;ORDER BY customer_number&lt;br /&gt;• If a line of Transact-SQL code is too long to fit onto one line, indent the following line(s), such as: &lt;br /&gt;SELECT customer_number, customer_name, customer_address,&lt;br /&gt;customer_state, customer_zip, customer_phonenumber&lt;br /&gt;• Separate logical groupings of Transact-SQL code by using appropriate comments and documentation explaining what each grouping goes. &lt;br /&gt;These are just a few of the many possible guidelines you can follow when writing your Transact-SQL code to make it more readable by you and others. You just need to decide on some standard, and then always follow it in your coding. If you do this, you will definitely boost your coding performance. [6.5, 7.0, 2000] Added 12-5-2000 &lt;br /&gt;&lt;br /&gt;13. Be wary of allowing users to directly access your databases (especially OLTP databases) with third-party database access tools, such as Microsoft Excel or Access. Many of these tools can wreck havoc with your database's performance. Here are some reasons why: &lt;br /&gt;• Often these users aren't experienced using these tools, and create overly complex queries that eat up server resources. At the other extreme, their queries may not be complex enough (such as lacking effective WHERE clauses) and return thousands, if not millions, or unnecessary rows of data.&lt;br /&gt;• This reporting activity can often lock rows, pages, or tables, creating user contention for data and reducing the database's performance.&lt;br /&gt;• These tools are often file-based. This means that even if an effective query is written, the entire table (or multiple tables in the case of joins) have to be returned to the client software where the query is actually performed, not at the server. This can not only lead to excess server activity, but it can play havoc on your network.&lt;br /&gt;If you have no choice but to allow users access to your data, try to avoid them hitting your production OLTP databases. Instead, point them to a "reporting" server that has been replicated, or is in the form of a datamart or data warehouse. [6.5, 7.0, 2000] Added 4-18-2001 &lt;br /&gt;&lt;br /&gt;14. SQL Server 2000 offers support of SSL encryption between clients and the server. While selecting this option prevents the data from being viewed, it also adds additional overhead and reduces performance. Only use SSL encryption if absolutely required. If you need to use SSL encryption, consider purchasing a SSL encryption processor for the server to speed performance. [2000] Added 9-21-2000 &lt;br /&gt;&lt;br /&gt;15. &lt;br /&gt;&lt;br /&gt;www.sureshkumar.net &lt;br /&gt;16. &lt;br /&gt;17. SQL Server 2000 supports named instances of SQL Server. For example, this feature allows you to run both SQL Server 6.5 and SQL Server 2000 on the same server; or to run SQL Server 7.0 and SQL Server 2000 on the same server; or to run SQL Server 6.5, SQL Server 7.0, and SQL Server 2000 on the same server; and to run up to 16 concurrent instances of SQL Server 2000 on the same server. &lt;br /&gt;As you might imagine, each running instance of SQL Server takes up server resources. Although some resources are shared by multiple running instances, such as MSDTC and the Microsoft Search services, most are not. Because of this, each additional instance of SQL Server running on the same server have to fight for available resources, hurting performance. For best performance, run only a single instance (usually the default) on a single physical server. The main reasons for using named instances is for upgrading older versions of SQL Server to SQL Server 2000, transition periods where you need to test your applications on multiple versions of SQL Server, and for use on developer's workstations. [2000] Added 11-14-2000 &lt;br /&gt;&lt;br /&gt;18. If you run the ALTER TABLE DROP COLUMN statement to drop a variable length or text column, did you know that SQL Server will not automatically reclaim this space after performing this action. To reclaim this space, which will help to reduce unnecessary I/O due to the wasted space, you can run the following command, which is new to SQL Server 2000. &lt;br /&gt;DBCC CLEANTABLE (database_name, table_name) &lt;br /&gt;      Before running this command, you will want to read about it in Books Online to learn about some of its options that may be important to you. [2000] Added 2-28-2001 &lt;br /&gt;&lt;br /&gt;19. Trace flags, which are used to enable and disable some special database functions temporarily, can often chew up CPU utilization and other resources on your SQL Server unnecessarily. If you just use them for a short time to help diagnose a problem, for example, and then turn them off as soon as your are done using them, then the performance hit you experience is small and temporary. &lt;br /&gt;What happens sometimes is that you, or another DBA, turns on a trace flag, but forgets to turn it off. This of course, can negatively affect your SQL Server's performance. If you want to check to see if there are any trace flags turned on on a SQL Server, run this command in Query Analyzer: &lt;br /&gt;DBCC TRACESTATUS(-1) &lt;br /&gt;If there are any trace flags on, you will see them listed on the screen after running this command. DBCC TRACESTATUS only finds traces created at the client (connection) level. If a trace has been turned on for an entire server, this will not show up. &lt;br /&gt;If you find any, you can turn them off using this command: &lt;br /&gt;DBCC TRACEOFF(number of trace) &lt;br /&gt;[7.0, 2000] Added 6-6-2001 &lt;br /&gt;&lt;br /&gt;20. SQL Server offers a feature called the black box. When enabled, the black box creates a trace file of the last 128K worth of queries and exception errors. This can be a great tool for troubleshooting some SQL Server problems, such as crashes. &lt;br /&gt;Unfortunately, this feature uses up SQL Server resources to maintain the trace file than can negatively affect its performance. Generally, you will want to only turn the black box on when troubleshooting, and turn it off during normal production. This way, your SQL Server will be minimally affected. [7.0, 2000] Added 6-6-2001 &lt;br /&gt;&lt;br /&gt;21. If you have ever performed a SELECT COUNT(*) on a very large table, you know how long it can take. For example, when I ran the following command on a large table I manage: &lt;br /&gt;SELECT COUNT(*) from &lt;table_name&gt; &lt;br /&gt;It took 1:09 to count 10,725,948 rows in the table. At the same time, SQL Server had to perform a lot of logical and physical I/O in order to perform the count, chewing up important SQL Server resources. &lt;br /&gt;A much faster, and more efficient, way of counting rows in a table is to run the following query: &lt;br /&gt;SELECT rows&lt;br /&gt;FROM sysindexes&lt;br /&gt;WHERE id = OBJECT_ID('&lt;table_name&gt;') AND indid &lt; 2 &lt;br /&gt;When I run the query against the same table, it takes less than a second to run, and it gave me the same results. Not a bad improvement, and it took virtually no I/O. This is because the row count of your tables is stored in the sysindexes system table of your database. So instead of counting rows when you need to, just look up the row count in the sysindexes table. &lt;br /&gt;The is one potential downside to using the sysindexes table. And that this system table is not updated in real time, so it might underestimate the number of rows you actually have. Assuming you have the database option turned on to "Auto Create Statistics" and "Auto Update Statistics", the value you get should be very close to being correct, if not correct. If you can live with a very close estimate, then this is the best way to count rows in your tables. [7.0, 2000] Added 7-3-2001 &lt;br /&gt;&lt;br /&gt;22. Looking for some new tools to help performance tune your operating system? Then check out the performance tools at Sysinternals. For example, they have tools to defrag your server's swap file, among many others. And best of all, most are free. [6.5, 7.0, 2000] Added 7-3-2001 &lt;br /&gt;&lt;br /&gt;23. Do you use Enterprise Manager to access remote servers, possibly over a slow WAN link? If you do, have you ever had any problems getting Enterprise Manager to connect to the remote server? &lt;br /&gt;If so, the problem may lay in the fact that if Enterprise Manager cannot make a connection within 4 seconds, then the connection attempt fails. To overcome slow network connections, you can change the default Enterprise Manager timeout value from 4 seconds to any amount of time you like. &lt;br /&gt;To change the default timeout value, select Tools|Options from Enterprise Manager, and then select the "Connection" tab if you have SQL Server 7.0, or the "Advanced" tab if you have SQL Server 2000. Here, change the "Login time-out (seconds)" option to a higher number. [7.0, 2000] Added 7-3-2001 &lt;br /&gt;&lt;br /&gt;24. SQLDIAG.exe is a command line tools that collects information about SQL Server and writes it to a text file. It can be useful for documenting or troubleshooting your SQL Server. When you run this command when SQL Server is running, the following information is collected and stored in a text file called sqldiag.txt, which is stored in the \mssql\log folder. &lt;br /&gt;• The text of all error logs &lt;br /&gt;• SQL Server registry information &lt;br /&gt;• SQL Server dll version information &lt;br /&gt;• The output from these system stored procedures: &lt;br /&gt;• sp_configure &lt;br /&gt;• sp_who &lt;br /&gt;• sp_lock &lt;br /&gt;• sp_helpdb &lt;br /&gt;• xp_msver &lt;br /&gt;• sp_helpextendedproc &lt;br /&gt;• sysprocesses &lt;br /&gt;• Input buffer SPIDs/deadlock information &lt;br /&gt;• Microsoft diagnostics report for the server &lt;br /&gt;• The last 100 queries and exceptions (if the query history trace was running) &lt;br /&gt;[ 7.0, 2000] Added 10-12-2001 &lt;br /&gt;&lt;br /&gt;25. If you are running any service pack of SQL Server 7.0 on a multiprocessor server, the number of configured processors displayed by Enterprise Manager my be incorrect. For example, while you may have two CPUs in your server, Enterprise Manager may only report one CPU. This is a known bug that has yet to be fixed in Service Packs 1 through 3 in SQL Server 7.0. &lt;br /&gt;The work-around to this problem is not to use the Enterprise Manager to specify the number of CPUs for SQL Server to use, but to use the sp_configure "max degree of parallelism" option instead, such as in this example: &lt;br /&gt;USE master&lt;br /&gt;GO&lt;br /&gt;&lt;br /&gt;SP_CONFIGURE 'show advanced option', 1&lt;br /&gt;GO&lt;br /&gt;&lt;br /&gt;RECONFIGURE WITH OVERRIDE&lt;br /&gt;GO&lt;br /&gt;&lt;br /&gt;SP_CONFIGURE 'max degree of parallelism', 0&lt;br /&gt;GO &lt;br /&gt;The "max degree of parallelism" option is an advanced option, so the first portion of the code above is used to turn on the "show advanced option." Once that is done, then you can set the "max degree of parallelism" option. By setting this option to "0", you are telling SQL Server to use all available CPUs in the server. See this Microsoft article for more information: http://support.microsoft.com/support/kb/articles/Q273/8/80.ASP [7.0] Added 10-23-2001 &lt;br /&gt;&lt;br /&gt;26. Memory leaks can steal valuable memory from your SQL Server, reducing performance, and perhaps even forcing you to reboot your server. A memory leak occurs when a poorly-written or buggy program requests memory from the operating system, but does not release the memory when it is done with it. Because of this, the application can use up more and more memory in a server, greatly slowing it down, and even perhaps crashing the server. &lt;br /&gt;Some memory leaks come from the operating system itself, device drivers, MDAC components, and even SQL Server. And of course, virtually any application can cause a memory leak, which is another good reason to dedicate a single server to SQL Server instead of sharing it among multiple applications. &lt;br /&gt;Memory leaks are often hard to identify, especially if they leak memory slowly. Generally, memory leaks become apparent when you notice that your server is running out of available memory and paging becomes a big problem. A symptom of this is a SQL Server that runs quickly after being rebooted, but begins to run more and more slowly as time passes, and when the system is rebooted again, it speeds up again. &lt;br /&gt;One way to help get rid of many memory leaks is to ensure that you always have the latest service packs or updates for your server's software. But a memory leak you find may not have an immediate fix. If this is the case, you may be forced to reboot your server periodically in order to free up memory. &lt;br /&gt;Identifying what is causing a memory leak is often difficult. One method involved using Performance Monitor to monitor all of the counters in the Memory object over time, seeing what is happening internally in your computer. Another method is to use Task Manager to view how much memory is used by each process. A process that seems to be using an unusual amount of memory may be the culprit. [6.5, 7.0, 2000]&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7848011355253090856-2508230216107511696?l=ravifirst.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ravifirst.blogspot.com/feeds/2508230216107511696/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ravifirst.blogspot.com/2009/07/sql-server-performance-tuning-tips.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/2508230216107511696'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/2508230216107511696'/><link rel='alternate' type='text/html' href='http://ravifirst.blogspot.com/2009/07/sql-server-performance-tuning-tips.html' title='SQL SERVER PERFORMANCE TUNING TIPS'/><author><name>Ravi's</name><uri>http://www.blogger.com/profile/14359502815484562942</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_WxhoysBC8gY/StgCRfR-X5I/AAAAAAAAAJQ/l5Cd32MA2kk/S220/Rlogo.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7848011355253090856.post-3628391431289498373</id><published>2009-07-21T23:57:00.004+05:30</published><updated>2009-07-22T00:01:58.719+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='sql Query'/><category scheme='http://www.blogger.com/atom/ns#' term='optimising sql server indexes'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL FAQs'/><category scheme='http://www.blogger.com/atom/ns#' term='sql server'/><category scheme='http://www.blogger.com/atom/ns#' term='non-clustered indexes'/><category scheme='http://www.blogger.com/atom/ns#' term='tips on optimizing sql server indexes'/><category scheme='http://www.blogger.com/atom/ns#' term='sql server DBA'/><category scheme='http://www.blogger.com/atom/ns#' term='clustered index'/><category scheme='http://www.blogger.com/atom/ns#' term='Indexes in sql server'/><category scheme='http://www.blogger.com/atom/ns#' term='sql interview'/><title type='text'>Optimizing SQL Server Indexes</title><content type='html'>&lt;strong&gt;Tips on Optimizing SQL Server Indexes&lt;/strong&gt; &lt;br /&gt;&lt;br /&gt;1. Indexes should be considered on all columns that are frequently accessed by the WHERE, ORDER BY, GROUP BY, TOP, and DISTINCT clauses. Without an index, each of these operations will require a table scan of your table, potentially hurting performance.&lt;br /&gt;&lt;br /&gt;Keep in mind the word "considered". An index created to support the speed of a particular query may not be the best index for another query on the same table. Sometimes you have to balance indexes to attain acceptable performance on all the various queries that are run against a table. [6.5, 7.0, 2000] Updated 12-7-2001&lt;br /&gt;&lt;br /&gt;2. To help identify which tables in your database may need additional or improved indexes, use the SQL Server Profiler Create Trace Wizard to run the "Identify Scans of Large Tables" trace. This trace will tell which tables are being scanned by queries instead of using an index to seek the data. This should provide you data you can use to help you identify which tables may need additional or better indexes. [7.0, 2000]&lt;br /&gt;&lt;br /&gt;3. Don't over index your OLTP tables, as every index you add increases the time in takes to perform INSERTS, UPDATES, and DELETES. There must be a fine line drawn between having the ideal number of indexes (for SELECTs) and the ideal number for data modifications. [6.5, 7.0, 2000]&lt;br /&gt;&lt;br /&gt;4. Don't automatically add indexes on a table because it seems like the right thing to do. Only add indexes if you know that they will be used by the queries run against the table. [6.5, 7.0, 2000]&lt;br /&gt;&lt;br /&gt;5. Don't accidentally add the same index twice on a table. This is easier to happen than you think. For example, you add a unique or primary key to an column, which of course creates an index to enforce what you want to happen. But without thinking about it when evaluating the need for indexes on a table, you decide to add a new index, and this new index happens to be on the same column as the unique or primary key. As long as you give indexes different names, SQL Server will allow you to create the same index over and over. [7.0, 2000] Added 4-2-2001&lt;br /&gt;&lt;br /&gt;6. If you have a table that is subject to many INSERTS, be sure that you have added a clustered index to it (not based on an incrementing key), whether or not it really needs one. A table that does not have a clustered index is called a heap. Every time data is INSERTed into a heap, the row is added to the end of the table. If there are many INSERTS, this spot could become a "hot spot" which could significantly affect performance. By adding a clustered index to the table (not based on an incrementing key), any potential hotspots are avoided. [6.5, 7.0, 2000] Added 2-22-2001&lt;br /&gt;&lt;br /&gt;7. Drop indexes that are never used by the Query Optimizer. Unused indexes slow data modifications and waste space in your database, increasing the amount of time it takes to backup and restore databases. Use the Index Wizard ( 7.0 and 2000) to help identify indexes that are not being used. [6.5, &lt;br /&gt;8. Generally, you probably won't want to add an index to a table under these conditions:&lt;br /&gt;• If the index is not used by the query optimizer. Use Query Analyzer's "Show Execution Plan" option to see if your queries against a particular table use an index or not. If the table is small, most likely indexes will not be used. &lt;br /&gt;• If the column values exhibit low selectivity, often less than 90%-95% for non-clustered indexes. &lt;br /&gt;• If the column(s) to be indexed are very wide. &lt;br /&gt;• If the column(s) are defined as TEXT, NTEXT, or IMAGE data types. &lt;br /&gt;• If the table is rarely queried. &lt;br /&gt;&lt;br /&gt;9. While high index selectivity is generally an important factor that the Query Optimizer uses to determine whether or not to use an index, there is one special case where indexes with low selectivity can be useful speeding up SQL Server. This is the case for indexes on foreign keys. Whether an index on a foreign key has either high or low selectivity, an index on a foreign key can be used by the Query Optimizer to perform a merge join on the tables in question. A merge join occurs when a row from each table is taken and then they are compared to see if they match the specified join criteria. If the tables being joined have the appropriate indexes (no matter the selectivity), a merge join can be performed, which is generally much faster than a join to a table with a foreign key that does not have an index. [7.0, 2000] Added 4-9-2001&lt;br /&gt;&lt;br /&gt;10. On data warehousing databases, which are essentially read-only, having an many indexes as necessary for covering virtually any query is not normally a problem. [6.5, 7.0, 2000] &lt;br /&gt;&lt;br /&gt;11. To provide the up-to-date statistics the query optimizer needs to make smart query optimization decisions, you will generally want to leave the "Auto Update Statistics" database option on. This helps to ensure that the optimizer statistics are valid, helping to ensure that queries are properly optimized when they are run. &lt;br /&gt;But this option is not a panacea. When a SQL Server database is under very heavy load, sometimes the auto update statistics feature can update the statistics at inappropriate times, such as the busiest time of the day. &lt;br /&gt;If you find that the auto update statistics feature is running at inappropriate times, you may want to turn it off, and then manually update the statistics (using UPDATE STATISTICS or sp_updatestats) when the database is under a less heavy load. &lt;br /&gt;But again, consider what will happen if you do turn off the auto update statistics feature? While turning this feature off may reduce some stress on your server by not running at inappropriate times of the day, it could also cause some of your queries not to be properly optimized, which could also put extra stress on your server during busy times. &lt;br /&gt;Like many optimization issues, you will probably need to experiment to see if turning this option on or off is more effective for your environment. But as a rule of thumb, if your server is not maxed out, then leaving this option is probably the best decision. [7.0, 2000] More info from Microsoft &lt;br /&gt;&lt;br /&gt;12. Keep the "width" of your indexes as narrow as possible, especially when creating composite (multi-column) indexes. This reduces the size of the index and reduces the number of reads required to read the index, boosting performance. [6.5, 7.0, 2000] &lt;br /&gt;&lt;br /&gt;13. If possible, try to create indexes on columns that have integer values instead of characters. Integer values have less overhead than character values. [6.5, 7.0, 2000] &lt;br /&gt;&lt;br /&gt;14. An index is generally only useful to a query if the WHERE clause of the query matches the column(s) that are leftmost in the index. So if you create a composite index, such as "City, State", then a query such as "WHERE City = 'Springfield'" will use the index, but the query "WHERE STATE = 'MO'" will not use the index. [6.5, 7.0, 2000]&lt;br /&gt;&lt;br /&gt;15. Even if the WHERE clause in a query does not specify the first column of an available index (which normally disqualifies the index from being used), if the index is a composite index and contains all of the columns referenced in the query, the query optimizer can still use the index, because the index is a covering index. [6.5, 7.0, 2000] &lt;br /&gt;&lt;br /&gt;16. When you create an index with a composite key, the order of the columns in the key is important. Try to order the columns in the key as to enhance selectivity, with the most selective columns to the leftmost of the key. If you don't due this, and put a non-selective column at the first part of the key, you risk having the Query Optimizer not use the index at all. Generally, a column should be at least 95% unique in order for it to be considered selective. [6.5, 7.0, 2000] Updated 3-6-2001 &lt;br /&gt;&lt;br /&gt;17. As you may know, an index is automatically created for column(s) in your table that you specify as a PRIMARY KEY or as UNIQUE. If two or more columns are involved, and a composite index is created, you should choose how the columns will be ordered in the composite index, instead of accepting the default choices offered by SQL Server. This is because you always want to use the most selective columns at the left of the key to ensure that the composite index is selective enough to be used by the Query Optimizer. If you don't do this, then the default order of the columns in the composite index may not be very selective, and the index may not be used by Query Optimizer. While the order of the columns in the index are important to the Query Optimizer, the order is not important to the PRIMARY KEY or UNIQUE constraints. [6.5, 7.0, 2000] Added 3-6-2001&lt;br /&gt;&lt;br /&gt;18. If you have two or more tables that are frequently joined together, then the columns used for the joins should have an appropriate index. If the columns used for the joins are not naturally compact, then considering adding surrogate keys to the tables that are compact in order to reduce the size of the keys, thus decreasing I/O during the join process, increasing overall performance. [6.5, 7.0, 2000]&lt;br /&gt;&lt;br /&gt;19. When creating indexes, try to make them unique indexes if at all possible. SQL Server can often search through a unique index faster than a non-unique index because in a unique index, each row is unique, and once it is found, SQL Server doesn't have to look any further. [6.5, 7.0, 2000] Added 10-19-2000&lt;br /&gt;&lt;br /&gt;20. If a particular query against a table is run infrequently, and the addition of an index greatly speeds the performance of the query, but the performance of INSERTS, UPDATES, and DELETES is negatively affected by the addition of the index, consider creating the index for the table for the duration of when the query is run, then dropping the index. An example of this is when monthly reports are run at the end of the month on an OLTP application. [6.5, 7.0, 2000] Added 9-11-2000&lt;br /&gt;&lt;br /&gt;21. If you like to get under the cover of SQL Server to learn more about indexing, take a look at the sysindex system table that is found in every database. Here, you can find a wealth of information on the indexes and tables in your database. To view the data in this table, run this query from the database you are interested in: SELECT *&lt;br /&gt;FROM sysindexes. Here are some of the more interesting fields found in this table:&lt;br /&gt;• dpages: If the indid value is 0 or 1, then dpages is the count of the data pages used for the index. If the indid is 255, then dpages equals zero. In all other cases, dpages is the count of the non-clustered index pages used in the index. &lt;br /&gt;• id: Refers to the id of the table this index belongs to. &lt;br /&gt;• indid: This column indicates the type of index. For example, 1 is for a clustered table, a value greater than 1 is for a non-clustered index, and a 255 indicates that the table has text or image data. &lt;br /&gt;• OrigFillFactor: This is the original fillfactor used when the index was first created, but it is not maintained over time. &lt;br /&gt;• statversion: Tracks the number of times that statistics have been updated. &lt;br /&gt;• status: 2 = unique index, 16 = clustered index, 64 = index allows duplicate rows, 2048 = the index is used to enforce the Primary Key constraint, 4096 = the index is used to enforce the Unique constraint. These values are additive, and the value you see in this column may be a sum of two or more of these options. &lt;br /&gt;• used: If the indid value is 0 or 1, then used is the number of total pages used for all index and table data. If indid is 255, used is the number of pages for text or image data. In all other cases, used is the number of pages in the index. &lt;br /&gt;&lt;br /&gt;22. Don't use FLOAT or REAL data types for primary keys, as they add unnecessary overhead and can hurt performance. [6.5, 7.0, 2000] Added 10-4-2000&lt;br /&gt;&lt;br /&gt;23. If your WHERE clause includes an AND operator, one way to optimize it is to ensure that at least one of the search criterion is highly selective and includes an index for the relevant column. [6.5, 7.0, 2000] Added 10-17-2000 &lt;br /&gt;&lt;br /&gt;24. The Query Optimizer will always perform a table scan or a clustered index scan on a table if the WHERE clause in the query contains an OR operator and if any of the referenced columns in the OR clause are not indexed (or does not have a useful index). Because of this, if you use many queries with OR clauses, you will want to ensure that each referenced column has an index. [7.0, 2000] Added 10-17-2000 &lt;br /&gt;&lt;br /&gt;25. The Query Optimizer converts the Transact-SQL IN clause to the OR operator when parsing your code. Because of this, keep in mind that if the referenced column in your query doesn't include an index, then the Query Optimizer will perform a table scan or clustered index scan on the table. [6.5, 7.0, 2000] Added 10-17-2000 &lt;br /&gt;&lt;br /&gt;26. If you use the SOUNDEX function against a table column in a WHERE clause, the Query Optimizer will ignore any available indexes and perform a table scan. If your table is large, this can present a major performance problem. If you need to perform SOUNDEX type searches, one way around this problem is to precalculate the SOUNDEX code for the column you are searching and then place this value in a column of its own, and then place an index on this column in order to speed searches. [6.5, 7.0, 2000] Added 11-9-2000 &lt;br /&gt;&lt;br /&gt;27. If you need to create indexes on large tables, you may be able to speed up their creation by using the new SORT_IN_TEMPDB option available with the CREATE INDEX command. This option tells SQL Server to use the tempdb database, instead of the current database, to sort data while creating indexes. Assuming your tempdb database is isolated on its own separate disk or disk array, then the process of creating the index can be sped up. The only slight downside to using this option is that it takes up slightly more disk space than if you didn't use it, but this shouldn't be much of an issue in most cases. If your tempdb database is not on its own disk or disk array, then don't use this option, as it can actually slow performance. [2000] Added 10-19-2000 &lt;br /&gt;&lt;br /&gt;28. SQL Server 2000 Enterprise Edition (not the standard edition) offers the ability to create indexes in parallel, greatly speeding index creation. Assuming your server has multiple CPUs, SQL Server 2000 uses near-linear scaling to boost index creation speed. For example, using two CPUs instead of one CPU almost halves the speed it takes to create indexes. [2000] Added 12-19-2000 &lt;br /&gt;&lt;br /&gt;29. As you probably already know, indexes on narrow columns are preferable to indexes on wide columns. The narrower the index, the more entries SQL Server can fit on a data page, which in turn reduces the amount of I/O required to access the data. But sometimes the column you want to search on using an index is much wider than desirable. &lt;br /&gt;For example, let's say you have a music database that lists the titles of over 5,000,000 songs, and that you want to search by song title. Also assume that the column used to store the music titles is a VARCHAR(45). Forty-five characters is a very wide index, and creating an index on such a wide column is not wise from a performance perspective. So how do we deal with such a scenario? &lt;br /&gt;SQL Server 2000 offers a new function called CHECKSUM. The main purpose for this function is to create what are called hash indices. A hash indices is an index built on a column that stores the checksum of the data found in another column in the table. The CHECKSUM function takes data from another column and creates a checksum value. In other words, the CHECKSUM function is used to create a mostly unique value that represents other data in your table. In most cases, the CHECKSUM value will be much smaller than the actual value. For the most part, checksum values are unique, but this is not guaranteed. It is possible that two slightly different values may produce the same identical CHECKSUM value. &lt;br /&gt;Here's how this works using our music database example. Say we have a song with the title "My Best Friend is a Mule from Missouri". As you can see, this is a rather long value, and adding an index to the song title column would make for a very wide index. But in this same table, we can add a CHECKSUM column that takes the title of the song and creates a checksum based on it. In this case, the checksum would be 1866876339. The CHECKSUM function always works the same, so if you perform the CHECKSUM function on the same value many different times, you would always get the same result. &lt;br /&gt;So how does the CHECKSUM help us? The advantage of the CHECKSUM function is that instead of creating a wide index by using the song title column, we create an index on the CHECKSUM column instead. "That's fine and dandy, but I thought you wanted to search by the song's title? How can anybody ever hope to remember a checksum value in order to perform a search?" &lt;br /&gt;Here's how. Take a moment to review this code: &lt;br /&gt;&lt;br /&gt;SELECT title, artist, composer&lt;br /&gt;FROM songs&lt;br /&gt;WHERE title = 'My Best Friend is a Mule from Missouri'&lt;br /&gt;AND checksum_title = CHECKSUM('My Best Friend is a Mule from Missouri') &lt;br /&gt;&lt;br /&gt;In this example, it appears that we are asking the same question twice, and in a sense, we are. The reason we have to do this is because there may be checksum values that are identical, even though the names of the songs are different. Remember, unique checksum values are not guaranteed. &lt;br /&gt;Here's how the query works. When the Query Optimizer examines the WHERE clause, it determines that there is an index on the checksum_title column. And because the checksum_title column is highly selective (minimal duplicate values) the Query Optimizer decides to use the index. In addition, the Query Optimizer is able to perform the CHECKSUM function, converting the song's title into a checksum value and using it to locate the matching records in the index. Because an index is used, SQL Server can very quickly locate the rows that match the second part of the WHERE clause. Once the rows have been narrowed down by the index, then all that has to be done is to compare these matching rows to the first part of the WHERE clause, which will take very little time. &lt;br /&gt;This may seem a lot of work to shorten the width of an index, but in many cases, this extra work will pay off in better performance in the long run. Because of the nature of this tip, I suggest you experiment using this method, and the more conventional method of creating an index on the title column itself. Since there are so many variables to consider, it is tough to know which method is better in your particular situation unless you give them both a try. [2000] Added 3-6-2001 &lt;br /&gt;&lt;br /&gt;30. There is a bug in SQL Server 7.0 and 2000 that has yet to be corrected, that can negatively affect the performance of some queries. Queries that have multiple OR clauses in them that are based on a clustered composite index may ignore the index and perform a table scan instead. This bug only appears if the query is within a stored procedure, or if it is executed through an ODBC-based application, such as VB, ASP, or Microsoft Access. &lt;br /&gt;The best way to identify if you are experiencing this bug is to view the Query Plan for slow queries that fit the criteria above, and see if a table scan is being performed, or if the index is being used. &lt;br /&gt;There are five different possible workarounds for this bug, depending on your circumstances: &lt;br /&gt;• Use an appropriate index hint to force the use of the composite index. This is probably the easiest method to get around this problem, and the one I recommend. &lt;br /&gt;• Changing from a clustered composite index to a non-clustered composite index may help, but this is not guaranteed. You will have to test it for yourself. &lt;br /&gt;• Rewrite the query using a UNION clause to combine the results returned from the OR clauses. Of course, using a UNION clause may itself degrade performance. You will have to test this option to see if it is faster or not. &lt;br /&gt;• If the query is being executed from an ODBC application through the SQLPrepare function with the SQL Server ODBC driver version 3.6 or earlier, then you can disable the "Generate Stored Procedures for Prepared Statements" option to workaround the bug. &lt;br /&gt;• If the query is being executed from an ODBC application through either the SQLPrepare or SQLExecDirect functions with a parameterized query using the SQL Server ODBC driver version 3.7, you can use the odbccmpt utility to enable the SQL Server 6.5 ODBC compatibility option and also disable the "Generate Stored Procedures for Prepared Statements" option to workaround the bug.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7848011355253090856-3628391431289498373?l=ravifirst.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ravifirst.blogspot.com/feeds/3628391431289498373/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ravifirst.blogspot.com/2009/07/optimizing-sql-server-indexes.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/3628391431289498373'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/3628391431289498373'/><link rel='alternate' type='text/html' href='http://ravifirst.blogspot.com/2009/07/optimizing-sql-server-indexes.html' title='Optimizing SQL Server Indexes'/><author><name>Ravi's</name><uri>http://www.blogger.com/profile/14359502815484562942</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_WxhoysBC8gY/StgCRfR-X5I/AAAAAAAAAJQ/l5Cd32MA2kk/S220/Rlogo.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7848011355253090856.post-542507090989411833</id><published>2009-07-21T23:54:00.002+05:30</published><updated>2009-07-21T23:57:18.417+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='stored procedures'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL FAQs'/><category scheme='http://www.blogger.com/atom/ns#' term='sql server'/><category scheme='http://www.blogger.com/atom/ns#' term='sql server 2005'/><category scheme='http://www.blogger.com/atom/ns#' term='tips'/><category scheme='http://www.blogger.com/atom/ns#' term='sql server 2008'/><category scheme='http://www.blogger.com/atom/ns#' term='Indexes in sql server'/><category scheme='http://www.blogger.com/atom/ns#' term='sql interview'/><category scheme='http://www.blogger.com/atom/ns#' term='sql Query'/><category scheme='http://www.blogger.com/atom/ns#' term='t-sql'/><category scheme='http://www.blogger.com/atom/ns#' term='performance tuning'/><category scheme='http://www.blogger.com/atom/ns#' term='sql server DBA'/><category scheme='http://www.blogger.com/atom/ns#' term='sql server datatypes'/><title type='text'>SQL SERVER PERFORMANCE TUNING</title><content type='html'>&lt;strong&gt;SQL Server Performance Tuning Tips for Stored Procedures &lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;1. Whenever a client application needs to send Transact-SQL to SQL Server, send it in the form of a stored procedure instead of a script or embedded Transact-SQL. This not only reduces network traffic (only the EXECUTE or CALL is issued over the network), but it can speed up the Transact-SQL because the code in the stored procedure residing on the server is already pre-compiled. In addition, after a stored procedure is run for the first time, it stays cached in SQL Server’s memory where it can potentially be reused, further reducing overhead on the SQL Server. &lt;br /&gt;Keep in mind that just because you use a stored procedure does not mean that it will run fast. The code you use within your stored procedure must be well designed for both speed and reuse. [6.5, 7.0, 2000] Updated 5-18-2001 &lt;br /&gt;&lt;br /&gt;2. To help identify performance problems with stored procedures, use the SQL Server's Profiler Create Trace Wizard to run the "Profile the Performance of a Stored Procedure" trace to provide you with the data you need to identify poorly performing stored procedures. [7.0, 2000] &lt;br /&gt;&lt;br /&gt;3. Include in your stored procedures the statement, "SET NOCOUNT ON". If you don't turn this command on, then every time a SQL statement is executed, SQL Server will send a response to the client indicating the number of rows affected by the statement. It is rare that this information will ever be needed by the client. Using this statement will help reduce the traffic between the server and the client. [6.5, 7.0, 2000] &lt;br /&gt;&lt;br /&gt;4. Keep Transact-SQL transactions as short as possible. This helps to reduce the number of locks, helping to speed up the overall performance of your SQL Server application. Two ways to help reduce the length of a transaction are to: 1) break up the entire job into smaller steps so each step can be committed as soon as possible; and 2) take advantage of SQL Server statement batches, which acts to reduce the number of round-trips between the client and server. [6.5, 7.0, 2000] &lt;br /&gt;&lt;br /&gt;5. When a stored procedure is first executed (and it does not have the WITH RECOMPILE option), it is optimized and a query plan is compiled and cached in SQL Server's buffer. If the same stored procedure is called again from the same connection, it will used the cached query plan instead of creating a new one, saving time and boosting performance. This may or may not be what you want. &lt;br /&gt;If the query in the stored procedure is exactly the same each time, then this is a good thing. But if the query is dynamic (the WHERE clauses changes from one execution of the stored procedure to the next), then this is a bad thing, as the query will not be optimized when it is run, and the performance of the query can suffer greatly. &lt;br /&gt;If you know that your query will vary each time it is run from the stored procedure, you will want to add the WITH RECOMPILE option when you create the stored procedure. This will force the stored procedure to be re-compiled each time it is run, ensuring the query is optimized each time it is run. [6.5, 7.0, 2000] &lt;br /&gt;&lt;br /&gt;6. Design your application to allow your users to cancel running queries. Not doing so may force the user to reboot the client, which can cause unresolvable performance problems. [6.5, 7.0, 2000] &lt;br /&gt;&lt;br /&gt;7. Many stored procedures have the option to accept multiple parameters. This in and of itself is not a bad thing. But what can often cause problems is if the parameters are optional, and the number of parameters varies greatly each time the stored procedure runs. There are two ways to handle this problem, the slow performance way and fast performance way. &lt;br /&gt;If you want to save your development time, but don't care about your application's performance, you can write your stored procedure generically so that it doesn't care how many parameters it gets. The problem with this method is that you may end up unnecessarily joining tables that don't need to be joined based on the parameters submitted for any single execution of the stored procedure. &lt;br /&gt;Another, much better performing way, although it will take you more time to code, is to include IF...ELSE logic in your stored procedure, and create separate queries for each possible combination of parameters that are to be submitted to the stored procedure. This way, you can be sure you query is as efficient as possible each time it runs. [6.5, 7.0, 2000] Added 12-29-2000 &lt;br /&gt;&lt;br /&gt;8. Here's another way to handle the problem of not knowing what parameters your stored procedure might face. In fact, it will probably perform faster than the tip listed above.&lt;br /&gt;&lt;br /&gt;Although the above tip is a good starting point, it's not complete. The problem is the query-plans, the pre-compilation of stored procedures, that SQL Server does for you. As you know, one of the biggest reasons to use stored procedures instead of ad-hoc queries is the performance gained by using them. The problem that arises with the above tip is that SQL Server will only generate a query-plan for the path taken through your stored procedure when you first call it, not all possible paths.&lt;br /&gt;&lt;br /&gt;Let me illustrate this with an example. Consider the following procedure (pre-compilation doesn't really have a huge effect on the queries used here, but these are just for illustration purposes):&lt;br /&gt;&lt;br /&gt;CREATE PROCEDURE dbo.spTest (@query bit) AS&lt;br /&gt;IF @query = 0&lt;br /&gt;SELECT * FROM authors&lt;br /&gt;ELSE&lt;br /&gt;SELECT * FROM publishers&lt;br /&gt;GO&lt;br /&gt;&lt;br /&gt;Suppose I make my first call to this procedure with the @query parameter set to 0. The query-plan that SQL Server will generate will be optimized for the first query ("SELECT * FROM authors"), because the path followed on the first call will result in that query being executed. &lt;br /&gt;Now, if I next call the stored procedure with @query set to 1, the query plan that SQL Server has in memory will not be of any use in executing the second query, since the query-plan is optimized for the authors table, not the publishers table. Result: SQL Server will have to compile a new query plan, the one needed for the second query. If I next call the procedure with @query set to 0 again, the whole path will have to be followed from the start again, since only one query-plan will be kept in memory for each stored procedure. This will result in sub-optimal performance.&lt;br /&gt;&lt;br /&gt;As it happens I have a solution, one that I've used a lot with success. It involves the creation of what I like to call a 'delegator'. Consider again spTest. I propose to rewrite it like this:&lt;br /&gt;&lt;br /&gt;CREATE PROCEDURE dbo.spTestDelegator (@query bit) AS&lt;br /&gt;IF @query = 0&lt;br /&gt;EXEC spTestFromAuthors&lt;br /&gt;ELSE&lt;br /&gt;EXEC spTestFromPublishers&lt;br /&gt;GO&lt;br /&gt;&lt;br /&gt;CREATE PROCEDURE dbo.spTestFromAuthors AS&lt;br /&gt;SELECT * FROM authors&lt;br /&gt;GO&lt;br /&gt;&lt;br /&gt;CREATE PROCEDURE dbo.spTestFromPublishers AS&lt;br /&gt;SELECT * FROM publishers&lt;br /&gt;GO&lt;br /&gt;&lt;br /&gt;The result of this restructuring will be that there will always be an optimized query-plan for spTestFromAuthors and spTestFromPublishers, since they only hold one query. The only one getting re-compiled over and over again is the delegator, but since this stored procedure doesn't actually hold any queries, that won't have a noticeable effect on execution time. Of course re-compiling a plan for a simple 'SELECT *' from a single table will not give you a noticeable delay either (in fact, the overhead of an extra stored procedure call may be bigger then the re-compilation of "SELECT * FROM AnyTable"), but as soon as the queries get bigger, this method certainly pays off.&lt;br /&gt;&lt;br /&gt;The only downside to this method is that now you have to manage three stored procedures instead of one. This is not that much of a problem though as the different stored procedures can be considered one single 'system', so it would be logical to keep all of them together in the same script, which would be just as easy to edit as a single stored procedure would be. As far as security is concerned, this method shouldn't give you any extra headaches either, as the delegator is the only stored procedure directly called by the client, this is the only one you need to manage permissions on. The rest will only be called by the delegator, which will always work as long as those stored procedures are owned by the same user as the delegator.&lt;br /&gt;&lt;br /&gt;I've had large successes using this technique. Recently I developed a (partial full-text) search engine for our reports database, which resulted in a stored procedure that originally ran about 20 seconds. After employing the above technique, the stored procedure only took about 2 seconds to run, resulting in a ten-fold increase in performance! [6.5, 7.0, 2000] Contributed by Jeremy van Dijk. Added 8-15-2000 &lt;br /&gt;&lt;br /&gt;9. While temporary stored procedures can provide a small performance boost in some circumstances, using a lot of temporary stored procedures in your application can actually create contention in the system tables and hurt performance. Instead of using temporary stored procedures, you may want to consider using the SP_EXECUTESQL stored procedure instead. It provides the same benefits on temporary stored procedures, but it does not store data in the systems tables, avoiding the contention problems. [7.0, 2000] &lt;br /&gt;&lt;br /&gt;10. If you are creating a stored procedure to run in a database other than the Master database, don't use the prefix "sp_" in its name. This special prefix is reserved for system stored procedures. Although using this prefix will not prevent a user defined stored procedure from working, what it can do is to slow down its execution ever so slightly. &lt;br /&gt;The reason for this is that by default, any stored procedure executed by SQL Server that begins with the prefix "sp_", is first attempted to be resolved in the Master database. Since it is not there, time is wasted looking for the stored procedure. &lt;br /&gt;If SQL Server cannot find the stored procedure in the Master database, then it next tries to resolve the stored procedure name as if the owner of the object is "dbo". Assuming the stored procedure is in the current database, it will then execute. To avoid this unnecessary delay, don't name any of your stored procedures with the prefix "sp_". [6.5, 7.0, 2000] Tip contributed by Joey Allen. &lt;br /&gt;&lt;br /&gt;11. Before you are done with your stored procedure code, review it for any unused code that you may have forgotten to remove while you were making changes, and remove it. Unused code just adds unnecessary bloat to your stored procedures. [6.5, 7.0, 2000] Added 8-15-2000 &lt;br /&gt;&lt;br /&gt;12. For best performance, all objects that are called within the same stored procedure should all be owned by the same owner, preferably dbo. If they are not, then SQL Server must perform name resolution on the objects if the object names are the same but the owners are different. When this happens, SQL Server cannot use a stored procedure "in-memory plan" over, instead, it must re-execute the stored procedure, which hinders performance. [7.0, 2000] Added 10-12-2000 &lt;br /&gt;&lt;br /&gt;13. When you need to execute a string of Transact-SQL, you should use the sp_executesql stored procedure instead of the EXECUTE statement. Sp_executesql offers to major advantages over EXECUTE. First, it supports parameter substitution, which gives your more options when creating your code. Second, it creates query execution plans that are more likely to be reused by SQL Server, which in turn reduces overhead on the server, boosting performance. &lt;br /&gt;Sp_executesql executes a string of Transact-SQL in its own self-contained batch. When it is run, SQL Server compiles the code in the string into an execution plan that is separate from the batch that contained the sp_executesql and its string. &lt;br /&gt;Learn more about how to use sp_executesql in the SQL Server Books Online. [7.0, 2000] Added 3-7-2001 &lt;br /&gt;&lt;br /&gt;14. SQL Server will automatically recompile a stored procedure if any of the following happens: &lt;br /&gt;• If you include a WITH RECOMPILE clause in a CREATE PROCEDURE or EXECUTE statement. &lt;br /&gt;• If you run sp_recompile for any table referenced by the stored procedure. &lt;br /&gt;• If any schema changes occur to any of the objects referenced in the stored procedure. This includes adding or dropping rules, defaults, and constraints. &lt;br /&gt;• New distribution statistics are generated. &lt;br /&gt;• If you restore a database that includes the stored procedure or any of the objects it references. &lt;br /&gt;• If the stored procedure is aged out of SQL Server's cache. &lt;br /&gt;• An index used by the execution plan of the stored procedure is dropped. &lt;br /&gt;• A major number of INSERTS, UPDATES or DELETES are made to a table referenced by a stored procedure. &lt;br /&gt;• The stored procedure includes both DDL (Data Definition Language) and DML (Data Manipulation Language) statements, and they are interleaved with each other. &lt;br /&gt;• If the stored procedure performs certain actions on temporary tables. &lt;br /&gt; &lt;br /&gt;15. One hidden performance problem of using stored procedures is when a stored procedure recompiles too often. Normally, you want a stored procedure to compile once and to be stored in SQL Server's cache so that it can be re-used without it having to recompile each time it is used. This is one of the major benefits of using stored procedures. But in some cases, a stored procedure is recompiled much more often than it needs to be recompiled, hurting your server's performance. In fact, it is possible for a stored procedure to have to be recompiled while it is executing! Here are three potential problems you want to look out for when writing stored procedures. &lt;br /&gt;Unnecessary Stored Procedure Recompilations Due to Row Modifications and Automated Statistics Update&lt;br /&gt;If your database has the "Auto Update Statistics" database option turned on, SQL Server will periodically automatically update the index statistics. On a busy database, this could happen many times each hour. Normally, this is a good thing because the Query Optimizer needs current index statistics if it is to make good query plan decisions. One side effect of this is that this also causes any stored procedures that reference these tables to be recompiled. Again, this is normal, as you don't want a stored procedure to be running an outdated query plan. But again, sometimes stored procedures recompile more than they have to. Here are some suggestions on how to reduce some of the unnecessary recompilations: &lt;br /&gt;• Use sp_executesql instead of EXECUTE to run Transact-SQL strings in your stored procedures. &lt;br /&gt;• Instead of writing one very large stored procedure, instead break down the stored procedure into two or more sub-procedures, and call then from a controlling stored procedure. &lt;br /&gt;• If your stored procedure is using temporary tables, use the KEEP PLAN query hint, which is used to stop stored procedure recompilations caused by more than six changes in a temporary table, which is the normal behavior. This hint should only be used for stored procedures than access temporary tables a lot, but don't make many changes to them. If many changes are made, then don't use this hint. &lt;br /&gt;Unnecessary Stored Procedure Recompilations Due to Mixing DDL and DML Statements in the Same Stored Procedure&lt;br /&gt;If you have a DDL (Data Definition Language) statement in your stored procedure, the stored procedure will automatically recompile when it runs across a DML (Data Manipulation Language) statement for the first time. And if you intermix both DDL and DML many times in your stored procedure, this will force a recompilation every time it happens, hurting performance. &lt;br /&gt;To prevent unnecessary stored procedure recompilations, you should include all of your DDL statements at the first of the stored procedure so they are not intermingled with DML statements. &lt;br /&gt;Unnecessary Stored Procedure Recompilations Due to Specific Temporary Table Operations&lt;br /&gt;Improper use of temporary tables in a stored procedure can force them to be recompiled every time the stored procedure is run. Here's how to prevent this from happening: &lt;br /&gt;• Any references to temporary tables in your stored procedure should only refer to tables created by that stored procedure, not to temporary tables created outside your stored procedure, or in a string executed using either the sp_executesql or the EXECUTE statement. &lt;br /&gt;• All of the statements in your stored procedure that include the name of a temporary table should appear syntactically after the temporary table. &lt;br /&gt;• The stored procedure should not declare any cursors that refer to a temporary table. &lt;br /&gt;• Any statements in a stored procedure that refer to a temporary table should precede any DROP TABLE statement found in the stored procedure. &lt;br /&gt;• The stored procedure should not create temporary tables inside a control-of-flow statement. &lt;br /&gt;&lt;br /&gt;16. To find out if your SQL Server is experiencing excessive recompilations of stored procedures, a common cause of poor performance, create a trace using Profiler and track the SP:Recompile event. A large number of recompilations should be an indicator if you potentially have a problem. Identify which stored procedures are causing the problem, and then take correction action (if possible) to reduce or eliminate these excessive recompilations. [7.0, 2000] Added 9-13-2001 &lt;br /&gt;&lt;br /&gt;17. Stored procedures can better boost performance if they are called via Microsoft Transaction Server (MTS) instead of being called directly from your application. A stored procedure can be reused from the procedure cache only if the connection settings calling the stored procedure are the same. If different connections call a stored procedure, SQL Server must load a separate copy of the stored procedure for each connection, which somewhat defeats the purpose of stored procedures. But if the same connection calls a stored procedure, it can be used over and over from the procedure cache. The advantage of Transaction Server is that it reuses connections, which means that stored procedures can be reused more often. If you write an application where every user opens their own connection, then stored procedures cannot be reused as often, reducing performance. [7.0, 2000] Added 10-12-2000 &lt;br /&gt;&lt;br /&gt;18. Avoid nesting stored procedures, although it is perfectly legal to do so. Nesting not only makes debugging more difficult, it makes it much more difficult to identify and resolve performance-related problems. [6.5, 7.0, 2000] Added 10-12-2000 &lt;br /&gt;&lt;br /&gt;19. If you use input parameters in your stored procedures, you should validate all of them at the beginning of your stored procedure. This way, if there is a validation problem and the client applications needs to be notified of the problem, it happens before any stored procedure processing takes place, preventing wasted effort and boosting performance. [6.5, 7.0, 2000] Added 10-12-2000 &lt;br /&gt;&lt;br /&gt;20. When calling a stored procedure from your application, it is important that you call it using its fully qualified name. Such as: &lt;br /&gt;exec database_name.dbo.myProcedure &lt;br /&gt;instead of: &lt;br /&gt;exec myProcedure &lt;br /&gt;Why? There are a couple of reasons, one of which relates to performance. First, using fully qualified names helps to eliminate any potential confusion about which stored procedure you want to run, helping to prevent bugs and other potential problems. But more importantly, doing so allows SQL Server to access the stored procedures execution plan more directly, and in turn, speeding up the performance of the stored procedure. Yes, the performance boost is very small, but if your server is running tens of thousands or more stored procedures every hour, these little time savings can add up. [7.0, 2000] Added 3-7-2001 More from Microsoft &lt;br /&gt;&lt;br /&gt;21. If a stored procedure needs to return only a single value, and not a recordset, consider returning the single value as an output statement. While output statements are generally used for error-checking, they can actually be used for any reason you like. Returning a single value as at output statement is faster than returning a single value as part of a recordset. [6.5, 7.0, 2000] Added 8-1-2001&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7848011355253090856-542507090989411833?l=ravifirst.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ravifirst.blogspot.com/feeds/542507090989411833/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ravifirst.blogspot.com/2009/07/sql-server-performance-tuning.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/542507090989411833'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/542507090989411833'/><link rel='alternate' type='text/html' href='http://ravifirst.blogspot.com/2009/07/sql-server-performance-tuning.html' title='SQL SERVER PERFORMANCE TUNING'/><author><name>Ravi's</name><uri>http://www.blogger.com/profile/14359502815484562942</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_WxhoysBC8gY/StgCRfR-X5I/AAAAAAAAAJQ/l5Cd32MA2kk/S220/Rlogo.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7848011355253090856.post-1018337245660158170</id><published>2009-07-21T23:50:00.003+05:30</published><updated>2009-07-21T23:54:32.834+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='sql Query'/><category scheme='http://www.blogger.com/atom/ns#' term='query to a text file'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL FAQs'/><category scheme='http://www.blogger.com/atom/ns#' term='sql server'/><category scheme='http://www.blogger.com/atom/ns#' term='sql server DBA'/><category scheme='http://www.blogger.com/atom/ns#' term='email in a query'/><category scheme='http://www.blogger.com/atom/ns#' term='stored proceduressql server datatypes'/><category scheme='http://www.blogger.com/atom/ns#' term='sql interview'/><title type='text'>SQL SERVER QUERY TIPS - II</title><content type='html'>&lt;strong&gt;Query to a Text File&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Question: I would like to create a stored procedure that runs a query and outputs the results to a text file and allows me to add extra delimeters and static field info. &lt;br /&gt;&lt;br /&gt;Answer: SQL Server has no native command for outputting query results to a file. You can use the extended &lt;br /&gt;stored procedure xp_cmdshell and call isql (command-line SQL) with your query and output the results to a file. Any delimiters would need to be part of the SELECT string: &lt;br /&gt;&lt;br /&gt;DECLARE @isqlString varchar(255)&lt;br /&gt;&lt;br /&gt;SELECT @isqlString = 'isql -Q "SELECT DateCol FROM NorthwindTest.dbo.Test" -E -o C:\Results.txt'&lt;br /&gt;&lt;br /&gt;EXEC master..xp_cmdshell @isqlString&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Dynamic Variables and Stored Procedures&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Question: I need to pass the @TheVar variable to the stored procedure's IN statement but I keep getting zero records. If I type this statement into the SQL... WHERE Name IN ('John', 'Frank', 'Tom') the statement works fine; 20 records are returned. &lt;br /&gt;&lt;br /&gt;EXECUTE the_proc "'John', 'Frank', 'Tom'" &lt;br /&gt;&lt;br /&gt;CREATE PROCEDURE the_proc &lt;br /&gt;@TheVar nvarchar(40)&lt;br /&gt;AS SELECT COUNT(FieldName) FROM Clients WHERE Name IN (@TheVar)&lt;br /&gt;Do you have any ideas? I use MS SQL Server 7.0 SP2. &lt;br /&gt;&lt;br /&gt;Answer: If you want to use variables as part of your SQL statement you need to modify it to call the EXECUTE statement. I created a Clients table with a single Name field of varchar(255) with records for John, Frank, and Tom. Then I created a stored procedure (similar to yours) that uses the input variable to build the IN clause like this: &lt;br /&gt;&lt;br /&gt;CREATE PROCEDURE GetClients&lt;br /&gt; @TheVar varchar(255) &lt;br /&gt;AS&lt;br /&gt;EXEC ('SELECT COUNT(Name) &lt;br /&gt; FROM Clients &lt;br /&gt; WHERE Name IN (' + @TheVar + ')')&lt;br /&gt;&lt;br /&gt;As you can see, it builds the SELECT statement using the variable and then the EXEC statement runs it. &lt;br /&gt;The syntax to call this procedure is: &lt;br /&gt;&lt;br /&gt;GetClients "'John', 'Tom', 'Frank'"&lt;br /&gt;---&lt;br /&gt;3&lt;br /&gt;&lt;br /&gt;Question: If my SQL Server has the following specs: 6.05.02 SQL-DMO 6.50.252 DB-Library Which version do I have? And which service pack version do I have? &lt;br /&gt;&lt;br /&gt;Answer: If you want to query the version of SQL Server that's currently running you can use the @@version variable: &lt;br /&gt;&lt;br /&gt;SELECT @@version&lt;br /&gt;&lt;br /&gt;This returns the version, processor, build and service pack information for the currently installed SQL Server. This information is stored in the system tables, and you can retrieve more details by calling the extended stored procedure xp_msver. Be sure to call it from the master database. &lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Data Type&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Question: How do I compare two values when one value(data type) is char and the other is an integer?&lt;br /&gt;&lt;br /&gt;Answer: For this you can use the CONVERT function. Since you can't convert character data to numbers, &lt;br /&gt;you'll have to convert the integer column to character. Assuming you have a table called TestTable with two columns: &lt;br /&gt;&lt;br /&gt;IntCol int&lt;br /&gt;CharCol char(10)&lt;br /&gt;&lt;br /&gt;with these values&lt;br /&gt;&lt;br /&gt;IntCol   CharCol&lt;br /&gt;------   -------&lt;br /&gt;1         1&lt;br /&gt;2         2&lt;br /&gt;3         xyz&lt;br /&gt;4         5&lt;br /&gt;&lt;br /&gt;You can use this query to SELECT rows based on a comparison: &lt;br /&gt;&lt;br /&gt;SELECT * FROM TestTable WHERE CONVERT(char(10), IntCol) = CharCol&lt;br /&gt;&lt;br /&gt;IntCol      CharCol    &lt;br /&gt;----------- ---------- &lt;br /&gt;1           1         &lt;br /&gt;2           2&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;E-mail in a Query&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Question: How do I send an e-mail to myself if a field reads "SEND_MAIL?" &lt;br /&gt;For example, a user wants more info on a product, so he clicks on the Send Mail button, which in turn throws an entry into the database. This entry is SEND_MAIL. Now at the end of the day I would like the server to scan the database for the word SEND_MAIL and, when it finds one, send me an email with the name and email address of the person. &lt;br /&gt;&lt;br /&gt;Answer: To answer this question I took the scenario of a Web site that logs user registrations and puts a &lt;br /&gt;visitor's first name, last name and e-mail address in a table. I then created a stored procedure that selects &lt;br /&gt;this data and e-mails it to an e-mail address provided as an input parameter. If the SendMail column in the table is Y, then the details will be e-mailed. The stored procedure is called like this: &lt;br /&gt;&lt;br /&gt;usp_CheckForMail 'name@emailaddress.com'&lt;br /&gt;&lt;br /&gt;The script to create the table is as follows: &lt;br /&gt;&lt;br /&gt;if exists (select * from sysobjects where id = object_id(N'[dbo].[TestTable]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)&lt;br /&gt;drop table [dbo].[TestTable]&lt;br /&gt;GO&lt;br /&gt;&lt;br /&gt;CREATE TABLE [dbo].[TestTable] (&lt;br /&gt; [ID] [int] IDENTITY (1, 1) NOT NULL ,&lt;br /&gt; [Fname] [varchar] (50) NULL ,&lt;br /&gt; [Lname] [varchar] (50) NULL ,&lt;br /&gt; [EmailAddress] [varchar] (100) NULL ,&lt;br /&gt; [SendMail] [char] (1) NULL &lt;br /&gt;) ON [PRIMARY]&lt;br /&gt;GO&lt;br /&gt;&lt;br /&gt;The script to create the stored procedure to send the e-mails is: &lt;br /&gt;&lt;br /&gt;if exists (select * from sysobjects where id = object_id(N'[dbo].[usp_CheckForMail]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)&lt;br /&gt;drop procedure [dbo].[usp_CheckForMail]&lt;br /&gt;GO&lt;br /&gt;&lt;br /&gt;SET QUOTED_IDENTIFIER ON &lt;br /&gt;SET ANSI_NULLS  ON &lt;br /&gt;GO&lt;br /&gt;&lt;br /&gt;CREATE PROCEDURE usp_CheckForMail&lt;br /&gt;       @SendToEmail varchar(255)&lt;br /&gt;AS&lt;br /&gt; DECLARE @ID int, @Fname varchar(50), @Lname varchar(50), @EmailAddress varchar(100), @MsgText varchar(255)&lt;br /&gt; DECLARE WebVisitors CURSOR FOR&lt;br /&gt;  SELECT ID, Lname, Fname, EmailAddress FROM TestTable&lt;br /&gt;&lt;br /&gt;  WHERE SendMail = 'Y'&lt;br /&gt;  ORDER BY Lname, Fname&lt;br /&gt; OPEN WebVisitors&lt;br /&gt;&lt;br /&gt; FETCH NEXT FROM WebVisitors&lt;br /&gt;  INTO @ID, @Lname, @Fname, @EmailAddress&lt;br /&gt;&lt;br /&gt; EXEC master.dbo.xp_startmail   /* typically mail will be started on your server */&lt;br /&gt;&lt;br /&gt; -- Check @@FETCH_STATUS to see if there are any more rows to fetch.&lt;br /&gt; WHILE @@FETCH_STATUS = 0&lt;br /&gt; BEGIN&lt;br /&gt;&lt;br /&gt; --    PRINT 'Visitor: ' + @Fname + ' ' +  @Lname + ' at ' + @EmailAddress + ' [ID=' + CAST(@ID AS varchar) + ']'&lt;br /&gt;&lt;br /&gt; SET @MsgText = 'Visitor: ' + @Fname + ' ' +  @Lname + ' at ' + @EmailAddress + ' [ID=' + CAST(@ID AS varchar) + ']'&lt;br /&gt; EXEC master.dbo.xp_sendmail @recipients = @SendToEmail, @message =@MsgText, @subject = 'New Web Visitor'&lt;br /&gt;&lt;br /&gt;        FETCH NEXT FROM WebVisitors&lt;br /&gt;        INTO @ID, @Lname, @Fname, @EmailAddress&lt;br /&gt;&lt;br /&gt;END&lt;br /&gt;&lt;br /&gt;CLOSE WebVisitors&lt;br /&gt;DEALLOCATE WebVisitors&lt;br /&gt;&lt;br /&gt;GO&lt;br /&gt; SET QUOTED_IDENTIFIER  OFF    &lt;br /&gt; SET ANSI_NULLS  ON &lt;br /&gt;GO&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7848011355253090856-1018337245660158170?l=ravifirst.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ravifirst.blogspot.com/feeds/1018337245660158170/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ravifirst.blogspot.com/2009/07/sql-server-query-tips-ii.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/1018337245660158170'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/1018337245660158170'/><link rel='alternate' type='text/html' href='http://ravifirst.blogspot.com/2009/07/sql-server-query-tips-ii.html' title='SQL SERVER QUERY TIPS - II'/><author><name>Ravi's</name><uri>http://www.blogger.com/profile/14359502815484562942</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_WxhoysBC8gY/StgCRfR-X5I/AAAAAAAAAJQ/l5Cd32MA2kk/S220/Rlogo.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7848011355253090856.post-6335122937422671723</id><published>2009-07-21T23:39:00.004+05:30</published><updated>2009-07-21T23:50:02.971+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='sql Query'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL FAQs'/><category scheme='http://www.blogger.com/atom/ns#' term='sql server DBA'/><category scheme='http://www.blogger.com/atom/ns#' term='tips'/><title type='text'>SQL QUERY TIPS - I</title><content type='html'>&lt;strong&gt;Q. Execute an Operating System Command From Within SQL Server&lt;/strong&gt;&lt;br /&gt;A. The xp_cmdshell extended store procedure makes it possible to execute operating system commands from within SQL Server. &lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Q. How can I create a plain-text flat file from SQL Server as input to another application?&lt;/strong&gt;&lt;br /&gt;A. One of the purposes of Extensible Markup Language (XML) is to solve challenges like this, but until all &lt;br /&gt;applications become XML-enabled, consider using our faithful standby, the bulk copy program (bcp) utility. &lt;br /&gt;This utility can do more than just dump a table; bcp also can take its input from a view instead of from a table. After you specify a view as the input source, you can limit the output to a subset of columns or to a subset of rows by selecting appropriate filtering (WHERE and HAVING) clauses.&lt;br /&gt;&lt;br /&gt;More important, by using a view, you can export data from multiple joined tables. The only thing you cannot do is specify the sequence in which the rows are written to the flat file, because a view does not let you include an ORDER BY clause in it unless you also use the TOP keyword.&lt;br /&gt;&lt;br /&gt;If you want to generate the data in a particular sequence or if you cannot predict the content of the data you want to export, be aware that in addition to a view, bcp also supports using an actual query. The only "gotcha" about using a query instead of a table or view is that you must specify queryout in place of out in the bcp command line.&lt;br /&gt;&lt;br /&gt;For example, you can use bcp to generate from the pubs database a list of authors who reside in California by writing the following code:&lt;br /&gt;&lt;br /&gt;bcp "SELECT * FROM pubs..authors WHERE state = 'CA'" queryout c:\CAauthors.txt -c -T -S&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Q. How can I programmatically detect whether a given connection is blocked? &lt;/strong&gt;&lt;br /&gt;A. A connection is blocked when it requires an object that another connection has a lock on. You can use the system stored procedure sp_lock to retrieve information about the current locks in SQL Server, and you can use the server process ID (SPID) to filter the information that sp_lock returns. To determine whether a given process is waiting for the release of a locked resource, you can execute the sp_GetBlockInfo procedure that follows.&lt;br /&gt;&lt;br /&gt;&lt;em&gt;&lt;strong&gt;Note&lt;/strong&gt;&lt;/em&gt;: You must execute the procedure before the timeout.&lt;br /&gt;&lt;br /&gt;USE master&lt;br /&gt;GO &lt;br /&gt;&lt;br /&gt;CREATE PROCEDURE sp_GetBlockInfo&lt;br /&gt;@BlockedSPID as int&lt;br /&gt;AS&lt;br /&gt;IF EXISTS (select *&lt;br /&gt;FROM master.dbo.syslockinfo&lt;br /&gt;WHERE req_spid = @BlockedSPID&lt;br /&gt;AND req_status = 3) &lt;br /&gt;&lt;br /&gt;SELECT sli1.req_spid AS SPID,&lt;br /&gt;SUBSTRING (u.name, 1, 8) As Mode,&lt;br /&gt;DB_NAME(sli1.rsc_dbid) AS [Database],&lt;br /&gt;OBJECT_NAME(sli1.rsc_objid) AS [Table],&lt;br /&gt;sli1.rsc_Text AS [Resource]&lt;br /&gt;FROM master.dbo.syslockinfo sli1&lt;br /&gt;JOIN master.dbo.spt_values u&lt;br /&gt;ON sli1.req_mode + 1 = u.number&lt;br /&gt;AND u.type = 'L'&lt;br /&gt;JOIN&lt;br /&gt;master.dbo.syslockinfo sli2&lt;br /&gt;ON sli1.rsc_dbid = sli2.rsc_dbid&lt;br /&gt;AND sli1.rsc_objid = sli2.rsc_objid&lt;br /&gt;AND sli1.rsc_text = sli2.rsc_text&lt;br /&gt;WHERE sli2.req_spid = @BlockedSPID&lt;br /&gt;AND sli1.req_status = 1&lt;br /&gt;AND sli1.req_spid &lt;&gt; @BlockedSPID&lt;br /&gt;AND sli2.req_status = 3&lt;br /&gt;ELSE &lt;br /&gt;&lt;br /&gt;SELECT CAST(1 as int) AS SPID,&lt;br /&gt;SUBSTRING ('', 1, 8) AS Mode,&lt;br /&gt;DB_NAME(NULL) AS [Database],&lt;br /&gt;OBJECT_NAME(NULL) AS [Table],&lt;br /&gt;CAST(NULL AS nchar(32)) AS [Resource]&lt;br /&gt;WHERE 1=2 &lt;br /&gt;&lt;br /&gt;GO &lt;br /&gt;&lt;br /&gt;The sp_GetBlockInfo procedure tells you the lock mode, the database and object names of the locked resource, and in the case of a blocking chain, which SPID is the root blocker. If the process is not blocked, &lt;br /&gt;sp_GetBlockInfo returns an empty recordset.&lt;br /&gt;&lt;br /&gt;You can also detect blocks by checking for error 1222, "Lock request time out period exceeded." The LOCK_TIMEOUT setting controls how long a process will wait for locks to be released before timing out. When the lock timeout occurs, SQL Server sends error 1222 to the application. In SQL Server 7.0, this error aborts the statement but does not cause the batch to roll back, so you can look for the Transact-SQL system variable @@ERROR and determine where locks exist&lt;br /&gt; &lt;br /&gt;&lt;strong&gt;Q. Can you create UNIQUE and PRIMARY KEY constraints on computed columns in SQL Server 2000?&lt;/strong&gt;&lt;br /&gt;A. In SQL Server, the physical mechanism that UNIQUE and PRIMARY KEY constraints use to enforce uniqueness is a unique index. Because SQL Server 2000 supports indexes on computed columns, &lt;br /&gt;you can create UNIQUE and PRIMARY KEY constraints on computed columns.&lt;br /&gt;&lt;br /&gt;Defining a UNIQUE constraint on a computed column is a straightforward process, as the following example shows:&lt;br /&gt;&lt;br /&gt;CREATE TABLE T1 ( &lt;br /&gt;col1 int NOT NULL, &lt;br /&gt;col2 AS col1 + 1 UNIQUE &lt;br /&gt;) &lt;br /&gt;&lt;br /&gt;However, if you define a PRIMARY KEY on a computed column, such as: &lt;br /&gt;&lt;br /&gt;CREATE TABLE T2 ( &lt;br /&gt;col1 int NOT NULL, &lt;br /&gt;col2 AS col1 + 1 PRIMARY KEY &lt;br /&gt;) &lt;br /&gt;&lt;br /&gt;&lt;em&gt;&lt;strong&gt;you receive the following error:&lt;/strong&gt;&lt;/em&gt;&lt;br /&gt;Server: Msg 8111, Level 16, State 2, Line 1 &lt;br /&gt;Cannot define PRIMARY KEY constraint on nullable column in table 'T2'. &lt;br /&gt;Server: Msg 1750, Level 16, State 1, Line 1 &lt;br /&gt;Could not create constraint. See previous errors. &lt;br /&gt;&lt;br /&gt;Because of the primary key constraint, SQL Server requires you to guarantee that your computation's &lt;br /&gt;result will not be NULL. The computation in the computed column can overflow &lt;br /&gt;(for example, when you add 1 to the largest integer) or underflow (when you subtract 1 from the smallest integer), and other computations can result in a divide-by-zero error. However, if the ARITHABORT &lt;br /&gt;(which determines whether a query has ended when an overflow or a divide-by-zero error occurs) &lt;br /&gt;and ANSI_WARNINGS (which specifies ANSI SQL-92 standard behavior for several error conditions) &lt;br /&gt;session settings are off, instead of ending the query, the computation can have a NULL result. &lt;br /&gt;&lt;br /&gt;In practice, when either ARITHABORT or ANSI_WARNINGS settings is off, you cannot create an index on a computed column or insert values into a table that has an index on a computed column because SQL Server detects such an attempt and returns an error. But SQL Server still requires you to guarantee that the computation will not result in NULL values. The trick is to wrap the computed column's computation with the ISNULL() function and supply an alternative value if the computation results in NULL: &lt;br /&gt;&lt;br /&gt;CREATE TABLE T2 ( &lt;br /&gt;col1 int NOT NULL, &lt;br /&gt;col2 AS ISNULL(col1 + 1, 0) PRIMARY KEY &lt;br /&gt;) &lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Q. Why does my inline or embedded SQL run faster than my stored procedures?&lt;/strong&gt;&lt;br /&gt;A. Recompilations might be the source of the slower stored procedure speed. To find out for sure, you need to do some performance investigation, such as looking at Showplans for each type of query versus calling the stored procedures and comparing query plan cache hits to cache misses. You can also try coding the object owner for referenced tables, views, and procedures inside your stored procedures, as the following example shows:&lt;br /&gt;&lt;br /&gt;SELECT * FROM dbo.mytable&lt;br /&gt;&lt;br /&gt;This technique helps you reuse plans and prevent cache misses.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Q. Why doesn't SQL Server permit an ORDER BY clause in the definition of a view?&lt;/strong&gt;&lt;br /&gt;A. SQL Server excludes an ORDER BY clause from a view to comply with the ANSI SQL-92 standard. Because analyzing the rationale for this standard requires a discussion of the underlying structure of the structured query language (SQL) and the mathematics upon which it is based, we can't fully explain the restriction here. However, if you need to be able to specify an ORDER BY clause in a view, consider using the following workaround:&lt;br /&gt;&lt;br /&gt;USE pubs&lt;br /&gt;GO &lt;br /&gt;&lt;br /&gt;CREATE VIEW AuthorsByName&lt;br /&gt;AS&lt;br /&gt;SELECT TOP 100 PERCENT *&lt;br /&gt;FROM authors &lt;br /&gt;ORDER BY au_lname, au_fname&lt;br /&gt;GO&lt;br /&gt;&lt;br /&gt;The TOP construct, which Microsoft introduced in SQL Server 7.0, is most useful when you combine it with the ORDER BY clause. The only time that SQL Server supports an ORDER BY clause in a view is when it is used in conjunction with the TOP keyword.&lt;br /&gt;&lt;br /&gt;Note that the TOP keyword is a SQL Server extension to the ANSI SQL-92 standard.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Q. Is using the TOP N clause faster than using SET ROWCOUNT N to return a specific number of rows from a query?&lt;/strong&gt;&lt;br /&gt;A. With proper indexes, the TOP N clause and SET ROWCOUNT N statement are equally fast, but with unsorted input from a heap, TOP N is faster. With unsorted input, the TOP N operator uses a small internal sorted temporary table in which it replaces only the last row. If the input is nearly sorted, the TOP N engine must delete or insert the last row only a few times. Nearly sorted means you're dealing with a heap with ordered inserts for the initial population and without many updates, deletes, forwarding pointers, and so on afterward. A nearly sorted heap is more efficient to sort than sorting a huge table. In a test that used TOP N to sort a table with the same number of rows but with unordered inserts, TOP N was not as efficient anymore. Usually, the I/O time is the same both with an index and without; however, without an index SQL Server must do a  complete table scan. Processor time and elapsed time show the efficiency of the nearly sorted heap. The I/O time is the same because SQL Server must read all the rows either way.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Q, The Difference between 'Count' and 'Count(*)'&lt;/strong&gt;&lt;br /&gt;A. 'Count': Counts the number of non-null values.&lt;br /&gt;'Count(*)': Counts the number of rows in the table, including null values and duplicates.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Q. I have two tables t1 and t2 both with the columns a1, a2. I want to find the difference of (the set of t1) - (the set of t2) without using the keyword EXCEPT because MSSQL 2000 does not recognize that word. I have tried this query but it does not give me what I want: SELECT * FROM t1 WHERE NOT EXISTS (SELECT t1.* FROM t1 INNER JOIN t2 ON t1.a1=t2.a1 AND t1.a2=t2.a2)&lt;/strong&gt;&lt;br /&gt;A. SELECT * FROM t1 WHERE NOT EXISTS (SELECT * FROM t2 ON t1.a1=t2.a1 AND t1.a2=t2.a2) &lt;br /&gt;&lt;br /&gt;This is the solution. The difference of (the set of t1) - (the set of t2) is &lt;br /&gt;&lt;br /&gt;SELECT * FROM t1 LEFT OUTER JOIN t2 ON t1.a1=t2.a1 AND t1.a2=t2.a2 WHERE t2.a1 IS NULL AND t2.a2 IS NULL &lt;br /&gt;&lt;br /&gt;According to SQL Query Analyzer, this is slightly more efficient than the left join (possibly only because &lt;br /&gt;of the tables I tested it with): &lt;br /&gt;&lt;br /&gt;SELECT * FROM t1 WHERE NOT EXISTS (SELECT * FROM t2 WHERE t1.a1=t2.a1 AND t1.a2=t2.a2) &lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Q, Leading Zero's in Stored Procedure&lt;/strong&gt;&lt;br /&gt;I have a form and I am passing a value to a stored procedure. The value has leading zeros. When the values are passed the leading zeros are dropped, thus causing my stored procedure to blow up. Is there a way to maintain those zeros in passing or pick them up again in the procedure? &lt;br /&gt;&lt;br /&gt;Try to pass value as string. &lt;br /&gt;&lt;br /&gt;If you were passing a string value then the LZ should not be dropped, so I suspect that you are passing a &lt;br /&gt;numeric value then converting it back to a varchar which will drop any LZ. If you don't want to change the interface then you can always restore the LZ in the stored procedure by using the following. &lt;br /&gt;&lt;br /&gt;declare @lz varchar(10) &lt;br /&gt;declare @numeric numeric(10,2) &lt;br /&gt;declare @result varchar(20) &lt;br /&gt;select @lz = '0000000000' &lt;br /&gt;select @numeric = 0000123.45 &lt;br /&gt;-- the LZ will be lost upon assignment &lt;br /&gt;&lt;br /&gt;select @result = substring(@lz, 1, datalength(@lz)-datalength(convert(varchar&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Q, Method to Perform Case Sensitive Searches in SQL Server&lt;/strong&gt;&lt;br /&gt;A. By default, SQL Server 7.0 installation sets up SQL Server to run in a case insensitive mode. For most applications this may work great, but there are certain situations were case sensitive searches are required. For instance, if a web site needs to have passwords that are case sensitive a method needs to be devised to perform case-sensitive queries. The following script performs a case-sensitive search. First let’s create a table:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;CREATE TABLE test &lt;br /&gt;(&lt;br /&gt; id  INT NOT NULL,&lt;br /&gt; msg  VARCHAR(100) NOT NULL&lt;br /&gt;)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Now let’s insert some case sensitive data into it:&lt;br /&gt;&lt;br /&gt;INSERT INTO test (id, msg) VALUES (1, 'bUSY');&lt;br /&gt;INSERT INTO test (id, msg) VALUES (2, 'BUSY');&lt;br /&gt;INSERT INTO test (id, msg) VALUES (3, 'busy');&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;In our test we are searching for a ‘bUSY’ value in the msg column of the test table. So the syntax of the same query, if the SQL Server was set to be case sensitive, would be:&lt;br /&gt;&lt;br /&gt;SELECT * FROM test where msg = ‘bUSY’;&lt;br /&gt;&lt;br /&gt;This query will return all rows in the test table. Now, here is the script that will perform the case sensitive search.&lt;br /&gt;&lt;br /&gt;DECLARE @table VARCHAR( 30 ) &lt;br /&gt;DECLARE @col VARCHAR( 30 ) &lt;br /&gt;DECLARE @searchVal VARCHAR( 195 ) &lt;br /&gt;&lt;br /&gt;SET @table = 'test'&lt;br /&gt;SET @col = 'msg'&lt;br /&gt;SET @searchVal = 'bUSY'&lt;br /&gt;&lt;br /&gt;DECLARE @sql VARCHAR( 255 ) &lt;br /&gt;DECLARE @colLength VARCHAR( 3 ) &lt;br /&gt;&lt;br /&gt;SELECT @colLength = CONVERT( varchar(3), DATALENGTH( @searchVal ) ) &lt;br /&gt;&lt;br /&gt;SELECT @sql = 'SELECT * ' + &lt;br /&gt;' FROM ' + @table + &lt;br /&gt;' WHERE' + &lt;br /&gt;' CONVERT( varbinary( ' + @colLength + '), ' + @col + ') = ' + &lt;br /&gt;' CONVERT( varbinary( ' + @colLength + '), "' + @searchVal + '")' + &lt;br /&gt;' AND ' + @col + '="' + @searchVal + '"' &lt;br /&gt;&lt;br /&gt;EXEC( @sql )&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Listing Available Tables&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Q, How do I list the available tables in a database I'm querying?&lt;/strong&gt;&lt;br /&gt;A. You can get a list of tables in a database by calling the INFORMATION_SCHEMA.Tables view like this: &lt;br /&gt;&lt;br /&gt;SELECT * FROM information_schema.tables&lt;br /&gt;&lt;br /&gt;This returns the name of the current database, the owner, the table name, and the table type for each table in the database. It's possible to query the system tables directly, but if this gives the information you need, &lt;br /&gt;it's better to use the existing views that come with SQL Server.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;How do I count the number of duplicate items in a table?&lt;/strong&gt;&lt;br /&gt;Lets break down your question into several steps. First, let's create a sample table using the following code: &lt;br /&gt;&lt;br /&gt;create table dups&lt;br /&gt;(&lt;br /&gt; i int&lt;br /&gt;)&lt;br /&gt;go&lt;br /&gt;&lt;br /&gt;declare @i int&lt;br /&gt;&lt;br /&gt;@i = 0&lt;br /&gt;&lt;br /&gt;while (@i &lt; 35)&lt;br /&gt;begin&lt;br /&gt;   insert into dups(i) values (cast (rand() * 50  as int))&lt;br /&gt; select  @i = @i + 1&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;Now, let's find rows that are duplicates. For that we can use a simple group by statement: &lt;br /&gt;&lt;br /&gt;select i,count(*) as num_records from dups group by i having count(*)  &gt; 1&lt;br /&gt;&lt;br /&gt;My sample data produced the following result set: &lt;br /&gt;&lt;br /&gt;i           num_records &lt;br /&gt;----------- ----------- &lt;br /&gt;0           2&lt;br /&gt;5           2&lt;br /&gt;18          2&lt;br /&gt;22          2&lt;br /&gt;27          2&lt;br /&gt;31          2&lt;br /&gt;34          2&lt;br /&gt;44          2&lt;br /&gt;49          2&lt;br /&gt;&lt;br /&gt;This identifies the rows that have duplicates. But it does not return the total number of duplicates in the table. The first change we must make is to recognize the above rows that show 2 contain only one duplicate. &lt;br /&gt;So we want a query that basically sums up the duplicates from the above query. To do so, we take the previous query and can put that in the from statement as a derived table. We then can use the sum function to create the total for us: &lt;br /&gt;&lt;br /&gt;select sum(num_dups)&lt;br /&gt;from (select i,count(*)-1 as num_dups&lt;br /&gt;from dups&lt;br /&gt;group by i&lt;br /&gt;having count(*)-1  &gt; 0) as mydups&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Using Distributed Queries on SQL Server 7.0&lt;/strong&gt;&lt;br /&gt;SQL Sever 7 allows developers to execute commands against OLE DB data sources on different servers. In order to execute commands on remote servers, the SQL Server instance where the commands will be issued must be setup properly. This entails adding the remote server to SQL Server's linked server list. Do this by using the sp_addlinkedserver command. &lt;br /&gt;&lt;br /&gt;For example, to link a remote SQL Server database that resides on the RemoteDBServer server, you would usethe following syntax: &lt;br /&gt;&lt;br /&gt;EXEC master. . sp_addlinkedserver &lt;br /&gt;@server = 'RemoteDBServer', &lt;br /&gt;@provider = 'SQLOLEDB', &lt;br /&gt;@srvproduct = 'SQL Server',&lt;br /&gt;@datasrc = 'RemoteDBServer'&lt;br /&gt;&lt;br /&gt;Note that only members of the sysadmin role can set this server option. Once the remote database has been linked, queries can be executed against it as long as the remote tables are prefaced using Server.Database.Table Owner.Table Name. &lt;br /&gt;&lt;br /&gt;For example, the following query would return all rows in the authors table of our RemoteDBServer SQL Server database: &lt;br /&gt;&lt;br /&gt;SELECT * FROM RemoteDBServer.pubs.dbo.authors&lt;br /&gt;&lt;br /&gt;Dynamic Query with .... in (@var)&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Can I use a variable in a query with the IN clause (a,b,c..z), without getting quotes or conversion errors?&lt;/strong&gt;&lt;br /&gt;You can use a variable as your IN clause, but this requires that you use the EXEC function to run the statement.&lt;br /&gt;&lt;br /&gt;Delete Files from SQL Server Local Machine&lt;br /&gt;&lt;br /&gt;Ever wanted to delete files from the local machine that your SQL Server database is running? &lt;br /&gt;You can do it using the extended stored procedure xp_cmdshell like this: &lt;br /&gt;&lt;br /&gt;EXEC master..xp_cmdshell 'del C:\file.txt'&lt;br /&gt;&lt;br /&gt;But this requires the sysadmin option on the SQL Server and Admin role from NT server. In most instances it is not preferable to give these privileges. So to delete files without requiring this access use the built-in SQL Server Automation APIs and the FileSystemObject: &lt;br /&gt;&lt;br /&gt;DECLARE  @hr    int&lt;br /&gt;DECLARE  @ole_FileSystem  int&lt;br /&gt;&lt;br /&gt;EXEC @hr = sp_OACreate 'Scripting.FileSystemObject', @ole_FileSystem OUT&lt;br /&gt;&lt;br /&gt;EXEC @hr = sp_OAMethod @ole_FileSystem, 'DeleteFile', NULL, 'C:\file.txt'&lt;br /&gt;&lt;br /&gt;EXEC @hr = sp_OADestroy @ole_FileSystem&lt;br /&gt;&lt;br /&gt;Large Text Fields&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;How do I create a text field of greater than 8,000 characters (in v7.0)? I attempted to use the "text" data type, but my code returned an error saying the maximum size was 8,000.  Here's the code:&lt;/strong&gt;&lt;br /&gt;CREATE TABLE X ( X_ID int IDENTITY(1,1), X_DESC text (60000) NOT NULL ) GO&lt;br /&gt;&lt;br /&gt;Answer: SQL Server is returning a bogus error message. The real error has to do with your syntax. &lt;br /&gt;When specifying text you don't specify a size. &lt;br /&gt;&lt;br /&gt;You can see the real error message if you reduce the number 60000 to 5. Then you will get this message: &lt;br /&gt;Server: Msg 2716, Level 16, State 1, Line 1&lt;br /&gt;&lt;br /&gt;Column or parameter #2: Cannot specify a column width on data type text. Instead, simply specify it as text without the parentheses and the number. The actual size of the storage used for the text field will depend on how much data you actually put in the column&lt;br /&gt;&lt;br /&gt;Importing Excel into SQL without Using Wizard&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;How do I give a user the option of importing Excel and a delimited text file into a SQL Server Database without manually using SQL DTS?&lt;/strong&gt;&lt;br /&gt;You can use the DTS object model to programmatically create, modify and run DTS packages. &lt;br /&gt;You can do this many ways, but essentially this object model has objects for anything you can do in DTS. &lt;br /&gt;If you already have the package created and saved as a file, add a reference to the DTS Library. &lt;br /&gt;Then you can call it like this: &lt;br /&gt;&lt;br /&gt;    Dim Package As New DTS.Package&lt;br /&gt;    &lt;br /&gt;    Package.LoadFromStorageFile App.Path "\DTSPackage.dts"&lt;br /&gt;    Package.Execute&lt;br /&gt;&lt;br /&gt;Connecting to SQL Server 7 via MS-DOS 6.2&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;I have some complex engine control software that has to run under MS-DOS 6.2, but it needs to transfer data to SQL Server 7. What's the best way to connect to SQL Server from DOS?&lt;/strong&gt;&lt;br /&gt;You can use OSQL or ISQL to connect to SQL Server from the command line. Both of these utilities are Win32 command-line utilities that allow you to log in to a server and issue any SQL command. The OSQL utility supports the most functionality and uses ODBC to connect to SQL Server. &lt;br /&gt;&lt;br /&gt;The syntax "osql/?" provides a listing of all OSQL flags. &lt;br /&gt;&lt;br /&gt;This syntax connects to a server and issues a query: &lt;br /&gt;&lt;br /&gt;osql -S "servername" -U "sa" -d "pubs" -q "SELECT * FROM Authors"&lt;br /&gt;&lt;br /&gt;To insert data into a database, you could put OSQL commands in a batch file or provide an input file of&lt;br /&gt; SQL INSERT commands. See the SQL Server BOL for details and syntax of OSQL. If you have a straight DOS box, you need to install the 16-bit client that comes with SQL Server 6.5. Both the client and the 6.5 version of ISQL use DB-Lib, which doesn't support some SQL Server 7 features like unicode columns, varchar columns larger than 255, etc.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Passing a CSV List Within an IN Statement&lt;/strong&gt;&lt;br /&gt;I have a CSV list I am passing through as a parameter in a stored procedure.&lt;br /&gt;Example of Region list: 1,2,3,4,5,6,7,8,9,10 &lt;br /&gt;CREATE PROCEDURE sp_getReport &lt;br /&gt; @Regionlist varchar(100) AS &lt;br /&gt;Select * from tblRegion where Region_ID IN (@regionlist) &lt;br /&gt;&lt;br /&gt;The varchar treats the list as one block of data. How can I change my code/syntax to read each value of the list separately within the IN statement? &lt;br /&gt;&lt;br /&gt;Answer: When you pass variables that are part of the statement in a stored procedure, you need to use &lt;br /&gt;the EXEC(UTE) statement. Here's the syntax to call the stored procedure and modify the current stored procedure to take the regions list as a parameter (the only difference is I called the column RegionID instead of Region_ID): &lt;br /&gt;&lt;br /&gt;sp_getreport '1,2,3,4,5,6,7,8,9,10'&lt;br /&gt;&lt;br /&gt;CREATE PROCEDURE sp_getReport   &lt;br /&gt;@regionlist varchar(100) &lt;br /&gt;AS&lt;br /&gt;&lt;br /&gt;EXEC ('Select * from tblRegion where RegionID IN (' + @regionlist +')')&lt;br /&gt; &lt;br /&gt;Creating Tables with Variable Names&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Is it possible to create tables in stored procedures using a variable for the table name?&lt;/strong&gt;&lt;br /&gt;For instance: &lt;br /&gt;&lt;br /&gt;declare @MyName &lt;br /&gt;set @MyName = 'dbo.Unique_Name'&lt;br /&gt; create table @MyName ....&lt;br /&gt;This obviously doesn't work, but does this ability exist? &lt;br /&gt;&lt;br /&gt;Answer: Yes, you can issue DLL statements with variables; you just need to use the EXECUTE statement. &lt;br /&gt;For example, this statement uses a variable for the table name, as in your example: &lt;br /&gt;&lt;br /&gt;DECLARE @TableName varchar(255)&lt;br /&gt;SET @TableName = '[dbo].[TestTable]'&lt;br /&gt;&lt;br /&gt;EXEC ('CREATE TABLE ' + @TableName + ' (&lt;br /&gt; [ID] [int] NULL ,&lt;br /&gt; [ItemDesc] [char] (50) NULL &lt;br /&gt;)')&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Use Sysobjects in SQL Server to Find Useful Database Information&lt;br /&gt;&lt;br /&gt;SQL Server sysobjects Table contains one row for each object created within a database. In other words, &lt;br /&gt;it has a row for every constraint, default, log, rule, stored procedure, and so on in the database. &lt;br /&gt;Therefore, this table can be used to retrieve information about the database. We can use xtype column in &lt;br /&gt;sysobjects table to get useful database information. This column specifies the type for the row entry in sysobjects. &lt;br /&gt;&lt;br /&gt;For example, you can find all the user tables in a database by using this query: &lt;br /&gt;&lt;br /&gt;select * from sysobjects where xtype='U'&lt;br /&gt;&lt;br /&gt;Similarly, you can find all the stored procedures in a database by using this query: &lt;br /&gt;&lt;br /&gt;select * from sysobjects where xtype='P'&lt;br /&gt;&lt;br /&gt;This is the list of all possible values for this column (xtype): &lt;br /&gt;&lt;br /&gt;C = CHECK constraint &lt;br /&gt;D = Default or DEFAULT constraint &lt;br /&gt;F = FOREIGN KEY constraint &lt;br /&gt;L = Log &lt;br /&gt;P = Stored procedure &lt;br /&gt;PK = PRIMARY KEY constraint (type is K) &lt;br /&gt;RF = Replication filter stored procedure &lt;br /&gt;S = System table &lt;br /&gt;TR = Trigger &lt;br /&gt;U = User table &lt;br /&gt;UQ = UNIQUE constraint (type is K) &lt;br /&gt;V = View &lt;br /&gt;X = Extended stored procedure&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7848011355253090856-6335122937422671723?l=ravifirst.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ravifirst.blogspot.com/feeds/6335122937422671723/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ravifirst.blogspot.com/2009/07/sql-query-tips.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/6335122937422671723'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/6335122937422671723'/><link rel='alternate' type='text/html' href='http://ravifirst.blogspot.com/2009/07/sql-query-tips.html' title='SQL QUERY TIPS - I'/><author><name>Ravi's</name><uri>http://www.blogger.com/profile/14359502815484562942</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_WxhoysBC8gY/StgCRfR-X5I/AAAAAAAAAJQ/l5Cd32MA2kk/S220/Rlogo.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7848011355253090856.post-9087569280594355469</id><published>2009-07-21T23:22:00.003+05:30</published><updated>2009-07-21T23:38:55.529+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='optimising sql queries'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL FAQs'/><category scheme='http://www.blogger.com/atom/ns#' term='dml'/><category scheme='http://www.blogger.com/atom/ns#' term='sql server 2005'/><category scheme='http://www.blogger.com/atom/ns#' term='import and exporting'/><category scheme='http://www.blogger.com/atom/ns#' term='cursors'/><category scheme='http://www.blogger.com/atom/ns#' term='ddl'/><category scheme='http://www.blogger.com/atom/ns#' term='sql server 2008'/><category scheme='http://www.blogger.com/atom/ns#' term='normalisation in database'/><category scheme='http://www.blogger.com/atom/ns#' term='Indexes in sql server'/><category scheme='http://www.blogger.com/atom/ns#' term='sql interview'/><category scheme='http://www.blogger.com/atom/ns#' term='t-sql'/><category scheme='http://www.blogger.com/atom/ns#' term='sql server DBA'/><title type='text'>FAQ's : SQL SERVER DBA</title><content type='html'>Hi buddies,&lt;br /&gt;&lt;br /&gt;  Here are some useful FAQs on SQL SERVER DBA.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Explain the concepts and capabilities of SQL Server.&lt;/strong&gt;&lt;br /&gt;Microsoft SQL server is a relational database management system. It uses MS- SQL as the query language. SQL Server offers a high level of security, reliability and scalability depending on the business needs..............&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Explain the use of keyword WITH ENCRYPTION. Create a Store Procedure with Encryption.&lt;/strong&gt;&lt;br /&gt;WITH ENCRYPTION Indicates that SQL Server will convert the original text of the CREATE PROCEDURE statement to an encrypted format. Users that have no access to system................&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;What is a linked server in SQL Server?&lt;/strong&gt;&lt;br /&gt;A linked server allows remote access. Using this, we can issue distributed queries, update, commands, and transactions across different data sources................ &lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Features and concepts of Analysis Services&lt;/strong&gt;&lt;br /&gt;Analysis service provides a combined view of the data used in OLAP or Data mining. Services here refer to OLAP, Data mining. Analysis services assists in creating, designing...........&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;What is Analysis service repository?&lt;/strong&gt;&lt;br /&gt;Each server running analysis service has a repository to store objects of the computer running Analysis Services an Analysis service repository stores the information about the............. &lt;br /&gt;&lt;br /&gt;&lt;strong&gt;What is SQL service broker?&lt;/strong&gt;&lt;br /&gt;SQL service broker provides asynchronous queuing functionality to SQL server. Once message is sent to the SQL server..........&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;What is user defined datatypes and when you should go for them?&lt;/strong&gt;&lt;br /&gt;User defined datatypes is created by using base SQL Server data type by providing a descriptive name............&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;What is bit datatype?&lt;/strong&gt;&lt;br /&gt;Bit datatype is used to store boolean information.............&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;What is lock escalation?&lt;/strong&gt;&lt;br /&gt;Lock escalation from SQL Server 7.0 onwards, is dynamically managed by SQL Server. It is..........&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;What is blocking?&lt;/strong&gt;&lt;br /&gt;Blocking happens when one connection from an application holds a lock and a second............&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;What is Public Role in SQL Server?&lt;/strong&gt;&lt;br /&gt;Every database has a public role which holds all the default permissions for the users in a database.................&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Discuss about SQL Server Login.&lt;/strong&gt;&lt;br /&gt;SQL server login is used to connect to SQL server. This used when login in through the windows login credentials is not existent.............&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Discuss about Builtin\Administrator.&lt;/strong&gt;&lt;br /&gt;The built in Administrator Account is basically used during some setup to join some machine in the domain............&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Failover clustering overview&lt;/strong&gt;&lt;br /&gt;Failover clustering is mainly used for data availability. Typically in a failover cluster, there are two machines. One machine provides the basic services and the second is available to run..................&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Describe the XML support SQL server extends.&lt;/strong&gt;&lt;br /&gt;SQL server can return XML document using FOR XML clause......&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Explain in brief how SQL server enhances scalability of the database system.&lt;/strong&gt;&lt;br /&gt;SQL Server has efficient ways to enhance scalability of the database system......&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;What is SQL Server English Query?&lt;/strong&gt;&lt;br /&gt;SQL Server English Query helps to build applications that can accept query.....&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;What is the purpose of SQL Profiler in SQL server?&lt;/strong&gt;&lt;br /&gt;SQL Profiler captures SQL Server events from a server. The events are saved.....&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;What are the ways available in SQL Server to execute SQL statements?&lt;/strong&gt;&lt;br /&gt;SQL Server uses different ways to execute SQL statements which are listed below......&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Explain Full-Text Query in SQL Server.&lt;/strong&gt;&lt;br /&gt;SQL Server supports searches on character string columns using Full-Text Query......&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Explain the phases a transaction has to undergo.&lt;/strong&gt;&lt;br /&gt;The several phases a transaction has to go through are listed here. Database.....&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;What is XPath?&lt;/strong&gt;&lt;br /&gt;XPath is a language defined by the W3C, used to select nodes from XML documents. ....&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Define the rules for designing Files and File groups in SQL Server.&lt;/strong&gt;&lt;br /&gt;A file or file group can only be used by one database. For example, the files abc.mdf and abc.ndf contains....&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;What are the Authentication Modes in SQL Server?&lt;/strong&gt;&lt;br /&gt;SQL Server supports two security (authentication) modes....&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Explain Data Definition Language, Data Control Language and Data Manipulation Language.&lt;/strong&gt;&lt;br /&gt;Data definition language is used to define and manage all attributes and properties of a database.....&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;What are the steps to process a single SELECT statement?&lt;/strong&gt;&lt;br /&gt;SQL Server uses the following steps to process a single SELECT statement....&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;What are the restrictions while creating batches in SQL Server?&lt;/strong&gt;&lt;br /&gt;CREATE DEFAULT, CREATE PROCEDURE, CREATE RULE, CREATE TRIGGER, and CREATE VIEW statements....&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Explain GO Command.&lt;/strong&gt;&lt;br /&gt;GO Command is used to signal the end of a batch.....&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;What is the significance of NULL value and why should we avoid permitting null values?&lt;/strong&gt;&lt;br /&gt;Null means no entry has been made. It implies that the value is either unknown or undefined.....&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;What is the difference between UNION and UNION ALL?&lt;/strong&gt;&lt;br /&gt;UNION command selects distinct and related information from two tables. On the other hand........&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;What is use of DBCC Commands?&lt;/strong&gt;&lt;br /&gt;Database Consistency Checker Commands give details in form of statistics about the SQL Server......... &lt;br /&gt;&lt;strong&gt;What is Log Shipping?&lt;/strong&gt;&lt;br /&gt;UNION command selects distinct and related information from two tables. On the other hand........&lt;br /&gt;&lt;strong&gt;What is the difference between a Local and a Global temporary table?&lt;/strong&gt;&lt;br /&gt;A local temporary table lives until the connection is valid or until the duration of a compound statement......... &lt;br /&gt;&lt;strong&gt;What is the STUFF and how does it differ from the REPLACE function?&lt;/strong&gt;&lt;br /&gt;STUFF function is used to insert a string into another string by deleting some characters specified......... &lt;br /&gt;&lt;br /&gt;&lt;strong&gt;What are the rules to use the ROWGUIDCOL property to define a globally unique identifier column?&lt;/strong&gt;&lt;br /&gt;A table can have only one ROWGUIDCOL column...... &lt;br /&gt;&lt;br /&gt;&lt;strong&gt;What is the actions prevented once referential integrity is enforced?&lt;/strong&gt;&lt;br /&gt;Following are the actions prevented once referential integrity is enforced......&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;What are the commands available for Summarizing Data in SQL Server?&lt;/strong&gt;&lt;br /&gt;We have CUBE or ROLLUP operators to generate summary reports. Both are part of the GROUP BY....&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;List out the difference between CUBE operator and ROLLUP operator&lt;/strong&gt;&lt;br /&gt;CUBE generates a result set that represents aggregates for all combinations of values in the selected columns.......&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;What are the guidelines to use bulk copy utility of SQL Server?&lt;/strong&gt;&lt;br /&gt;While importing data, the destination table must already exist......&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;What are the capabilities of Cursors?&lt;/strong&gt;&lt;br /&gt;Cursors can support various functionalities that are listed here.....&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;What are the ways to controlling Cursor Behavior?&lt;/strong&gt;&lt;br /&gt;Cursors behavior can be controlled by dividing them into cursor types: forward-only, static,........&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;What are the advantages of using Stored Procedures?&lt;/strong&gt;&lt;br /&gt;Stored procedures provide performance benefits through local storage, precompiling the code, and caching...... &lt;br /&gt;&lt;br /&gt;&lt;strong&gt;What are the ways to code efficient transactions?&lt;/strong&gt;&lt;br /&gt;Database users can have permission to execute a stored procedure without being....&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;What are the differences among batches, stored procedures, and triggers?&lt;/strong&gt;&lt;br /&gt;A batch is a group of one or more SQL statements. SQL Server compiles the statements......&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;What security features are available for stored procedures?&lt;/strong&gt;&lt;br /&gt;Database users can have permission to execute a stored procedure without being......&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;What are the instances when triggers are appropriate?&lt;br /&gt;What are the restrictions applicable while creating views?&lt;/strong&gt;&lt;br /&gt;Views can be created referencing tables and views only in the current database.......&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;What are the events recorded in a transaction log?&lt;/strong&gt;&lt;br /&gt;The start and end of each transaction......&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Describe when checkpoints are created in a transaction log.&lt;/strong&gt;&lt;br /&gt;It is created when CHECKPOINT statement is executed.......&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Define Truncate and Delete commands.&lt;/strong&gt;&lt;br /&gt;Truncate command is used to remove all rows of the column.The removed records are not recorded in the transaction log......&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;What are the lock types?&lt;/strong&gt;&lt;br /&gt;Shared Lock allows simultaneous access of record by multiple Select statements. Shared Lock blocks record from updating and will remain in queue waiting while record is accessed for reading......&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Define Identity and uniqueidentifier property of Column.&lt;/strong&gt;&lt;br /&gt;Column with identity property contains unique system generated value in the table. Column with identity property is similar to AutoNumber field in MS Access....&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Describe in brief system database.&lt;/strong&gt;&lt;br /&gt;Master database is system database. It contains information about server’s configuration. It is a very important database and important to backup Master.....&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Define Stuff Function and Replace Function. Describe in brief SQL Server monitoring ways.&lt;/strong&gt;&lt;br /&gt;SQL Profiler is a tool that stores events from the server. SQL Profiler saves the events in the trace file...... &lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Define transaction and transaction isolation levels.&lt;/strong&gt;&lt;br /&gt;A transaction is a set of operations that works as a single unit. The ransactions can be categorized into explicit, autocommit, and implicit....&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;SQL Server Optimization Tips&lt;/strong&gt;&lt;br /&gt;Restricting query result means return of required rows instead of all rows of the table. This helps in reducing network traffic...... &lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Having clause and Where clause&lt;/strong&gt;&lt;br /&gt;Both are used for filtering of records based on filtered criteria.....&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Describe in brief authentication modes in SQL server.&lt;/strong&gt;&lt;br /&gt;This is the default and recommended security mode. In this mode, access to SQL server is controlled by Windows NT..... &lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Define @@Error and raiseerror.&lt;/strong&gt;&lt;br /&gt;It is system variable that returns error code of the SQL statement.....&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Describe in brief Databases and SQL Server Databases Architecture.&lt;/strong&gt;&lt;br /&gt;A database is a structured collection of data. Database can be thought as simple data file...... &lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Define Normalization and De- Normalization.&lt;/strong&gt;&lt;br /&gt;It is the process of organizing data into related table. To normalize database, we divide database into tables.....&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;What is transact-SQL? Describe its types?&lt;/strong&gt;&lt;br /&gt;SQL Server Provides three types of Transact-SQL statements namely DDL, DCL, and DML....&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Define database objects.&lt;/strong&gt;&lt;br /&gt;SQL Server database stores information in a two dimensional objects of rows and columns called table......&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Define data, entity, domain and referential integrity.&lt;/strong&gt;&lt;br /&gt;Data Integrity validates the data before getting stored in the columns of the table. SQL Server supports four type of data integrity.....&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Describe in brief exporting and importing utility?&lt;/strong&gt;&lt;br /&gt;The Bulk Copy is a command utility that transfer SQL data to or from a data file. &lt;br /&gt;This utility mostly used to transfer huge data to SQL server from other database....&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Define Distributed Query and Linked Server?&lt;/strong&gt;&lt;br /&gt;Distributed Query is a query which can retrieve data from multiple data sources including distributed data........&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Define temporary and extended stored procedure.&lt;/strong&gt;&lt;br /&gt;Temporary Stored Procedure is stored in TempDB database. It is volatile and is deleted once connection gets terminated or server is restarted...... &lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Define Primary and Unique key.&lt;/strong&gt;&lt;br /&gt;The column or columns of the table whose value uniquely identifies each row in the table is called primary key. You can define column as primary key using primary key constraint while you create table.....&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;What is index? Define its types.&lt;/strong&gt;&lt;br /&gt;Index can be thought as index of the book that is used for fast retrieval of information. Index uses one or more column index keys and pointers to the record to locate record.........&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7848011355253090856-9087569280594355469?l=ravifirst.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ravifirst.blogspot.com/feeds/9087569280594355469/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ravifirst.blogspot.com/2009/07/faqs-sql-server-dba.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/9087569280594355469'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/9087569280594355469'/><link rel='alternate' type='text/html' href='http://ravifirst.blogspot.com/2009/07/faqs-sql-server-dba.html' title='FAQ&apos;s : SQL SERVER DBA'/><author><name>Ravi's</name><uri>http://www.blogger.com/profile/14359502815484562942</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_WxhoysBC8gY/StgCRfR-X5I/AAAAAAAAAJQ/l5Cd32MA2kk/S220/Rlogo.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7848011355253090856.post-523832060794893318</id><published>2009-07-17T11:53:00.010+05:30</published><updated>2009-07-17T12:53:09.050+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='COD rules'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL FAQs'/><category scheme='http://www.blogger.com/atom/ns#' term='sql server'/><category scheme='http://www.blogger.com/atom/ns#' term='sql server 2005'/><category scheme='http://www.blogger.com/atom/ns#' term='interview FAQs'/><category scheme='http://www.blogger.com/atom/ns#' term='sql server 2008'/><category scheme='http://www.blogger.com/atom/ns#' term='normalisation in database'/><category scheme='http://www.blogger.com/atom/ns#' term='RDBMS'/><category scheme='http://www.blogger.com/atom/ns#' term='sql interview'/><category scheme='http://www.blogger.com/atom/ns#' term='sql Query'/><category scheme='http://www.blogger.com/atom/ns#' term='interview questions'/><category scheme='http://www.blogger.com/atom/ns#' term='sql server DBA'/><category scheme='http://www.blogger.com/atom/ns#' term='e-r diagram'/><category scheme='http://www.blogger.com/atom/ns#' term='DBMS'/><title type='text'>SQL Server Interview Questions</title><content type='html'>&lt;h2&gt;Interview Questions on Database Concepts&lt;/h2&gt;&lt;br /&gt;&lt;p&gt;&lt;a href="#(DBMS)tc_What_is_database_or_database_management_systems_(DBMS)"&gt;(Q) What is a database or database management system (DBMS)?&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;a href="#WhatisdifferencebetweenDBMSandRDBMStcWhatsdifferencebetweenDBMSandRDBM"&gt;(Q) What is the difference between DBMS and RDBMS?&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;a href="#DBWhatareCODDrulestc_DBWhatareCODDrules"&gt;(DB) What are COD rules?&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;a href="#IsaccessdatabaseaRDBMStcIsaccessdatabaseaRDBMS"&gt;(Q) Is Access database a RDBMS?&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;a href="#WhatisthemaindifferencebetweenACCESSandSQLSERVERtcWhatsthemaindifferencebetweenACCESSandSQLSERVER"&gt;(Q) What is the main difference between ACCESS and SQL SERVER?&lt;/a&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;a href="#WhatisthedifferencebetweenMSDEandSQLSERVER2000tcWhatsthedifferencebetweenMSDEandSQLSERVER2000"&gt;(Q) What is the difference between MSDE and SQL SERVER 2000?&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;a href="#WhatisSQLSERVERExpress2005EditiontcWhatisSQLSERVERExpress2005Edition"&gt;(Q) What is SQL SERVER Express 2005 Edition?&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;a href="#DBWhatisSQLServer2000WorkloadGovernortcDBWhatisSQLServer2000WorkloadGovernor"&gt;(DB) What is SQL Server 2000 Workload Governor?&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;a href="#WhatisthedifferencebetweenSQLSERVER2000and2005tcWhatsthedifferencebetweenSQLSERVER2000and2005"&gt;(Q) What is the difference between SQL SERVER 2000 and 2005?&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;a href="#WhatareERdiagramstcWhatareERdiagrams"&gt;(Q) What are E-R diagrams?&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;a href="#(Q)_How_many_types_of_relationship_exist_in_database_designingtc_How_many_types_of_Howmanytypes ofrelationshipexistindatabasedesigningtc Howmanytypesofrelationshipexistindatabasedesigningrelationshipexistindatabasedesigning"&gt;(Q) How many types of relationships exist in database designing?&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;a href="#WhatisnormalizationWhataredifferenttypeofnormalizationtcWhatisnormalizationWhataredifferenttypeofnormalization"&gt;(Q) What is normalization? What are the different type of normalization?&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;a href="#WhatisdenormalizationtcWhatisdenormalization"&gt;(Q) What is denormalization?&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;a href="#DBCanyouexplainFourthNormalFormtcDBCanyouexplainFourthNormalForm"&gt;(DB) Can you explain Fourth Normal Form?&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;a href="#CanyouexplainFifthNormalFormDBCanyouexplainFifthNormalForm"&gt;(DB) Can you explain Fifth Normal Form? &lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;a href="#WhatisthedifferencebetweenFourthandFifthnormalformtcDBWhatsthedifferencebetweenFourthandFifthnormalform"&gt;(DB) What is the difference between Fourth and Fifth normal form?&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;a href="#HaveyouheardaboutsixthnormalformtcDBHaveyouheardaboutsixthnormalform"&gt;(DB) Have you heard about sixth normal form?&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;a href="#WhatisExtentandPagetcWhatisExtentandPage"&gt;(Q) What is Extent and Page?&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;a href="#DBWhatarethedifferentsectionsinPagetcDBWhatarethedifferentsectionsinPage"&gt;(DB) What are the different sections in Page?&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;a href="#WhatarepagesplitstcWhatarepagesplits"&gt;(Q) What are page splits?&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;a href="#InwhichfilesdoesactuallySQLServerstoredatatcInwhichfilesdoesactuallySQLServerstoredata"&gt;(Q) In which files does SQL Server actually store data?&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;a href="#DBCanwehaveadifferentcollationfordatabaseandtabletcDBCanwehaveadifferentcollationfordatabaseandtable"&gt;(DB) Can we have a different collation for database and table?&lt;/a&gt;&lt;/p&gt;&lt;h2&gt;Chapter 1: Database Concepts&lt;/h2&gt;&lt;h3&gt;&lt;a name="(DBMS)tc_What_is_database_or_database_management_systems_(DBMS)"&gt;(Q) What is a Database or Database Management System (DBMS)? &lt;/a&gt;&lt;/h3&gt;&lt;p&gt;Twist: What is the difference between a file and a database? Can files qualify as a database?&lt;/p&gt;&lt;p&gt;&lt;strong&gt;Note: &lt;/strong&gt;Probably these questions are too basic for experienced SQL SERVER guys. But from a fresher’s point of view, it can be a difference between getting a job and being jobless. &lt;/p&gt;&lt;BR&gt;&lt;BR&gt;&lt;ol&gt;&lt;BR&gt;&lt;li&gt;Database provides a systematic and organized way of storing, managing and retrieving from a collection of logically related information. &lt;/li&gt;&lt;BR&gt;&lt;BR&gt;&lt;li&gt;Secondly, the information has to be persistent, that means even after the application is closed the information should be persisted. &lt;/li&gt;&lt;BR&gt;&lt;BR&gt;&lt;li&gt;Finally, it should provide an independent way of accessing data and should not be dependent on the application to access the information. &lt;/li&gt;&lt;BR&gt;&lt;/ol&gt;&lt;BR&gt;&lt;BR&gt;&lt;p&gt;Ok, let me spend a few more sentences on explaining the third aspect. Below is a simple figure of a text file that has personal detail information. The first column of the information is &lt;code&gt;Name&lt;/code&gt;, second &lt;code&gt;Address &lt;/code&gt;and finally &lt;code&gt;Phone Number&lt;/code&gt;. This is a simple text file, which was designed by a programmer for a specific application. &lt;/p&gt;&lt;BR&gt; &lt;p align="center"&gt;&lt;BR&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 255px;" src="http://4.bp.blogspot.com/_WxhoysBC8gY/SmAewIFxIDI/AAAAAAAAADk/is99E2ODy9E/s400/image001.jpg" border="0" alt="ravifirst.blogspot.com/image001" id="BLOGGER_PHOTO_ID_5359317368725119026" /&gt;&lt;BR&gt; &lt;/p&gt;&lt;BR&gt;&lt;div class="Caption"&gt;&lt;BR&gt; &lt;p align="center"&gt;Figure 1.1: Non-Uniform Text File&lt;/div&gt;&lt;BR&gt;&lt;BR&gt;&lt;p&gt;It works fine in the boundary of the application. Now, some years down the line a third party application has to be integrated with this file. In order for the third party application to be integrated properly, it has the following options:&lt;/p&gt;&lt;BR&gt;&lt;BR&gt;&lt;ul&gt;&lt;BR&gt;&lt;li&gt;Use the interface of the original application.&lt;/li&gt;&lt;BR&gt;&lt;BR&gt;&lt;li&gt;Understand the complete details of how the text file is organized, example the first column is &lt;code&gt;Name&lt;/code&gt;, then &lt;code&gt;Address &lt;/code&gt;and finally &lt;code&gt;Phone Number&lt;/code&gt;. After analyzing, write a code which can read the file, parse it etc. Hmm, lot of work, right.&lt;/li&gt;&lt;BR&gt;&lt;/ul&gt;&lt;BR&gt;&lt;BR&gt;&lt;p&gt;That’s what the main difference is between a simple file and a database; database has an independent way (SQL) of accessing information while simple files do not (That answers my twisted question defined above). File meets the storing, managing and retrieving part of a database, but not the independent way of accessing data.&lt;/p&gt;&lt;BR&gt;&lt;BR&gt;&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; Many experienced programmers think that the main difference is that file cannot provide multi-user capabilities which a DBMS provides. But if you look at some old COBOL and C programs where files were the only means of storing data, you can see functionalities like locking, multi-user etc. provided very efficiently. So it’s a matter of debate. If some interviewers think of this as a main difference between files and database, accept it… going in to debate means probably losing a job.&lt;/p&gt;&lt;BR&gt;&lt;BR&gt;&lt;p&gt;(Just a note for fresher’s: Multi-user capabilities mean that at one moment of time more than one user should be able to add, update, view and delete data. All DBMS' provides this as in-built functionalities, but if you are storing information in files, it’s up to the application to write logic to achieve these functionalities).&lt;/p&gt;&lt;BR&gt;&lt;BR&gt;&lt;h3&gt;&lt;a name="WhatisdifferencebetweenDBMSandRDBMStcWhatsdifferencebetweenDBMSandRDBM"&gt;(Q) What is the Difference between DBMS and RDBMS?&lt;/a&gt;&lt;/h3&gt;&lt;BR&gt;&lt;BR&gt;&lt;p&gt;As mentioned before, DBMS provides a systematic and organized way of storing, managing and retrieving from a collection of logically related information. RDBMS also provides what DBMS provides, but above that, it provides relationship integrity. So in short, we can say:&lt;/p&gt;&lt;BR&gt;&lt;BR&gt;&lt;blockquote dir="ltr" style="MARGIN-RIGHT: 0px"&gt;&lt;BR&gt;&lt;p&gt;RDBMS = DBMS + REFERENTIAL INTEGRITY&lt;/p&gt;&lt;BR&gt;&lt;/blockquote&gt;&lt;BR&gt;&lt;BR&gt;&lt;p&gt;For example, in the above Figure 1.1, every person should have an &lt;code&gt;Address&lt;/code&gt;. This is a referential integrity between &lt;code&gt;Name&lt;/code&gt; and &lt;code&gt;Address&lt;/code&gt;. If we break this referential integrity in DBMS and files, it will not complain, but RDBMS will not allow you to save this data if you have defined the relation integrity between person and addresses. These relations are defined by using “Foreign Keys” in any RDBMS.&lt;/p&gt;&lt;BR&gt;&lt;BR&gt;&lt;p&gt;Many DBMS companies claimed that their DBMS product was RDBMS compliant, but according to industry rules and regulations, if the DBMS fulfills the twelve CODD rules, it’s truly a RDBMS. Almost all DBMS (SQL SERVER, ORACLE etc.) fulfill all the twelve CODD rules and are considered truly as RDBMS.&lt;/p&gt;&lt;BR&gt;&lt;BR&gt;&lt;p&gt;&lt;strong&gt;Note: &lt;/strong&gt;One of the biggest debates is whether Microsoft Access is an RDBMS? We will be answering this question in later section. &lt;/p&gt;&lt;BR&gt;&lt;BR&gt;&lt;h3&gt;&lt;a name="DBWhatareCODDrulestc_DBWhatareCODDrules"&gt;(DB)What are CODD Rules? &lt;/a&gt;&lt;/h3&gt;&lt;BR&gt;&lt;BR&gt;&lt;p&gt;Twist: Does SQL SERVER support all the twelve CODD rules?&lt;/p&gt;&lt;BR&gt;&lt;BR&gt;&lt;p&gt;&lt;strong&gt;Note: &lt;/strong&gt;This question can only be asked on two conditions when the interviewer is expecting you to be at a DBA job or you are complete fresher, yes and not to mention the last one he treats CODD rules as a religion. We will try to answer this question from the perspective of SQL SERVER. &lt;/p&gt;&lt;BR&gt;&lt;BR&gt;&lt;p&gt;In 1969, Dr. E. F. Codd laid down 12 rules, which a DBMS should adhere to in order to get the logo of a true RDBMS.&lt;/p&gt;&lt;BR&gt;&lt;BR&gt;&lt;h4&gt;Rule 1: Information Rule&lt;/h4&gt;&lt;BR&gt;&lt;BR&gt;&lt;p&gt;&amp;quot;All information in a relational database is represented explicitly at the logical level and in exactly one way - by values in tables.&amp;quot;&lt;/p&gt;&lt;BR&gt;&lt;BR&gt;&lt;p&gt;In SQL SERVER, all data exists in tables and are accessed only by querying the tables. &lt;/p&gt;&lt;BR&gt;&lt;BR&gt;&lt;h4&gt;Rule 2: Guaranteed Access Rule&lt;/h4&gt;&lt;BR&gt;&lt;BR&gt;&lt;p&gt;&amp;quot;Each and every datum (atomic value) in a relational database is guaranteed to be logically accessible by resorting to a combination of table name, primary key value and column name.&amp;quot;&lt;/p&gt;&lt;BR&gt;&lt;BR&gt;&lt;p&gt;In flat files, we have to parse and know the exact location of field values. But if a DBMS is truly an RDBMS, you can access the value by specifying the table name, field name, for instance &lt;code&gt;Customers.Fields [‘Customer Name’]&lt;/code&gt;.&lt;/p&gt;&lt;BR&gt;&lt;BR&gt;&lt;p&gt;SQL SERVER also satisfies this rule. In ADO.NET we can access field information using table name and field names.&lt;/p&gt;&lt;BR&gt;&lt;BR&gt;&lt;h4&gt;Rule 3: Systematic Treatment of Null Values&lt;/h4&gt;&lt;BR&gt;&lt;BR&gt;&lt;p&gt;&amp;quot;Null values (distinct from the empty character string or a string of blank characters and distinct from zero or any other number) are supported in fully relational DBMS for representing missing information and inapplicable information in a systematic way, independent of data type.” &lt;/p&gt;&lt;BR&gt;&lt;BR&gt;&lt;p&gt;In SQL SERVER, if there is no data existing, &lt;code&gt;NULL&lt;/code&gt; values are assigned to it. Note &lt;code&gt;NULL&lt;/code&gt; values in SQL SERVER do not represent spaces, blanks or a zero value; it is a distinct representation of missing information and thus satisfies rule 3 of CODD.&lt;/p&gt;&lt;BR&gt;&lt;BR&gt;&lt;h4&gt;Rule 4: Dynamic On-line Catalog Based on the Relational Model&lt;/h4&gt;&lt;BR&gt;&lt;BR&gt;&lt;p&gt;&amp;quot;The database description is represented at the logical level in the same way as ordinary data, so that authorized users can apply the same relational language to its interrogation as they apply to the regular data.&amp;quot;&lt;/p&gt;&lt;BR&gt;&lt;BR&gt;&lt;p&gt;The Data Dictionary is held within the RDBMS. Thus, there is no need for off-line volumes to tell you the structure of the database.&lt;/p&gt;&lt;BR&gt;&lt;BR&gt;&lt;h4&gt;Rule 5: Comprehensive Data Sub-language Rule&lt;/h4&gt;&lt;BR&gt;&lt;BR&gt;&lt;p&gt;&amp;quot;A relational system may support several languages and various modes of terminal use (for example, the fill-in-the-blanks mode). However, there must be at least one language whose statements are expressible, per some well-defined syntax, as character strings and that is comprehensive in supporting all the following items: &lt;/p&gt;&lt;BR&gt;&lt;BR&gt;&lt;ul&gt;&lt;BR&gt;&lt;li&gt;Data Definition &lt;/li&gt;&lt;BR&gt;&lt;BR&gt;&lt;li&gt;View Definition &lt;/li&gt;&lt;BR&gt;&lt;BR&gt;&lt;li&gt;Data Manipulation (Interactive and by program)&lt;/li&gt;&lt;BR&gt;&lt;BR&gt;&lt;li&gt;Integrity Constraints &lt;/li&gt;&lt;BR&gt;&lt;BR&gt;&lt;li&gt;Authorization&lt;/li&gt;&lt;BR&gt;&lt;BR&gt;&lt;li&gt;Transaction boundaries ( Begin, commit and rollback)&amp;quot;&lt;/li&gt;&lt;BR&gt;&lt;/ul&gt;&lt;BR&gt;&lt;BR&gt;&lt;p&gt;SQL SERVER uses SQL to query and manipulate data, which has a well-defined syntax and is being accepted as an international standard for RDBMS.&lt;/p&gt;&lt;BR&gt;&lt;BR&gt;&lt;p&gt;&lt;strong&gt;Note: &lt;/strong&gt;According to this rule, CODD has only mentioned that some language should be present to support it, but not necessary that it should be SQL. Before the 80’s, different’s database vendors were providing their own flavor of syntax until in 1980, ANSI-SQL came in to standardize this variation between vendors. As ANSI-SQL is quite limited, every vendor including Microsoft introduced their additional SQL syntax in addition to the support of ANSI-SQL. You can see SQL syntax varying from vendor to vendor.&lt;/p&gt;&lt;BR&gt;&lt;BR&gt;&lt;h4&gt;Rule 6: View-updating Rule&lt;/h4&gt;&lt;BR&gt;&lt;BR&gt;&lt;p&gt;&amp;quot;All views that are theoretically updatable are also updatable by the system.&amp;quot;&lt;/p&gt;&lt;BR&gt;&lt;BR&gt;&lt;p&gt;In SQL SERVER, not only views can be updated by the user, but also by SQL SERVER itself.&lt;/p&gt;&lt;BR&gt;&lt;BR&gt;&lt;h4&gt;Rule 7: High-level Insert, Update and Delete&lt;/h4&gt;&lt;BR&gt;&lt;BR&gt;&lt;p&gt;&amp;quot;The capability of handling a base relation or a derived relation as a single operand applies not only to the retrieval of data, but also to the insertion, update and deletion of data.&amp;quot;&lt;/p&gt;&lt;BR&gt;&lt;BR&gt;&lt;p&gt;SQL SERVER allows you to update views that in turn affect the base tables.&lt;/p&gt;&lt;BR&gt;&lt;BR&gt;&lt;h4&gt;Rule 8: Physical Data Independence&lt;/h4&gt;&lt;BR&gt;&lt;BR&gt;&lt;p&gt;&amp;quot;Application programs and terminal activities remain logically unimpaired whenever any changes are made in either storage representations or access methods.&amp;quot;&lt;/p&gt;&lt;BR&gt;&lt;BR&gt;&lt;p&gt;Any application program (C#, VB.NET, VB6, VC++ etc) does not need to be aware of where the SQL SERVER is physically stored or what type of protocol it is using, the database connection string encapsulates everything.&lt;/p&gt;&lt;BR&gt;&lt;BR&gt;&lt;h4&gt;Rule 9: Logical Data Independence&lt;/h4&gt;&lt;BR&gt;&lt;BR&gt;&lt;p&gt;&amp;quot;Application programs and terminal activities remain logically unimpaired when information-preserving changes of any kind that theoretically permit un-impairment are made to the base tables.&amp;quot;&lt;/p&gt;&lt;BR&gt;&lt;BR&gt;&lt;p&gt;Application programs written in C# or VB.NET do not need to know about any structure changes in SQL SERVER database. Example: adding of new field etc.&lt;/p&gt;&lt;BR&gt;&lt;BR&gt;&lt;h4&gt;Rule 10: Integrity Independence&lt;/h4&gt;&lt;BR&gt;&lt;BR&gt;&lt;p&gt;&amp;quot;Integrity constraints specific to a particular relational database must be definable in the relational data sub-language and storable in the catalog, not in the application programs.&amp;quot;&lt;/p&gt;&lt;BR&gt;&lt;BR&gt;&lt;p&gt;In SQL SERVER, you can specify data types (&lt;code&gt;integer&lt;/code&gt;, &lt;code&gt;nvarchar&lt;/code&gt;, &lt;code&gt;Boolean &lt;/code&gt;etc.) which put in data type checks in SQL SERVER rather than through application programs.&lt;/p&gt;&lt;BR&gt;&lt;BR&gt;&lt;h4&gt;Rule 11: Distribution Independence&lt;/h4&gt;&lt;BR&gt;&lt;BR&gt;&lt;p&gt;&amp;quot;A relational DBMS has distribution independence.&amp;quot;&lt;/p&gt;&lt;BR&gt;&lt;BR&gt;&lt;p&gt;SQL SERVER can spread across more than one physical computer and across several networks; but from application programs, it has not a big difference but just specifying the SQL SERVER name and the computer on which it is located.&lt;/p&gt;&lt;BR&gt;&lt;BR&gt;&lt;h4&gt;Rule 12: Non-subversion Rule&lt;/h4&gt;&lt;BR&gt;&lt;BR&gt;&lt;p&gt;&amp;quot;If a relational system has a low-level (single-record-at-a-time) language, that low level cannot be used to subvert or bypass the integrity Rules and constraints expressed in the higher level relational language (multiple-records-at-a-time).&amp;quot;&lt;/p&gt;&lt;BR&gt;&lt;BR&gt;&lt;p&gt;In SQL SERVER whatever integrity rules are applied on every record are also applicable when you process a group of records using application program in any other language (example: C#, VB.NET, J# etc.).&lt;/p&gt;&lt;BR&gt;&lt;BR&gt;&lt;p&gt;Readers can see from the above explanation that SQL SERVER satisfies all the CODD rules, some database gurus consider SQL SERVER as not truly being an RDBMS, but that’s a matter of debate.&lt;/p&gt;&lt;BR&gt;&lt;BR&gt;&lt;h3&gt;&lt;a name="IsaccessdatabaseaRDBMStcIsaccessdatabaseaRDBMS"&gt;(Q) Is Access Database a RDBMS?&lt;/a&gt;&lt;/h3&gt;&lt;BR&gt;&lt;BR&gt;&lt;p&gt;Access fulfills all rules of CODD, so from this point of view, yes it’s truly an RDBMS. However, many people can contradict it as a large community of Microsoft professionals think that Access is not an RDBMS.&lt;/p&gt;&lt;BR&gt;&lt;BR&gt;&lt;h3&gt;&lt;a name="WhatisthemaindifferencebetweenACCESSandSQLSERVERtcWhatsthemaindifferencebetweenACCESSandSQLSERVER"&gt;(Q) What is the Main Difference between ACCESS and SQL SERVER?&lt;/a&gt;&lt;/h3&gt;&lt;BR&gt;&lt;BR&gt;&lt;p&gt;As mentioned before, Access fulfills all the CODD rules and behaves as a true RDBMS. But there’s a huge difference from an architecture perspective, due to which many developers prefer to use SQL SERVER as the major database rather than Access. Following is the list of architecture differences between them:&lt;/p&gt;&lt;BR&gt;&lt;BR&gt;&lt;ul&gt;&lt;BR&gt;&lt;li&gt;Access uses file server design and SQL SERVER uses the Client / Server model. This forms the major difference between SQL SERVER and ACCESS.&lt;br /&gt;&lt;strong&gt;Note:&lt;/strong&gt; Just to clarify what is client server and file server I will make a quick description of widely accepted architectures. There are three types of architectures:&lt;/li&gt;&lt;BR&gt;&lt;BR&gt;&lt;ul&gt;&lt;BR&gt;&lt;li&gt;Main frame architecture (This is not related to the above explanation but just mentioned as it can be useful during an interview and also for comparing with other architectures)&lt;/li&gt;&lt;BR&gt;&lt;BR&gt;&lt;li&gt;File sharing architecture (Followed by ACCESS)&lt;/li&gt;&lt;BR&gt;&lt;BR&gt;&lt;li&gt;Client Server architecture (Followed by SQL SERVER).&lt;/li&gt;&lt;BR&gt;&lt;/ul&gt;&lt;BR&gt;&lt;/ul&gt;&lt;BR&gt;&lt;BR&gt;&lt;p&gt;In Main Frame architecture, all the processing happens on central host server. User interacts through a dumb terminal that only sends keystrokes and information to the host. All the main processing happens on the central host server. So the advantage in such type of architecture is that you need least configuration clients. But the disadvantage is that you need a robust central host server like Main Frames.&lt;/p&gt;&lt;BR&gt;&lt;BR&gt;&lt;p&gt;In File sharing architecture, which is followed by Access database, all the data is sent to the client terminal and then processed. For instance, if you want to see customers who stay in India, in File Sharing architecture all customer records will be sent to the client PC regardless whether the customer belongs to India or not. On the client PC customer records from India are sorted/filtered out and displayed, in short all processing logic happens on the client PC. Therefore, in this architecture, the client PC should have heavy configuration and it increases network traffic as a lot of data is sent to the client PC. However, the advantage of this architecture is that your server can be of a low configuration.&lt;/p&gt;&lt;BR&gt; &lt;p align="center"&gt;&lt;BR&gt; &lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 257px;" src="http://1.bp.blogspot.com/_WxhoysBC8gY/SmAg-Dgiz9I/AAAAAAAAADs/E_RTIcrNj28/s400/image003.jpg" border="0" alt="ravifirst.blogspot.com/image003" id="image003" /&gt;&lt;BR&gt; &lt;/p&gt;&lt;BR&gt;&lt;div class="caption"&gt;&lt;BR&gt; &lt;p align="center"&gt;Figure 1.2: File Server Architecture of Access&lt;/div&gt;&lt;BR&gt;&lt;BR&gt;&lt;p&gt;In client server architecture, the above limitation of the file server architecture is removed. In client server architecture, you have two entities, client and the database server. File server is now replaced by database server. Database server takes up the load of processing any database related activity and the client does any validation aspect of database. As the work is distributed between the entities it increases scalability and reliability. Second, the network traffic also comes down as compared to file server. For example if you are requesting customers from India, database server will sort/ filter and send only Indian customer details to the client, thus bringing down the network traffic tremendously. SQL SERVER follows the client-server architecture.&lt;/p&gt;&lt;BR&gt; &lt;p align="center"&gt;&amp;nbsp;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 198px;" src="http://3.bp.blogspot.com/_WxhoysBC8gY/SmAg-SyfktI/AAAAAAAAAD0/7SdvYn9c3g8/s400/image005.jpg" border="0" alt=""id="ravifirst.blogspot.com" /&gt;&lt;/p&gt;&lt;BR&gt;&lt;div class="caption"&gt;&lt;BR&gt; &lt;p align="center"&gt;Figure 1.3: Client Server Architecture of SQL SERVER&lt;/div&gt;&lt;BR&gt;&lt;BR&gt;&lt;ul&gt;&lt;BR&gt;&lt;li&gt;The second issue comes in terms of reliability. In Access, the client directly interacts with the Access file, in case there is some problem in the middle of a transaction, there are chances that an Access file can get corrupt. But in SQL SERVER, the engine sits in between the client and the database, so in case of any problems in the middle of a transaction, it can revert back to its original state.&lt;br /&gt;&lt;strong&gt;Note: &lt;/strong&gt;SQL SERVER maintains a transaction log by which you can revert back to your original state in case of any crash.&lt;/li&gt;&lt;BR&gt;&lt;BR&gt;&lt;li&gt;When your application has to cater to a huge load demand, highly transactional environment and high concurrency, then its better to go for SQL SERVER or MSDE.&lt;/li&gt;&lt;BR&gt;&lt;BR&gt;&lt;li&gt;But when it comes to cost and support, Access stands better than SQL SERVER. In case of SQL SERVER, you have to pay for per client license, but Access runtime is free.&lt;/li&gt;&lt;BR&gt;&lt;/ul&gt;&lt;BR&gt;&lt;BR&gt;&lt;p&gt;&lt;strong&gt;Summarizing: &lt;/strong&gt;SQL SERVER gains points in terms of network traffic, reliability and scalability whereas Access gains points in terms of cost factor.&lt;/p&gt;&lt;BR&gt;&lt;BR&gt;&lt;h3&gt;&lt;a name="WhatisthedifferencebetweenMSDEandSQLSERVER2000tcWhatsthedifferencebetweenMSDEandSQLSERVER2000"&gt;(Q) What is the Difference between MSDE and SQL SERVER 2000?&lt;/a&gt;&lt;/h3&gt;&lt;BR&gt;&lt;BR&gt;&lt;p&gt;MSDE is a royalty free, redistributable and cut short version of the giant SQL SERVER database. It is primarily provided as a low cost option for developers who need a database server, which can easily be shipped and installed. It can serve as a good alternative for Microsoft Access database as it overcomes quite a few problems which Access has. &lt;/p&gt;&lt;BR&gt;&lt;BR&gt;&lt;p&gt;Below is a complete list, which can give you a good idea of the differences:&lt;/p&gt;&lt;BR&gt;&lt;BR&gt;&lt;ul&gt;&lt;BR&gt;&lt;li&gt;&lt;strong&gt;Size of database: &lt;/strong&gt;Microsoft Access and MSDE have a limitation of 2GB while SQL SERVER has 1,048,516 TB1.&lt;/li&gt;&lt;BR&gt;&lt;BR&gt;&lt;li&gt;Performance degrades in MSDE 2000 when maximum number of concurrent operations goes above 8 or is equal to 8. It does not mean that you cannot have more than eight concurrent operations but the performance degrades. Eight-connection performance degradation is implemented by using SQL SERVER 2000 workload governor (we will be looking into more detail of how it works). As compared to SQL SERVER 2000, you can have 32,767 concurrent connections.&lt;/li&gt;&lt;BR&gt;&lt;BR&gt;&lt;li&gt;MSDE does not provide OLAP and Data warehousing capabilities.&lt;/li&gt;&lt;BR&gt;&lt;BR&gt;&lt;li&gt;MSDE does not have support facility for SQL mail.&lt;/li&gt;&lt;BR&gt;&lt;BR&gt;&lt;li&gt;MSDE 2000 does not have GUI administrative tool such as enterprise manager, Query analyzer or Profiler. But there are roundabout ways by which you can manage MSDE 2000:&lt;/li&gt;&lt;BR&gt;&lt;BR&gt;&lt;ul&gt;&lt;BR&gt;&lt;li&gt;Old command line utility &lt;em&gt;OSQL.EXE&lt;/em&gt;&lt;/li&gt;&lt;BR&gt;&lt;BR&gt;&lt;li&gt;VS.NET IDE Server Explorer: Inside VS.NET IDE, you have a functionality which can give you a nice GUI administrative tool to manage IDE.&lt;/li&gt;&lt;BR&gt;&lt;BR&gt;&lt;li&gt;SQL SERVER WEB Data administrator installs a web based GUI which you can use to manage your database. &lt;br /&gt;For any details refer &lt;a href="http://www.microsoft.com/downloads/details.aspx?familyid=c039a798-c57a- 419e-acbc-2a332cb7f959&amp;amp;displaylang=en"&gt;here&lt;/a&gt;.&lt;/li&gt;&lt;BR&gt;&lt;/ul&gt;&lt;BR&gt;&lt;BR&gt;&lt;li&gt;SQL-DMO objects can be used to build your custom UI&lt;/li&gt;&lt;BR&gt;&lt;BR&gt;&lt;li&gt;There are many third party tools, which provide administrative capability GUI, which is out of scope of the book as it is only meant for interview questions. &lt;/li&gt;&lt;BR&gt;&lt;BR&gt;&lt;li&gt;MSDE does not support Full text search.&lt;/li&gt;&lt;BR&gt;&lt;/ul&gt;&lt;BR&gt;&lt;BR&gt;&lt;p&gt;&lt;strong&gt;Summarizing: &lt;/strong&gt;There are two major differences: The first is the size limitation (2 GB) of the database and second is the concurrent connections (eight concurrent connections) which are limited by using the workload governor. During an interview, this answer will suffice if the interviewer is really testing your knowledge.&lt;/p&gt;&lt;BR&gt;&lt;BR&gt;&lt;h3&gt;&lt;a name="WhatisSQLSERVERExpress2005EditiontcWhatisSQLSERVERExpress2005Edition"&gt;(Q) What is SQL SERVER Express 2005 Edition?&lt;/a&gt;&lt;/h3&gt;&lt;BR&gt;&lt;BR&gt;&lt;p&gt;Twist: What is the difference between SQL SERVER Express 2005 and MSDE 2000?&lt;/p&gt;&lt;BR&gt;&lt;BR&gt;&lt;p&gt;&lt;strong&gt;Note: &lt;/strong&gt;Normally comparison is when the product is migrating from one version to other version. When SQL SERVER 7.0 was migrating to SQL 2000, asking differences was one of the favorite questions. &lt;/p&gt;&lt;BR&gt;&lt;BR&gt;&lt;p&gt;SQL SERVER Express edition is a scaled down version of SQL SERVER 2005 and the next evolution of MSDE. &lt;/p&gt;&lt;BR&gt;&lt;BR&gt;&lt;p&gt;Listed below are some major differences between them:&lt;/p&gt;&lt;BR&gt;&lt;BR&gt;&lt;ul&gt;&lt;BR&gt;&lt;li&gt;MSDE maximum database size is 2GB while SQL SERVER Express has around 4GB.&lt;/li&gt;&lt;BR&gt;&lt;BR&gt;&lt;li&gt;In terms of programming language support MSDE has only TSQL, but SQLSERVER Express has TSQL and .NET. In SQL SERVER Express 2005, you can write your stored procedures using .NET.&lt;/li&gt;&lt;BR&gt;&lt;BR&gt;&lt;li&gt;SQL SERVER Express does not have connection limitation, which MSDE had and was controlled through the workload governor.&lt;/li&gt;&lt;BR&gt;&lt;BR&gt;&lt;li&gt;There was no XCOPY support for MSDE, SQL SERVER Express has it.&lt;/li&gt;&lt;BR&gt;&lt;BR&gt;&lt;li&gt;DTS is not present in SQL SERVER express while MSDE has it.&lt;/li&gt;&lt;BR&gt;&lt;BR&gt;&lt;li&gt;SQL SERVER Express has reporting services while MSDE does not.&lt;/li&gt;&lt;BR&gt;&lt;BR&gt;&lt;li&gt;SQL SERVER Express has native XML support and MSDE does not.&lt;/li&gt;&lt;BR&gt;&lt;/ul&gt;&lt;BR&gt;&lt;BR&gt;&lt;p&gt;Note: Native XML support means now in SQL SERVER 2005:&lt;/p&gt;&lt;BR&gt;&lt;BR&gt;&lt;ul&gt;&lt;BR&gt;&lt;li&gt;You can create a field with data type &lt;code&gt;XML&lt;/code&gt;.&lt;/li&gt;&lt;BR&gt;&lt;BR&gt;&lt;li&gt;You can provide SCHEMA to the SQL SERVER fields with &lt;code&gt;XML&lt;/code&gt; data type.&lt;/li&gt;&lt;BR&gt;&lt;BR&gt;&lt;li&gt;You can use new XML manipulation techniques like &lt;code&gt;XQUERY&lt;/code&gt; also called as &lt;code&gt;XML QUERY&lt;/code&gt;.&lt;/li&gt;&lt;BR&gt;&lt;/ul&gt;&lt;BR&gt;&lt;BR&gt;&lt;p&gt;There is a complete chapter on SQL SERVER XML Support, so till then this will suffice.&lt;/p&gt;&lt;BR&gt;&lt;BR&gt;&lt;p&gt;&lt;strong&gt;Summarizing:&lt;/strong&gt; The major difference is the database size (2 GB and 4 GB), support of .NET support in stored procedures and native support for XML. This much can convince the interviewer that you are clear about the differences.&lt;/p&gt;&lt;BR&gt;&lt;BR&gt;&lt;h3&gt;&lt;a name="DBWhatisSQLServer2000WorkloadGovernortcDBWhatisSQLServer2000WorkloadGovernor"&gt;(DB) What is SQL Server 2000 Workload Governor?&lt;/a&gt;&lt;/h3&gt;&lt;BR&gt;&lt;BR&gt;&lt;p&gt;Workload governor limits the performance of SQL SERVER Desktop engine (MSDE) if the SQL engine receives more load than what is meant for MSDE. MSDE was always meant for trial purpose and non-critical projects. Microsoft always wanted companies to buy their full blow version of SQL SERVER, so in order that they can put limitation on MSDE performance and number of connections, they introduced Workload governor.&lt;/p&gt;&lt;BR&gt;&lt;BR&gt;&lt;p&gt;Workload governor sits between the client and the database engine and counts the number of connections per database instance. If Workload governor finds that the number of connections exceeds eight connections, it starts stalling the connections and slowing down the database engine. &lt;/p&gt;&lt;BR&gt;&lt;BR&gt;&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; It does not limit the number of connections but makes the connection request go slow. By default 32,767 connections are allowed both for SQL SERVER and MSDE. But it just makes the database engine go slow above eight connections.&lt;/p&gt;&lt;BR&gt;&lt;BR&gt;&lt;h3&gt;&lt;a name="WhatisthedifferencebetweenSQLSERVER2000and2005tcWhatsthedifferencebetweenSQLSERVER2000and2005"&gt;What is the Difference between SQL SERVER 2000 and 2005?&lt;/a&gt;&lt;/h3&gt;&lt;BR&gt;&lt;BR&gt;&lt;p&gt;Twist: What is the difference between Yukon and SQL SERVER 2000? &lt;/p&gt;&lt;BR&gt;&lt;BR&gt;&lt;p&gt;&lt;strong&gt;Note: &lt;/strong&gt;This question will be one of the favorites during SQL SERVER interviews. I have marked the points which should be mentioned by developers as PG and DBA for Database Administrator.&lt;/p&gt;&lt;BR&gt;&lt;BR&gt;&lt;p&gt;Following are some major differences between the two versions:&lt;/p&gt;&lt;BR&gt;&lt;BR&gt;&lt;ul&gt;&lt;BR&gt;&lt;li&gt;(PG) The most significant change is the .NET integration with SQL SERVER 2005. Stored procedures, user-defined functions, triggers, aggregates, and user-defined types can now be written using your own favorite .NET language (VB.NET, C#, J# etc.). This support was not there in SQL SERVER 2000 where the only language was T-SQL. In SQL 2005, you have support for two languages T-SQL and .NET.&lt;/li&gt;&lt;BR&gt;&lt;BR&gt;&lt;li&gt;(PG) SQL SERVER 2005 has reporting services for reports which is a newly added feature and does not exist for SQL SERVER 2000. It was a separate installation for SQL Server 2000.&lt;/li&gt;&lt;BR&gt;&lt;BR&gt;&lt;li&gt;(PG) SQL SERVER 2005 has introduced two new data types &lt;code&gt;varbinary (max)&lt;/code&gt; and &lt;code&gt;XML&lt;/code&gt;. If you remember in SQL SERVER 2000, we had image and text data types. Problem with &lt;code&gt;image &lt;/code&gt;and &lt;code&gt;text &lt;/code&gt;data types is that they assign the same amount of storage irrespective of what the actual data size is. This problem is solved using &lt;code&gt;varbinary (max) &lt;/code&gt;which acts depending on amount of data. One more new data type is included &lt;code&gt;XML&lt;/code&gt; which enables you to store XML documents and does schema verification. In SQL SERVER 2000, developers used &lt;code&gt;varchar &lt;/code&gt;or &lt;code&gt;text &lt;/code&gt;data type and all validation had to be done programmatically.&lt;/li&gt;&lt;BR&gt;&lt;BR&gt;&lt;li&gt;(PG) SQL SERVER 2005 can now process direct incoming HTTP request without IIS Web server. In addition, stored procedure invocation is enabled using the SOAP protocol.&lt;/li&gt;&lt;BR&gt;&lt;BR&gt;&lt;li&gt;(PG) Asynchronous mechanism is introduced using server events. In Server event model the server posts an event to the SQL Broker service, later the client can come and retrieve the status by querying the broker.&lt;/li&gt;&lt;BR&gt;&lt;BR&gt;&lt;li&gt;For huge databases, SQLSERVER has provided a cool feature called “Data partitioning”. In data partitioning, you break a single database object such as a table or an index into multiple pieces. But for the client application accessing the single database object, “partitioning” is transparent.&lt;/li&gt;&lt;BR&gt;&lt;BR&gt;&lt;li&gt;In SQL SERVER 2000, if you rebuilt clustered indexes even the non-clustered indexes where rebuilt. But in SQL SERVER 2005 building the clustered indexes does not build the non-clustered indexes.&lt;/li&gt;&lt;BR&gt;&lt;BR&gt;&lt;li&gt;Bulk data uploading in SQL SERVER 2000 was done using BCP (Bulk copy program’s) format files. Now in SQL SERVER 2005 bulk, data uploading uses XML file format.&lt;/li&gt;&lt;BR&gt;&lt;BR&gt;&lt;li&gt;In SQL SERVER 2000 there were maximum 16 instances, but in 2005 you can have up to 50 instances.&lt;/li&gt;&lt;BR&gt;&lt;BR&gt;&lt;li&gt;SERVER 2005 has support of “Multiple Active Result Sets” also called as “MARS”. In previous versions of SQL SERVER 2000 in one connection, you could only have one result set. Now in one SQL connection, you can query and have multiple results set.&lt;/li&gt;&lt;BR&gt;&lt;BR&gt;&lt;li&gt;In previous versions of SQL SERVER 2000, system catalog was stored in the master database. In SQL SERVER 2005, it’s stored in a resource database which is stored as sys object. You cannot access the sys object directly as in the older version we were accessing the master database.&lt;/li&gt;&lt;BR&gt;&lt;BR&gt;&lt;li&gt;This is one of the hardware benefits which SQL SERVER 2005 has over SQSERVER 2000 – support of hyper threading. WINDOWS 2003 supports hyper threading; SQL SERVER 2005 can take advantage of the feature unlike SQL SERVER 2000 which did not support hyper threading.&lt;br /&gt;&lt;strong&gt;Note: &lt;/strong&gt;Hyper threading is a technology developed by INTEL which creates two logical processors on a single physical hardware processor.&lt;/li&gt;&lt;BR&gt;&lt;BR&gt;&lt;li&gt;SMO will be used for SQL Server Management.&lt;/li&gt;&lt;BR&gt;&lt;BR&gt;&lt;li&gt;AMO (Analysis Management Objects) to manage Analysis Services servers, data sources, cubes, dimensions, measures, and data mining models. You can mapm AMO in old SQL SERVER with DSO (Decision Support Objects).&lt;/li&gt;&lt;BR&gt;&lt;BR&gt;&lt;li&gt;Replication is now managed by RMO (Replication Management Objects).&lt;br /&gt;&lt;strong&gt;Note: &lt;/strong&gt;SMO, AMO and RMO are all using .NET Framework.&lt;/li&gt;&lt;BR&gt;&lt;BR&gt;&lt;li&gt;SQL SERVER 2005 uses current user execution context to check rights rather than ownership link chain, which was done in SQL SERVER 2000.&lt;br /&gt;&lt;strong&gt;Note: &lt;/strong&gt;There is a question on this later see for execution context questions.&lt;/li&gt;&lt;BR&gt;&lt;BR&gt;&lt;li&gt;In previous versions of SQL SERVER the schema and the user name was same, but in current, the schema is separated from the user. Now the user owns schema.&lt;br /&gt;&lt;strong&gt;Note:&lt;/strong&gt; There are questions on this, refer “Schema” later.&lt;br /&gt;&lt;strong&gt;Note: &lt;/strong&gt;Ok below are some GUI changes.&lt;/li&gt;&lt;BR&gt;&lt;BR&gt;&lt;li&gt;Query analyzer is now replaced by query editor.&lt;/li&gt;&lt;BR&gt;&lt;BR&gt;&lt;li&gt;Business Intelligence development studio will be used to create Business intelligence solutions.&lt;/li&gt;&lt;BR&gt;&lt;BR&gt;&lt;li&gt;OSQL and ISQL command line utility is replaced by SQLCMD utility.&lt;/li&gt;&lt;BR&gt;&lt;BR&gt;&lt;li&gt;SQL SERVER Enterprise manager is now replaced by SQL SERVER Management studio.&lt;/li&gt;&lt;BR&gt;&lt;BR&gt;&lt;li&gt;SERVER Manager which was running in system tray is now replaced by SQL Computer manager.&lt;/li&gt;&lt;BR&gt;&lt;BR&gt;&lt;li&gt;Database mirror concept is supported in SQL SERVER 2005, which was not present in SQL SERVER 2000.&lt;/li&gt;&lt;BR&gt;&lt;BR&gt;&lt;li&gt;In SQL SERVER 2005 Indexes can be rebuilt online when the database is in actual production. If you look back in SQL SERVER 2000, you cannot do insert, update, and delete operations when you are building indexes.&lt;/li&gt;&lt;BR&gt;&lt;BR&gt;&lt;li&gt;(PG) Other than Serializable, Repeatable Read, Read Committed, and Read Uncommitted isolation levels, there is one more new isolation level “Snapshot Isolation level”.&lt;br /&gt;&lt;strong&gt;Note: &lt;/strong&gt;We will see “Snapshot Isolation level” in detail in the coming questions.&lt;/li&gt;&lt;BR&gt;&lt;/ul&gt;&lt;BR&gt;&lt;BR&gt;&lt;p&gt;&lt;strong&gt;Summarizing: &lt;/strong&gt;The major significant difference between SQL SERVER 2000 and SQL SERVER 2005 is in terms of support of .NET Integration, Snap shot isolation level, Native XML support, handling HTTP request, Web service support and Data partitioning. You do not have to really say all the above points during an interview. A sweet summary and you will rock.&lt;/p&gt;&lt;BR&gt;&lt;BR&gt;&lt;h3&gt;&lt;a name="WhatareERdiagramstcWhatareERdiagrams"&gt;(Q) What are E-R diagrams?&lt;/a&gt;&lt;/h3&gt;&lt;BR&gt;&lt;BR&gt;&lt;p&gt;E-R diagram also termed as Entity-Relationship diagram shows the relationship between various tables in the database. Example: Tables &lt;code&gt;Customer&lt;/code&gt; and &lt;code&gt;Customer Addresses&lt;/code&gt; have a one to many relationship (i.e. one customer can have multiple addresses) this can be shown using the ER diagram. ER diagrams are drawn during the initial stages of a project to forecast how the database structure will shape up. Below is a screen shot of a sample ER diagram of “Asset Management” which ships free with Access.&lt;/p&gt;&lt;BR&gt; &lt;p align="center"&gt;&lt;BR&gt; &lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 356px;" src="http://4.bp.blogspot.com/_WxhoysBC8gY/SmAg--_C09I/AAAAAAAAAD8/pkbgaIex35Q/s400/image007.jpg" border="0" alt=""id="ravifirst.blogspot.com" /&gt;&lt;BR&gt; &lt;/p&gt;&lt;BR&gt;&lt;div class="caption"&gt;&lt;BR&gt; &lt;p align="center"&gt;Figure 1.4: Asset management ER diagram.&lt;/div&gt;&lt;BR&gt;&lt;BR&gt;&lt;h3&gt;&lt;a name="(Q)_How_many_types_of_relationship_exist_in_database_designingtc_How_many_types_of_Howmanytypes ofrelationshipexistindatabasedesigningtc Howmanytypesofrelationshipexistindatabasedesigningrelationshipexistindatabasedesigning"&gt;(Q) How many Types of Relationship Exist in Database Designing?&lt;/a&gt;&lt;/h3&gt;&lt;BR&gt;&lt;BR&gt;&lt;p&gt;There are three major relationship models:&lt;/p&gt;&lt;BR&gt;&lt;BR&gt;&lt;ul&gt;&lt;BR&gt;&lt;li&gt;&lt;BR&gt;&lt;p align="center"&gt;One-to-one &lt;br /&gt;&lt;br /&gt;&lt;BR&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 354px; height: 368px;" src="http://1.bp.blogspot.com/_WxhoysBC8gY/SmAg_K8uCVI/AAAAAAAAAEE/ttVeH1Cl5A8/s400/image009.jpg" border="0" alt=""id="ravifirst.blogspot.com" /&gt;&lt;BR&gt;&lt;/p&gt;&lt;BR&gt;&lt;div class="Caption"&gt;&lt;BR&gt; &lt;p align="center"&gt;Figure 1.5: One-to-One relationship ER diagram&lt;/div&gt;&lt;BR&gt;&lt;/li&gt;&lt;BR&gt;&lt;BR&gt;&lt;li&gt;One-to-many&lt;br /&gt;In this many records in one table correspond to the one record in another table. &lt;br /&gt;Example: Every one customer can have multiple sales. So there exist one-to-many relationships between customer and sales table. &lt;BR&gt;&lt;p&gt;One &lt;code&gt;Asset&lt;/code&gt; can have multiple &lt;code&gt;Maintenance&lt;/code&gt;. So &lt;code&gt;Asset&lt;/code&gt; entity has one-to-many relationship between them as the ER model shows below. &lt;/p&gt;&lt;BR&gt;&lt;p align="center"&gt;&lt;BR&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 391px; height: 358px;" src="http://1.bp.blogspot.com/_WxhoysBC8gY/SmAg_MPWRII/AAAAAAAAAEM/1NCVQeDB2Yk/s400/image011.jpg" border="0" alt=""id="ravifirst.blogspot.com/image011" /&gt;&lt;BR&gt;&lt;/p&gt;&lt;BR&gt;&lt;div class="caption"&gt;&lt;BR&gt; &lt;p align="center"&gt;Figure 1.6: One-to-Many Relationship ER diagram&lt;/div&gt;&lt;BR&gt;&lt;/li&gt;&lt;BR&gt;&lt;BR&gt;&lt;li&gt;Many-to-many&lt;br /&gt;In this, one record in one table corresponds to many rows in another table and also vice-versa. &lt;br /&gt;For instance: In a company, one employee can have many skills like Java , C# etc. and also one skill can belong to many employees. &lt;BR&gt;&lt;p&gt;Given below is a sample of many-to-many relationship. One employee can have knowledge of multiple &lt;code&gt;Technology&lt;/code&gt;. So in order to implement this, we have one more table &lt;code&gt;Employee Technology&lt;/code&gt; which is linked to the primary key of &lt;code&gt;Employee&lt;/code&gt; and &lt;code&gt;Technology&lt;/code&gt; table.&lt;/p&gt;&lt;BR&gt;&lt;p align="center"&gt;&lt;BR&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 307px;" src="http://2.bp.blogspot.com/_WxhoysBC8gY/SmAhQtV9j0I/AAAAAAAAAEU/eZVw0j86Vsc/s400/image013.jpg" border="0" alt="ravifirst.blogspot.com/image013" id="ravifirst013" /&gt;&lt;BR&gt;&lt;/p&gt;&lt;BR&gt;&lt;div class="caption"&gt;&lt;BR&gt; &lt;p align="center"&gt;Figure 1.7: Many-to-Many Relationship ER diagram&lt;/div&gt;&lt;BR&gt;&lt;/li&gt;&lt;BR&gt;&lt;/ul&gt;&lt;BR&gt;&lt;BR&gt;&lt;h3&gt;&lt;a name="WhatisnormalizationWhataredifferenttypeofnormalizationtcWhatisnormalizationWhataredifferenttypeofnormalization"&gt;(Q) What is Normalization? What are the Different Types of Normalization?&lt;/a&gt;&lt;/h3&gt;&lt;BR&gt;&lt;BR&gt;&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; A regular .NET programmer working on projects often stumbles on this question, which is but obvious. The bad part is sometimes the interviewer can take this as a very basic question to be answered and it can be a turning point for the interview. So let's cram it.&lt;/p&gt;&lt;BR&gt;&lt;BR&gt;&lt;p&gt;It is set of rules that have been established to aid in the design of tables that are meant to be connected through relationships. This set of rules is known as Normalization.&lt;/p&gt;&lt;BR&gt;&lt;BR&gt;&lt;p&gt;Benefits of Normalizing your database include:&lt;/p&gt;&lt;BR&gt;&lt;BR&gt;&lt;ul&gt;&lt;BR&gt;&lt;li&gt;Avoiding repetitive entries &lt;/li&gt;&lt;BR&gt;&lt;BR&gt;&lt;li&gt;Reducing required storage space &lt;/li&gt;&lt;BR&gt;&lt;BR&gt;&lt;li&gt;Preventing the need to restructure existing tables to accommodate new data&lt;/li&gt;&lt;BR&gt;&lt;BR&gt;&lt;li&gt;Increased speed and flexibility of queries, sorts, and summaries&lt;/li&gt;&lt;BR&gt;&lt;/ul&gt;&lt;BR&gt;&lt;BR&gt;&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: During an interview, people expect to answer a maximum of three normal forms and that's what is expected practically. Actually you can normalize database to fifth normal form. But believe this book, answering three normal forms will put you in a decent shape during an interview.&lt;/p&gt;&lt;BR&gt;&lt;BR&gt;&lt;p&gt;The three normal forms as follows:&lt;/p&gt;&lt;BR&gt;&lt;BR&gt;&lt;h4&gt;First Normal Form&lt;/h4&gt;&lt;BR&gt;&lt;BR&gt;&lt;p&gt;For a table to be in first normal form, data must be broken up into the smallest units possible. In addition to breaking data up into the smallest meaningful values, tables in first normal form should not contain repetitions groups of fields. &lt;/p&gt;&lt;BR&gt; &lt;p align="center"&gt;&lt;BR&gt; &lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 86px;" src="http://3.bp.blogspot.com/_WxhoysBC8gY/SmAhQghKQEI/AAAAAAAAAEc/sK7Kq7h4P2s/s400/image015.jpg" border="0" alt="ravifirst.blogspot.com/imageo15" id="ravifirst015" /&gt;&lt;BR&gt; &lt;/p&gt;&lt;BR&gt;&lt;div class="caption"&gt;&lt;BR&gt; &lt;p align="center"&gt;Figure 1.8: Repeating groups example&lt;/div&gt;&lt;BR&gt;&lt;BR&gt;&lt;p&gt;In the above example, &lt;code&gt;city1 &lt;/code&gt;and &lt;code&gt;city2 &lt;/code&gt;are repeating. In order for these tables to be in First normal form, you have to modify the table structure as follows. Also note that the Customer Name is now broken down to first name and last name (First normal form data should be broken down to the smallest unit).&lt;/p&gt;&lt;BR&gt; &lt;p align="center"&gt;&lt;BR&gt; &lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 114px;" src="http://4.bp.blogspot.com/_WxhoysBC8gY/SmAhREWFcMI/AAAAAAAAAEk/AsYFQbPMa5c/s400/image017.jpg" border="0" alt="ravifirst.blogspot.com/images017" id="ravifirst017" /&gt;&lt;BR&gt; &lt;/p&gt;&lt;BR&gt;&lt;div class="Caption"&gt;&lt;BR&gt; &lt;p align="center"&gt;Figure 1.9: Customer table normalized to first normal form&lt;/div&gt;&lt;BR&gt;&lt;BR&gt;&lt;h4&gt;Second Normal Form&lt;/h4&gt;&lt;BR&gt;&lt;BR&gt;&lt;p&gt;The second normal form states that each field in a multiple field primary key table must be directly related to the entire primary key. In other words, each non-key field should be a fact about all the fields in the primary key.&lt;/p&gt;&lt;BR&gt;&lt;BR&gt;&lt;p&gt;In the above table of &lt;code&gt;customer&lt;/code&gt;, &lt;code&gt;city &lt;/code&gt;is not linked to any primary field.&lt;/p&gt;&lt;BR&gt; &lt;p align="center"&gt;&lt;BR&gt; &lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 111px;" src="http://1.bp.blogspot.com/_WxhoysBC8gY/SmAhRRSFgdI/AAAAAAAAAEs/ZhiNLKO64vE/s400/image019.jpg" border="0" alt="ravifirst.blogspot.com/image019" id="ravifirst019" /&gt;&lt;/p&gt;&lt;BR&gt; &lt;div class="caption"&gt;&lt;BR&gt;  &lt;p align="center"&gt;Figure 1.10: Normalized customer table.&lt;br&gt;&lt;BR&gt;  &lt;br&gt;&lt;BR&gt;&amp;nbsp;&lt;/div&gt;&lt;BR&gt; &lt;p align="center"&gt;&lt;BR&gt; &lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 144px; height: 127px;" src="http://2.bp.blogspot.com/_WxhoysBC8gY/SmAhRsJFhuI/AAAAAAAAAE0/CQi7pJoJlkw/s400/image021.jpg" border="0" alt="ravifirst.blogspot.com/image021" id="ravifirst021" /&gt;&lt;BR&gt; &lt;/p&gt;&lt;BR&gt;&lt;div class="caption"&gt;&lt;BR&gt; &lt;p align="center"&gt;Figure 1.11: City is now shifted to a different master table.&lt;/div&gt;&lt;BR&gt;&lt;BR&gt;&lt;p&gt;&lt;br&gt;&lt;BR&gt;That takes our database to a second normal form.&lt;/p&gt;&lt;BR&gt;&lt;BR&gt;&lt;h4&gt;Third Normal Form&lt;/h4&gt;&lt;BR&gt;&lt;BR&gt;&lt;p&gt;A non-key field should not depend on another Non-key field. The field &lt;code&gt;Total&lt;/code&gt; is dependent on &lt;code&gt;Unit price&lt;/code&gt; and &lt;code&gt;qty&lt;/code&gt;.&lt;/p&gt;&lt;BR&gt; &lt;p align="center"&gt;&lt;BR&gt; &lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 113px;" src="http://2.bp.blogspot.com/_WxhoysBC8gY/SmAheF1r_oI/AAAAAAAAAE8/X47fPO5cRVI/s400/image023.jpg" border="0" alt="ravifirst.blogspot.com/image023" id="image23" /&gt;&lt;BR&gt; &lt;/p&gt;&lt;BR&gt;&lt;div class="caption"&gt;Figure 1.12: Fill third normal form&lt;/div&gt;&lt;BR&gt;&lt;BR&gt;&lt;p&gt;So now the &lt;code&gt;Total&lt;/code&gt; field is removed and is the multiplication of &lt;code&gt;Unit price * Qty&lt;/code&gt;.&lt;/p&gt;&lt;BR&gt;&lt;BR&gt;&lt;h3&gt;&lt;a name="WhatisdenormalizationtcWhatisdenormalization"&gt;(Q) What is Denormalization? &lt;/a&gt;&lt;/h3&gt;&lt;BR&gt;&lt;BR&gt;&lt;p&gt;Denormalization is the process of putting one fact in numerous places (it is vice-versa of normalization). Only one valid reason exists for denormalizing a relational design - to enhance performance. The sacrifice to performance is that you increase redundancy in a database.&lt;/p&gt;&lt;BR&gt;&lt;BR&gt;&lt;h3&gt;&lt;a name="DBCanyouexplainFourthNormalFormtcDBCanyouexplainFourthNormalForm"&gt;(DB) Can you Explain Fourth Normal Form?&lt;/a&gt;&lt;/h3&gt;&lt;BR&gt;&lt;BR&gt;&lt;p&gt;&lt;strong&gt;Note: &lt;/strong&gt;Whenever the interviewer is trying to go above the third normal form, there can be two reasons, ego or to fail you. Three normal forms are really enough, practically anything more than that is an overdose.&lt;/p&gt;&lt;BR&gt;&lt;BR&gt;&lt;p&gt;In fourth normal form, it should not contain two or more independent multi-valued facts about an entity and it should satisfy “Third Normal form”. &lt;/p&gt;&lt;BR&gt;&lt;BR&gt;&lt;p class="BtextNormal" align="left"&gt;So let us try to see what multi-valued facts are. If there are two or more many-to-many relationship in one entity and they tend to come to one place, it is termed as “multi-valued facts”.&lt;/p&gt;&lt;BR&gt; &lt;p align="center"&gt;&lt;BR&gt; &lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 284px; height: 116px;" src="http://2.bp.blogspot.com/_WxhoysBC8gY/SmAheVCKqkI/AAAAAAAAAFE/tca-8In8cWE/s400/image025.jpg" border="0" alt="ravifirst.blogspot.com/image025" id="image025" /&gt;&lt;BR&gt; &lt;/p&gt;&lt;BR&gt;&lt;div class="Caption"&gt;&lt;BR&gt; &lt;p align="center"&gt;Figure 1.13: Multi-valued facts&lt;/div&gt;&lt;BR&gt;&lt;BR&gt;&lt;p&gt;In the above table, you can see that there are two many-to-many relationships between &lt;code&gt;Supplier&lt;/code&gt; / &lt;code&gt;Product&lt;/code&gt; and “&lt;code&gt;Supplier &lt;/code&gt;/ &lt;code&gt;Location&lt;/code&gt; (or in short multi-valued facts). In order for the above example to satisfy the fourth normal form, both the many-to-many relationships should go in different tables.&lt;/p&gt;&lt;BR&gt; &lt;p align="center"&gt;&lt;BR&gt; &lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 377px; height: 114px;" src="http://1.bp.blogspot.com/_WxhoysBC8gY/SmAheg1cgCI/AAAAAAAAAFM/4QTPU2nTrlM/s400/image027.jpg" border="0" alt="ravifirst.blogspot.com/image027" id="image027" /&gt; &lt;BR&gt; &lt;/p&gt;&lt;BR&gt;&lt;div class="caption"&gt;&lt;BR&gt; &lt;p align="center"&gt;Figure 1.14: Normalized to Fourth Normal form.&lt;/div&gt;&lt;BR&gt;&lt;BR&gt;&lt;h3&gt;&lt;a name="CanyouexplainFifthNormalFormDBCanyouexplainFifthNormalForm"&gt;(DB) Can you Explain Fifth Normal Form?&lt;/a&gt;&lt;/h3&gt;&lt;BR&gt;&lt;BR&gt;&lt;p&gt;&lt;strong&gt;Note: &lt;/strong&gt;UUUHHH if you get this question after joining the company, do ask him if he himself really uses it?&lt;/p&gt;&lt;BR&gt;&lt;BR&gt;&lt;p&gt;Fifth normal form deals with reconstructing information from smaller pieces of information. These smaller pieces of information can be maintained with less redundancy.&lt;/p&gt;&lt;BR&gt;&lt;BR&gt;&lt;p&gt;Example: &lt;code&gt;Dealers&lt;/code&gt; sell &lt;code&gt;Product&lt;/code&gt; which can be manufactured by various &lt;code&gt;Companies&lt;/code&gt;. &lt;code&gt;Dealers&lt;/code&gt; in order to sell the &lt;code&gt;Product&lt;/code&gt; should be registered with the &lt;code&gt;Company&lt;/code&gt;. So these three entities have a mutual relationship within them.&lt;/p&gt;&lt;BR&gt; &lt;p align="center"&gt;&lt;BR&gt; &lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 359px; height: 106px;" src="http://4.bp.blogspot.com/_WxhoysBC8gY/SmAhe5qS1KI/AAAAAAAAAFU/zz-5H2nHaUI/s400/image029.jpg" border="0" alt="ravifirst.blogspot.com/image029" id="image029" /&gt;&lt;BR&gt; &lt;/p&gt;&lt;BR&gt;&lt;div class="caption"&gt;&lt;BR&gt; &lt;p align="center"&gt;Figure 1.15: Not in Fifth Normal Form.&lt;/div&gt;&lt;BR&gt;&lt;BR&gt;&lt;p&gt;The above table shows some sample data. If you observe closely, a single record is created using lot of small information. For instance: &lt;code&gt;JM Associate&lt;/code&gt; can sell sweets under the following two conditions:&lt;/p&gt;&lt;BR&gt;&lt;BR&gt;&lt;ul&gt;&lt;BR&gt;&lt;li&gt;&lt;code&gt;JM Associate&lt;/code&gt; should be an authorized dealer of &lt;code&gt;Cadbury&lt;/code&gt;&lt;/li&gt;&lt;BR&gt;&lt;BR&gt;&lt;li&gt;&lt;code&gt;Sweets&lt;/code&gt; should be manufactured by &lt;code&gt;Cadbury&lt;/code&gt; company&lt;/li&gt;&lt;BR&gt;&lt;/ul&gt;&lt;BR&gt;&lt;BR&gt;&lt;p&gt;These two smaller bits of information form one record of the above given table. So in order for the above information to be “Fifth Normal Form” all the smaller information should be in three different places. Below is the complete fifth normal form of the database.&lt;/p&gt;&lt;BR&gt; &lt;p align="center"&gt;&lt;BR&gt; &lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 185px;" src="http://2.bp.blogspot.com/_WxhoysBC8gY/SmAhfKcHRTI/AAAAAAAAAFc/CCJeLq3t8pw/s400/image031.jpg" border="0" alt="ravifirst.blogspot.com/image031" id="image031" /&gt;&lt;BR&gt; &lt;/p&gt;&lt;BR&gt;&lt;div class="caption"&gt;&lt;BR&gt; &lt;p align="center"&gt;Figure 1.16: Complete Fifth Normal Form&lt;/div&gt;&lt;BR&gt;&lt;BR&gt;&lt;h3&gt;&lt;a name="WhatisthedifferencebetweenFourthandFifthnormalformtcDBWhatsthedifferencebetweenFourthandFifthnormalform"&gt;(DB) What is the Difference between Fourth and Fifth normal form?&lt;/a&gt;&lt;/h3&gt;&lt;BR&gt;&lt;BR&gt;&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; There is a huge similarity between Fourth and Fifth normal form, i.e. they address the problem of “Multi-Valued facts”.&lt;/p&gt;&lt;BR&gt;&lt;BR&gt;&lt;p&gt;“Fifth normal form” multi-valued facts are interlinked and “Fourth normal form” values are independent. For instance in the above two questions &lt;code&gt;Supplier&lt;/code&gt;/&lt;code&gt;Product&lt;/code&gt; and &lt;code&gt;Supplier&lt;/code&gt;/&lt;code&gt;Location&lt;/code&gt; are not linked. While in fifth form, the &lt;code&gt;Dealer&lt;/code&gt;/&lt;code&gt;Product&lt;/code&gt;/&lt;code&gt;Companies&lt;/code&gt; are completely linked.&lt;/p&gt;&lt;BR&gt;&lt;BR&gt;&lt;h3&gt;&lt;a name="HaveyouheardaboutsixthnormalformtcDBHaveyouheardaboutsixthnormalform"&gt;(DB) Have you Heard about Sixth Normal Form?&lt;/a&gt;&lt;/h3&gt;&lt;BR&gt;&lt;BR&gt;&lt;p&gt;&lt;strong&gt;Note: &lt;/strong&gt;Arrrrggghhh yes there exists a sixth normal form also. But note guys you can skip this statement. Just in case you want to impress the interviewer...&lt;/p&gt;&lt;BR&gt;&lt;BR&gt;&lt;p&gt;If you want a relational system in conjunction with time, you use sixth normal form. At this moment SQL Server does not support it directly.&lt;/p&gt;&lt;BR&gt;&lt;BR&gt;&lt;h3&gt;&lt;a name="WhatisExtentandPagetcWhatisExtentandPage"&gt;(Q) What is Extent and Page?&lt;/a&gt;&lt;/h3&gt;&lt;BR&gt;&lt;BR&gt;&lt;p&gt;Twist: What is the relationship between Extent and Page?&lt;/p&gt;&lt;BR&gt;&lt;BR&gt;&lt;p&gt;Extent is a basic unit of storage to provide space for tables. Every extent has a number of data pages. As new records are inserted new data, pages are allocated. There are eight data pages in an extent. So as soon as the eight pages are consumed, it allocates a new extent with data pages. &lt;/p&gt;&lt;BR&gt;&lt;BR&gt;&lt;p&gt;While extent is basic unit storage from a database point of view, page is a unit of allocation within extent.&lt;/p&gt;&lt;BR&gt;&lt;BR&gt;&lt;h3&gt;&lt;a name="DBWhatarethedifferentsectionsinPagetcDBWhatarethedifferentsectionsinPage"&gt;(DB) What are the Different Sections in Page?&lt;/a&gt;&lt;/h3&gt;&lt;BR&gt;&lt;BR&gt;&lt;p&gt;Page has three important sections: &lt;/p&gt;&lt;BR&gt;&lt;BR&gt;&lt;ul&gt;&lt;BR&gt;&lt;li&gt;Page header&lt;/li&gt;&lt;BR&gt;&lt;BR&gt;&lt;li&gt;Actual data i.e. Data row&lt;/li&gt;&lt;BR&gt;&lt;BR&gt;&lt;li&gt;Row pointers or Row offset&lt;/li&gt;&lt;BR&gt;&lt;/ul&gt;&lt;BR&gt;&lt;BR&gt;&lt;p&gt;Page header has information like timestamp, next page number, previous page number etc. &lt;/p&gt;&lt;BR&gt;&lt;BR&gt;&lt;p&gt;Data rows are where your actual row data is stored. For every data row, there is a row offset which points to that data row.&lt;/p&gt;&lt;BR&gt; &lt;p align="center"&gt;&lt;BR&gt; &lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 397px; height: 391px;" src="http://2.bp.blogspot.com/_WxhoysBC8gY/SmAhr3gkhDI/AAAAAAAAAFk/XiDo5il_aQI/s400/image033.jpg" border="0" alt="ravifirst.blogspot.com/image033" id="image033" /&gt; &lt;BR&gt; &lt;/p&gt;&lt;BR&gt;&lt;div class="caption"&gt;&lt;BR&gt; &lt;p align="center"&gt;Figure 1.17: General view of a Extent&lt;/div&gt;&lt;BR&gt;&lt;BR&gt;&lt;h3&gt;&lt;a name="WhatarepagesplitstcWhatarepagesplits"&gt;(Q) What are Page Splits?&lt;/a&gt;&lt;/h3&gt;&lt;BR&gt;&lt;BR&gt;&lt;p&gt;Pages are contained in extent. Every extent will have around eight data pages. But all the eight data pages are not created at once; they are created depending on data demand. So when a page becomes full it creates a new page, this process is called as “Page Split”.&lt;/p&gt;&lt;BR&gt;&lt;BR&gt;&lt;h3&gt;&lt;a name="InwhichfilesdoesactuallySQLServerstoredatatcInwhichfilesdoesactuallySQLServerstoredata"&gt;(Q) In which Files does SQL Server Actually Store Data?&lt;/a&gt;&lt;/h3&gt;&lt;BR&gt;&lt;BR&gt;&lt;p&gt;Any SQL Server database is associated with two kinds of files: &lt;em&gt;*.mdf&lt;/em&gt; and &lt;em&gt;*.ldf&lt;/em&gt;. &lt;em&gt;*.mdf&lt;/em&gt; files are actual physical database files where your data is stored finally.&lt;em&gt; *.ldf&lt;/em&gt; (LOG) files are actually data, which is recorded from the last time data was committed in the database.&lt;/p&gt;&lt;BR&gt; &lt;p align="center"&gt;&lt;BR&gt; &lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 292px;" src="http://2.bp.blogspot.com/_WxhoysBC8gY/SmAhrxwEQYI/AAAAAAAAAFs/2vGnFyN6T0Q/s400/image035.jpg" border="0" alt="ravifirst.blogspot.com/image035" id="image035" /&gt; &lt;BR&gt; &lt;/p&gt;&lt;BR&gt;&lt;div class="caption"&gt;&lt;BR&gt; &lt;p align="center"&gt;Figure 1.18: MDF and LDF files.&lt;/div&gt;&lt;BR&gt;&lt;BR&gt;&lt;h3&gt;(Q) What is Collation in SQL Server?&lt;/h3&gt;&lt;BR&gt;&lt;BR&gt;&lt;p&gt;Collation refers to a set of rules that determine how data is sorted and compared. Character data is sorted using rules that define the correct character sequence, with options for specifying case-sensitivity, accent marks, kana character types, and character width.&lt;/p&gt;&lt;BR&gt; &lt;p align="center"&gt;&lt;BR&gt; &lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 228px;" src="http://3.bp.blogspot.com/_WxhoysBC8gY/SmAhss3OiNI/AAAAAAAAAF0/DcC7zI-nVDI/s400/image037.jpg" border="0" alt="ravifirst.blogspot.com/image031" id="image031" /&gt;&lt;BR&gt; &lt;/p&gt;&lt;BR&gt;&lt;div class="caption"&gt;&lt;BR&gt; &lt;p align="center"&gt;Figure 1.19: Collation according to language&lt;/div&gt;&lt;BR&gt;&lt;BR&gt;&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; Different languages will have different sort orders.&lt;/p&gt;&lt;BR&gt;&lt;BR&gt;&lt;h4&gt;Case Sensitivity&lt;/h4&gt;&lt;BR&gt;&lt;BR&gt;&lt;p&gt;If &lt;code&gt;A&lt;/code&gt; and &lt;code&gt;a&lt;/code&gt;, &lt;code&gt;B&lt;/code&gt; and &lt;code&gt;b&lt;/code&gt;, etc. are treated in the same way, then it is case-insensitive. A computer treats &lt;code&gt;A&lt;/code&gt; and &lt;code&gt;a&lt;/code&gt; differently because it uses ASCII code to differentiate the input. The ASCII value of &lt;code&gt;A&lt;/code&gt; is 65, while &lt;code&gt;a&lt;/code&gt; is 97. The ASCII value of &lt;code&gt;B&lt;/code&gt; is 66 and &lt;code&gt;b&lt;/code&gt; is 98.&lt;/p&gt;&lt;BR&gt;&lt;BR&gt;&lt;h4&gt;Accent Sensitivity&lt;/h4&gt;&lt;BR&gt;&lt;BR&gt;&lt;p&gt;If &lt;code&gt;a&lt;/code&gt; and &lt;code&gt;A&lt;/code&gt;, &lt;code&gt;o&lt;/code&gt; and &lt;code&gt;O&lt;/code&gt; are treated in the same way, then it is accent-insensitive. A computer treats &lt;code&gt;a&lt;/code&gt; and &lt;code&gt;A&lt;/code&gt; differently because it uses ASCII code for differentiating the input. The ASCII value of &lt;code&gt;a&lt;/code&gt; is 97 and &lt;code&gt;A&lt;/code&gt; 225. The ASCII value of &lt;code&gt;o&lt;/code&gt; is 111 and &lt;code&gt;O&lt;/code&gt; is 243.&lt;/p&gt;&lt;BR&gt;&lt;BR&gt;&lt;h4&gt;Kana Sensitivity&lt;/h4&gt;&lt;BR&gt;&lt;BR&gt;&lt;p&gt;When Japanese kana characters Hiragana and Katakana are treated differently, it is called Kana sensitive. &lt;/p&gt;&lt;BR&gt;&lt;BR&gt;&lt;h4&gt;Width Sensitivity&lt;/h4&gt;&lt;BR&gt;&lt;BR&gt;&lt;p&gt;When a single-byte character (half-width) and the same character when represented as a double-byte character (full-width) are treated differently then it is width sensitive.&lt;/p&gt;&lt;BR&gt;&lt;BR&gt;&lt;h3&gt;&lt;a name="DBCanwehaveadifferentcollationfordatabaseandtabletcDBCanwehaveadifferentcollationfordatabaseandtable"&gt;(DB) Can We Have a Different Collation for Database and Table?&lt;/a&gt;&lt;/h3&gt;&lt;BR&gt;&lt;BR&gt;&lt;p&gt;Yes, you can specify different collation sequence for both the entities differently.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7848011355253090856-523832060794893318?l=ravifirst.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ravifirst.blogspot.com/feeds/523832060794893318/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ravifirst.blogspot.com/2009/07/sql-server-interview-questions.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/523832060794893318'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/523832060794893318'/><link rel='alternate' type='text/html' href='http://ravifirst.blogspot.com/2009/07/sql-server-interview-questions.html' title='SQL Server Interview Questions'/><author><name>Ravi's</name><uri>http://www.blogger.com/profile/14359502815484562942</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_WxhoysBC8gY/StgCRfR-X5I/AAAAAAAAAJQ/l5Cd32MA2kk/S220/Rlogo.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_WxhoysBC8gY/SmAewIFxIDI/AAAAAAAAADk/is99E2ODy9E/s72-c/image001.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7848011355253090856.post-7774941142240689134</id><published>2009-07-16T13:52:00.002+05:30</published><updated>2009-07-16T13:56:49.219+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='n-tier'/><category scheme='http://www.blogger.com/atom/ns#' term='.NET RIA services'/><category scheme='http://www.blogger.com/atom/ns#' term='RIA'/><category scheme='http://www.blogger.com/atom/ns#' term='what is .net ria services'/><category scheme='http://www.blogger.com/atom/ns#' term='ASP.NET'/><category scheme='http://www.blogger.com/atom/ns#' term='.NER RIA'/><category scheme='http://www.blogger.com/atom/ns#' term='SILVER LIGHT'/><category scheme='http://www.blogger.com/atom/ns#' term='mid-tier'/><title type='text'>what is .NET RIA service</title><content type='html'>Microsoft .NET RIA Services simplifies the traditional n-tier application pattern by bringing together the ASP.NET and Silverlight platforms. The RIA Services provides a pattern to write application logic that runs on the mid-tier and controls access to data for queries, changes and custom operations. It also provides end-to-end support for common tasks such as data validation, authentication and roles by integrating with Silverlight components on the client and ASP.NET on the mid-tier.&lt;br /&gt;&lt;br /&gt; Get more information &lt;a href="http://go.microsoft.com/fwlink/?LinkID=144687"&gt; here &lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7848011355253090856-7774941142240689134?l=ravifirst.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ravifirst.blogspot.com/feeds/7774941142240689134/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ravifirst.blogspot.com/2009/07/what-is-net-ria-service.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/7774941142240689134'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/7774941142240689134'/><link rel='alternate' type='text/html' href='http://ravifirst.blogspot.com/2009/07/what-is-net-ria-service.html' title='what is .NET RIA service'/><author><name>Ravi's</name><uri>http://www.blogger.com/profile/14359502815484562942</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_WxhoysBC8gY/StgCRfR-X5I/AAAAAAAAAJQ/l5Cd32MA2kk/S220/Rlogo.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7848011355253090856.post-3356209353776655967</id><published>2009-07-16T13:44:00.004+05:30</published><updated>2009-07-16T13:50:37.077+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='silverlight 2'/><category scheme='http://www.blogger.com/atom/ns#' term='offline capabilities'/><category scheme='http://www.blogger.com/atom/ns#' term='ria development'/><category scheme='http://www.blogger.com/atom/ns#' term='printing support in silverlight'/><category scheme='http://www.blogger.com/atom/ns#' term='RIA'/><category scheme='http://www.blogger.com/atom/ns#' term='asp.net with silverlight'/><category scheme='http://www.blogger.com/atom/ns#' term='silverlight 3'/><category scheme='http://www.blogger.com/atom/ns#' term='capabilities of silverlight'/><category scheme='http://www.blogger.com/atom/ns#' term='web camera support in silverlight'/><title type='text'>capabilities of Silverlight</title><content type='html'>&lt;span style="font-weight:bold;"&gt; offline capabilities&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;   Silverlight 2 doesn’t support offline scenario out of box. While you can run an html file that contains a Silverlight application from the local file system, there are several restrictions:&lt;br /&gt;&lt;br /&gt;    * Cannot access resources in the local file system other than the folder and subfolders the hosting html file is in.&lt;br /&gt;&lt;br /&gt;    * Cannot use any web related features, such as calling web service.&lt;br /&gt;&lt;br /&gt;    * Cannot access online medias such as images and videos hosted in any web site.&lt;br /&gt;&lt;br /&gt;Silverlight 3 will add more offline capabilities, such as the out of browser feature.&lt;br /&gt;&lt;br /&gt;Another interesting scenario is occasionally connected environment. In such an environment, your application supports both online and offline features. When the internet connection works, you can get the latest data from the internet. When the internet connection is lost, you can still work with data that has been downloaded to the local device. You can modify the data in the local device, and once the internet connection is restored, the local data can be synched to the cloud.&lt;br /&gt;&lt;br /&gt;Silverlight doesn’t offer this capability out of box, but you can use Live Services. It allows you to run a Silverlight application out of the browser, and yet be able to call web services since it’s still in the http protocol. It also supports the above occasionally connected scenario without much effort from your part. The data will be stored in cloud and synched among every device the user owns, such as the Live Desktop in the cloud, a PC, a Mac, and a mobile device.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Does Silverlight support web camera and printing?&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Unfortunately, Silverlight doesn’t support web camera yet. You can print the containing web page, which will include the Silverlight application’s content if it is currently visible. Features such as print areas beyond the visible areas in a ScrollViewer are not supported yet.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7848011355253090856-3356209353776655967?l=ravifirst.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ravifirst.blogspot.com/feeds/3356209353776655967/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ravifirst.blogspot.com/2009/07/capabilities-of-silverlight.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/3356209353776655967'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/3356209353776655967'/><link rel='alternate' type='text/html' href='http://ravifirst.blogspot.com/2009/07/capabilities-of-silverlight.html' title='capabilities of Silverlight'/><author><name>Ravi's</name><uri>http://www.blogger.com/profile/14359502815484562942</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_WxhoysBC8gY/StgCRfR-X5I/AAAAAAAAAJQ/l5Cd32MA2kk/S220/Rlogo.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7848011355253090856.post-1076132263350726864</id><published>2009-07-16T13:35:00.004+05:30</published><updated>2009-07-16T13:44:04.400+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='AJAX instead of silverlight'/><category scheme='http://www.blogger.com/atom/ns#' term='asp.net vs silverlight'/><category scheme='http://www.blogger.com/atom/ns#' term='silverlight'/><category scheme='http://www.blogger.com/atom/ns#' term='asp.net with silverlight'/><category scheme='http://www.blogger.com/atom/ns#' term='AJAX vs silverlight'/><title type='text'>ASP.NET and SILVERLIGHT in action</title><content type='html'>A common question, when to use Silverlight, ASP.NET or both. This depends on different scenarios.  Here are some common approaches:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Pure Silverlight.&lt;/span&gt;&lt;br /&gt;       One approach is to completely remove ASP.NET, this solution works best if you’re working on a new development. You only need to work on Silverlight, without any worry about integration problems. If you need to communicate with the server, you write web services, such as WCF. It will also help you when you need to port part of or the whole of your system to other hostings or even other platforms, since the client and the server are completely separate.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;ASP.NET plus a Silverlight island.&lt;/span&gt;&lt;br /&gt;      This approach is generally used when the Silverlight content and the ASP.NET content have little relationship. For example, an ASP.NET blog engine with a Silverlight media player in a blog post. This approach is very easy to implement, and allows you to reach the broadest audience. For example, if a user hasn’t installed Silverlight, he can still read the blog posts, but he can’t watch the videos.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Use ASP.NET AJAX instead of Silverlight&lt;/span&gt;&lt;br /&gt;     ASP.NET AJAX is designed to work with ASP.NET. It is mainly an extension to ASP.NET. While AJAX can’t provide you the advance user experience that Silverlight can, for many scenarios, it should be sufficient. This approach also helps if you have strong ASP.NET experience, but  are still quite new to Silverlight.&lt;br /&gt;&lt;br /&gt;     Within this approach, there are two branches. One is to mix the client and server code by using UpdatePanel, AJAX Control Toolkit, and etc.  The other method is to take the pure AJAX approach, where you write html and JavaScript instead of using Server Controls, and call web services to communicate with the server. The former branch is easier to implement, especially if you have strong ASP.NET experience, but lack JavaScript knowledge. The latter branch proves to be better in architecture when you want to port the AJAX application to other technologies such as Silverlight.  Especially since you only need to rewrite the client side code, and can keep the web services as they are. The programming model for the later branch is similar to Silverlight. Therefore, this approach is rarely taken if you’re experienced in Silverlight.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Silverlight with ASP.NET.&lt;/span&gt;&lt;br /&gt;     More often, you may want to port an existing ASP.NET application to Silverlight, but you don’t want to completely rewrite the entire application. This is the most difficult approach since you’re mixing client side and server side technologies.&lt;br /&gt;&lt;br /&gt;     Before going with this approach, please consider if the above approaches can solve your problem. Ask yourself the following questions:&lt;br /&gt;&lt;br /&gt;      1. Do you really need a rich interactive user experience?   &lt;br /&gt;&lt;br /&gt;This is normally a requirement for consumer oriented applications, but for most business applications, you only need a “good” user experience, which AJAX is sufficient to provide.&lt;br /&gt;&lt;br /&gt;      2. Can you add Silverlight islands to your existing ASP.NET application instead of mixing the contents?&lt;br /&gt;&lt;br /&gt;This should work for most scenarios. For example, Windows Live Mail is built in ASP.NET, with a few Silverlight islands, such as a slide show program that allows you to view photo attachments with enhanced experience (actually most Microsoft created web applications takes this approach).&lt;br /&gt;&lt;br /&gt;       3. Will this be a good chance to revise your architecture?&lt;br /&gt;&lt;br /&gt;Most traditional ASP.NET applications use the B/S or three tire architecture, in which the application works with a database either directly, or through a business logic layer. When porting applications to other platforms, these architectures will introduce many problems. When investigating Silverlight, it is also a good chance to adopt SOA. Add a service facade layer on top of the business logic layer, and you can work with the services from almost any client, such as an ASP.NET application and a Silverlight application. If you are already on SOA, it should be trivial to port to Silverlight, since you only need to rewrite a client application. With SOA, the ASP.NET AJAX approach and the Silverlight island approach will also be much easier to implement.&lt;br /&gt;&lt;br /&gt;    If none of the above approaches is suitable, you may have to mix Silverlight content with ASP.NET. When using this approach, keep in mind that Silverlight can’t call ASP.NET server side event handlers, and each post back (either partial or complete) will cause the Silverlight application to reload.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7848011355253090856-1076132263350726864?l=ravifirst.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ravifirst.blogspot.com/feeds/1076132263350726864/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ravifirst.blogspot.com/2009/07/aspnet-and-silverlight-in-action.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/1076132263350726864'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/1076132263350726864'/><link rel='alternate' type='text/html' href='http://ravifirst.blogspot.com/2009/07/aspnet-and-silverlight-in-action.html' title='ASP.NET and SILVERLIGHT in action'/><author><name>Ravi's</name><uri>http://www.blogger.com/profile/14359502815484562942</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_WxhoysBC8gY/StgCRfR-X5I/AAAAAAAAAJQ/l5Cd32MA2kk/S220/Rlogo.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7848011355253090856.post-712646651270776994</id><published>2009-07-16T13:27:00.002+05:30</published><updated>2009-07-16T13:35:18.404+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='asp.net vs silverlight'/><category scheme='http://www.blogger.com/atom/ns#' term='silverlight'/><category scheme='http://www.blogger.com/atom/ns#' term='silverlight rendering engine'/><category scheme='http://www.blogger.com/atom/ns#' term='ASP.NET'/><category scheme='http://www.blogger.com/atom/ns#' term='xaml'/><category scheme='http://www.blogger.com/atom/ns#' term='web services'/><category scheme='http://www.blogger.com/atom/ns#' term='HTML'/><category scheme='http://www.blogger.com/atom/ns#' term='client side rendering'/><title type='text'>ASP.NET vs SILVERLIGHT</title><content type='html'>Technically, Silverlight and ASP.NET are completely different.  The major differences are as listed below:&lt;br /&gt;&lt;br /&gt;    * Silverlight runs completely on the client, while ASP.NET mainly runs on the server, but also has a few parts running on the client.&lt;br /&gt;&lt;br /&gt;    * When an event fires, Silverlight handles the event on the client, but in ASP.NET, the browser will make an HTTP POST to the server, and after the server handles the request, it sends a new html page to the client.&lt;br /&gt;&lt;br /&gt;    * A Silverlight application sends rendering commands to the Silverlight rendering engine by either write XAML or code, and the Silverlight rendering engine will handle the rendering task. On the other hand, ASP.NET doesn’t have a rendering engine. It generates an html file on the server, sends it to the client, and allows the browser to parse the html file and render the content.&lt;br /&gt;&lt;br /&gt;    * Silverlight can’t work with a database directly, instead it consumes data from web services, while ASP.NET has strong support in working with database directly.&lt;br /&gt;&lt;br /&gt;     The most important fact to remember is what runs on the client, and what runs on the server, since this will affect almost every part of your system. Silverlight runs on the client, and ASP.NET runs on the server. They can work together and are compatible with each other, but this requires some time and effort.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7848011355253090856-712646651270776994?l=ravifirst.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ravifirst.blogspot.com/feeds/712646651270776994/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ravifirst.blogspot.com/2009/07/aspnet-vs-silverlight.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/712646651270776994'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7848011355253090856/posts/default/712646651270776994'/><link rel='alternate' type='text/html' href='http://ravifirst.blogspot.com/2009/07/aspnet-vs-silverlight.html' title='ASP.NET vs SILVERLIGHT'/><author><name>Ravi's</name><uri>http://www.blogger.com/profile/14359502815484562942</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_WxhoysBC8gY/StgCRfR-X5I/AAAAAAAAAJQ/l5Cd32MA2kk/S220/Rlogo.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7848011355253090856.post-5270198133369533546</id><published>2009-07-16T13:24:00.002+05:30</published><updated>2009-07-16T13:27:50.305+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='silverlight 2'/><category scheme='http://www.blogger.com/atom/ns#' term='flash vs silverlight'/><category scheme='http://www.blogger.com/atom/ns#' term='flash animations in silverlight'/><category scheme='http://www.blogger.com/atom/ns#' term='motion tween in silverlight'/><category scheme='http://www.blogger.com/atom/ns#' term='motion tween expression blend'/><category scheme='http://www.blogger.com/atom/ns#' term='silverlight 3'/><category scheme='http://www.blogger.com/atom/ns#' term='motion tween with expression blend'/><category scheme='http://www.blogger.com/atom/ns#' term='SILVER LIGHT'/><title type='text'>Flash vs SILVERLIGHT</title><content type='html'>A common question from designers is “What’s the difference between animation in Flash and Silverlight, and how do I migrate a Flash animation to Silverlight?” Here are the major differences:&lt;br /&gt;&lt;br /&gt;    * In Silverlight, there is no main timeline. You need to create a timeline manually and start the animation in code. This is the most significant difference. Future versions of Expression Blend will improve on this area so that designers will not need to worry about the code.&lt;br /&gt;&lt;br /&gt;    * In Silverlight, you can create more than one timeline. This is similar to Flex, but different from Flash, where you may have to create more scenes to add more timelines.&lt;br /&gt;&lt;br /&gt;    * In Expression Blend, motion tweens are added automatically when you add a new key frame.&lt;br /&gt;&lt;br /&gt;    * In Silverlight, you cannot dynamically add a
