<?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-7243287038504660386</id><updated>2011-04-21T15:19:26.761-07:00</updated><category term='indexes'/><category term='Normalization'/><category term='FAQS'/><category term='StoredProcedures'/><category term='CONSTRAINT'/><category term='Framework'/><category term='SQL Server'/><title type='text'>ADO.NET</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://adobytescode.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7243287038504660386/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://adobytescode.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>ZeroCode</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>18</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-7243287038504660386.post-4407649013173362234</id><published>2009-02-23T15:34:00.000-08:00</published><updated>2009-02-23T15:43:44.947-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='FAQS'/><category scheme='http://www.blogger.com/atom/ns#' term='Framework'/><title type='text'>Anonymous Methods in C# 2.0</title><content type='html'>&lt;b&gt;Introduction&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;C# 2.0 (and .NET in general) introduces the anonymous method. An anonymous method can be used anywhere a delegate is used and is defined inline, without a method name, with optional parameters and a method body.To use anonymous methods, you need to know what a delegate is.&lt;br /&gt;Anonymous methods are a condensed way to declare and use delegates.delegates are the next evolution of raw function pointers. A delegate is a class that encapsulates the pointer; implicitly, delegates in .NET are multicast delegates. To be a multicast delegate simply means that the "one function to one pointer" limitation is gone, because the multicast delegate class contains a list of pointers&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Anonymous Methods Are Inline Delegates&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Generally, when we're using delegates, we have a method. That method's signature matches the signature prescribed by a delegate and can be used to initialize a delegate instance. Anonymous methods are used to condense the method and initialization of the delegate into a single location.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&lt;br /&gt;private void Form1_Load(object sender, EventArgs e)&lt;br /&gt;{&lt;br /&gt;button1.Click += delegate&lt;br /&gt;{&lt;br /&gt;Debug.WriteLine("button1 clicked");&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Anonymous methods can be used wherever delegates are expected. Anonymous methods can use ref and out arguments, but cannot reference ref or out parameters of an outer scope. Anonymous methods can't use unsafe code, and anonymous methods can't use goto, break, or continue in such a way that the branch behavior causes a branch outside of the anonymous method's code block&lt;br /&gt;&lt;br /&gt;Are anonymous methods a good thing? The marketing material says that anonymous methods are good because they reduce code overhead caused by instantiating delegates and reducing separate methods. But the marketing material also says that anonymous methods increase usability and maintainability.&lt;br /&gt;&lt;br /&gt;EXAMPLE:&lt;br /&gt;Does this code look easily maintainable?&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;private void Form1_Load(object sender, EventArgs e)&lt;br /&gt;{&lt;br /&gt;BindClick(delegate { Debug.WriteLine("button1 click"); });&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;private void BindClick(EventHandler handler)&lt;br /&gt;{&lt;br /&gt;button1.Click += handler;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;In this sample, we're passing a delegate to a method by passing the delegate as an anonymous method. Just keeping the order and number of the parentheses, semicolons, and brackets straight is a pain in the neck.&lt;br /&gt;&lt;br /&gt;The cited classic example is that anonymous methods can reduce the overhead of creating delegates and methods just for kicking off threads (which use delegates). This is true, but threads are used infrequently and are already difficult enough to use correctly; I wonder how prudent it is to make the code more esoteric rather than less.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Summary&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Anonymous methods are examples of methods without names that can be defined and used anywhere a delegate can be used. Delegates are wrappers for event handlers. How practical and generally useful anonymous methods are remains to be seen.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7243287038504660386-4407649013173362234?l=adobytescode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://adobytescode.blogspot.com/feeds/4407649013173362234/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7243287038504660386&amp;postID=4407649013173362234' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7243287038504660386/posts/default/4407649013173362234'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7243287038504660386/posts/default/4407649013173362234'/><link rel='alternate' type='text/html' href='http://adobytescode.blogspot.com/2009/02/anonymous-methods-in-c-20.html' title='Anonymous Methods in C# 2.0'/><author><name>ZeroCode</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7243287038504660386.post-8346378054824435394</id><published>2007-12-26T03:00:00.000-08:00</published><updated>2007-12-26T03:01:28.466-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SQL Server'/><title type='text'>SQL-syntax</title><content type='html'>CREATING A DATABASE&lt;br /&gt;&lt;br /&gt;CREATE DATABASECREATE DATABASE database_nameCREATE DATABASECREATE DATABASE database_name&lt;br /&gt;[ON { [PRIMARY](NAME = logical_name,FILENAME ='physical_name'[,SIZE = size][,MAXSIZE = max_size  UNLIMITED][,FILEGROWTH = growth_increment])}[,...n]][LOG ON{(NAME = logical _name,FILENAME = 'physical_name'[,SIZE=size  UNLIMITED][,MAXSIZE = max_size  UNLIMITED][,FILEGROWTH = growth_increment])}[,...n]][FOR LOAD  FOR ATTACH]&lt;br /&gt;&lt;br /&gt;MODIFYING DATABASE&lt;br /&gt;&lt;br /&gt;MODIFYING DATABASE ALTER DATABASE database&lt;br /&gt;{ ADD FILE &lt;file&gt;[,...n] [TO FILEGROUP filegroup_name] ADD LOG FILE &lt;file&gt;[,...n] REMOVE FILE logical_name ADD FILEGROUP filegroup_name REMOVE FILEGROUP filegroup_name MODIFY FILE &lt;file&gt; MODIFY FILEGROUP filegroup_name, filegroup_property}&lt;file&gt;(NAME = logical_name,FILENAME ='physical_name'[,SIZE = size][,MAXSIZE = max_size UNLIMITED][,FILEGROWTH = growth_increment])&lt;br /&gt;&lt;br /&gt;CREATING TABLES&lt;br /&gt;&lt;br /&gt;CREATE TABLE table_name&lt;br /&gt;(&lt;br /&gt;column_name datatype [Null / Not Null]&lt;br /&gt;[IDENTITY (SEED, INCREMENT)&lt;br /&gt;[DEFAULT constraint_expression]&lt;br /&gt;)&lt;br /&gt;&lt;br /&gt;Constraints:Constraints:&lt;br /&gt;&lt;br /&gt;Primary Key Constraint&lt;br /&gt;Foreign Key Constraint&lt;br /&gt;Unique Key Constraint&lt;br /&gt;Check Constraint&lt;br /&gt;Default Constraint&lt;br /&gt;&lt;br /&gt;MODIFYING A TABLE&lt;br /&gt;&lt;br /&gt;ALTER TABLE table_name&lt;br /&gt;[WITH CHECK WITH NO CHECK]&lt;br /&gt;ADD column_name data_type * Adding a Column&lt;br /&gt;[DROP COLUMN column_name] * Dropping a Column&lt;br /&gt;&lt;br /&gt;CREATING TABLES WITH CONSTRAINTS&lt;br /&gt;&lt;br /&gt;CREATE TABLE table_name&lt;br /&gt;(&lt;br /&gt;column_name data_type CONSTRAINT constraint_name constraint_type [,…N]&lt;br /&gt;)&lt;br /&gt;&lt;br /&gt;ALTER TABLE table_name&lt;br /&gt;*Adding constraint&lt;br /&gt;ADD CONSTRAINT constraint_name constraint_type(column_name)&lt;br /&gt;*Dropping constraint&lt;br /&gt;Drop CONSTRAINT constraint_name&lt;br /&gt;DROPPING A TABLE&lt;br /&gt;DROP TABLE table_name [,…n]&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;SELECT STATEMENT&lt;br /&gt;&lt;br /&gt;SELECT [ ALL  DISTINCT ][ TOP n [PERCENT] [ WITH TIES] ]&lt;br /&gt;&lt;select_list&gt;&lt;br /&gt;[ INTO new_table ]&lt;br /&gt;[ FROM &lt;table_sources&gt;]&lt;br /&gt;[ WHERE &lt;search_condition&gt;]&lt;br /&gt;[ GROUP BY [ALL] group_by_expression [,...n]&lt;br /&gt;[ WITH { CUBE  ROLLUP } ]]&lt;br /&gt;[ HAVING &lt;search_condition&gt;]&lt;br /&gt;[ ORDER BY { column_name [ ASC  DESC ] } [,...n] ]&lt;br /&gt;[ COMPUTE { { AVG  COUNT  MAX  MIN  SUM }(expression)}[,.n]&lt;br /&gt;[ BY expression [,...n] ]&lt;br /&gt;[ FOR BROWSE ] [ OPTION (&lt;query_hint&gt; [,...n) ] QUERYING AND REPORTING&lt;br /&gt;Selecting Columns&lt;br /&gt;SELECT column_name1[,column_name2]&lt;br /&gt;FROM table_name&lt;br /&gt;&lt;br /&gt;Selecting All Columns&lt;br /&gt;SELECT * FROM table_name&lt;br /&gt;&lt;br /&gt;Manipulating Column Names&lt;br /&gt;SELECT column_name ‘column_alias’&lt;br /&gt;[, column_name ‘column_alias’]&lt;br /&gt;FROM table_name&lt;br /&gt;Or&lt;br /&gt;SELECT column_alias = column_name&lt;br /&gt;[, column_alias = column_name]&lt;br /&gt;FROM table_name&lt;br /&gt;STORED PROCEDURE&lt;br /&gt;&lt;br /&gt;Creating Stored Procedures&lt;br /&gt;CREATE PROC[EDURE] procedure_name [ ; number ] [ @parameter data_type [,@parameter data_type] [ = default [ OUTPUT ] ][ WITH { RECOMPILE  ENCRYPTION &lt;br /&gt;RECOMPILE , ENCRYPTION } ] AS sql_statement [ ...n ]&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Modifying a Stored Procedures&lt;br /&gt;ALTER PROC[EDURE] procedure_name [ ; number ] [ @parameter data_type [,@parameter data_type] [ = default [ OUTPUT ] ][ WITH { RECOMPILE  ENCRYPTION &lt;br /&gt;RECOMPILE , ENCRYPTION } ] AS sql_statement [ ...n ]&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Viewing a Stored Procedure&lt;br /&gt;Sp_help – listed the various procedures created in a DB&lt;br /&gt;Sp_helptext – displays the definition of the procedure&lt;br /&gt;Deleting a Stored Procedure&lt;br /&gt;DROP PROCEDURE procedure_name [,..n]TRIGGERS&lt;br /&gt;&lt;br /&gt;Creating Triggers&lt;br /&gt;CREATE TRIGGER trigger_name&lt;br /&gt;ON table_name&lt;br /&gt;FOR {INSERT  DELETE  UPDATE }&lt;br /&gt;[WITH ENCRYPTION]&lt;br /&gt;AS&lt;br /&gt;sql_statements&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Modifying Triggers&lt;br /&gt;ALTER TRIGGER trigger_name&lt;br /&gt;ON table_name&lt;br /&gt;FOR {INSERT  DELETE  UPDATE }&lt;br /&gt;[WITH ENCRYPTION]&lt;br /&gt;AS&lt;br /&gt;sql_statements&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Viewing a Triggers&lt;br /&gt;Sp_help – listed the various triggers created in a DB&lt;br /&gt;Sp_helptext – displays the definition of the triggers&lt;br /&gt;Deleting a Triggers&lt;br /&gt;DROP TRIGGER trigger_name [,..n] FUNCTIONS&lt;br /&gt;&lt;br /&gt;Creating a Function&lt;br /&gt;CREATE FUNCTION [ owner_name. ] function_name ( [ { @parameter_name [AS] scalar_parameter_data_type [ = default ] } [ ,...n ] ] )&lt;br /&gt;RETURNS scalar_return_data_type&lt;br /&gt;[ WITH &lt;&gt; [ [,] ...n] ]&lt;br /&gt;[ AS ]&lt;br /&gt;BEGIN function_body RETURN scalar_expressionEND&lt;br /&gt;&lt;br /&gt;Altering a Function&lt;br /&gt;ALTER FUNCTION [ owner_name. ] function_name ( [ { @parameter_name scalar_parameter_data_type [ = default ] } [ ,...n ] ] )&lt;br /&gt;RETURNS scalar_return_data_type&lt;br /&gt;[ WITH &lt;&gt; [,...n] ]&lt;br /&gt;[ AS ]&lt;br /&gt;BEGIN function_body RETURN scalar_expressionEND&lt;br /&gt;&lt;br /&gt;Drop Function&lt;br /&gt;DROP FUNCTION { [ owner_name . ] function_name } [ ,...n ]&lt;br /&gt;VIEWS&lt;br /&gt;&lt;br /&gt;Creating Views&lt;br /&gt;CREATE VIEW owner.view_name [(column [,n])]&lt;br /&gt;[WITH {ENCRYPTION &lt;br /&gt;SCHEMABINDING &lt;br /&gt;VIEW_METADATA} [,N]]&lt;br /&gt;AS&lt;br /&gt;select_statement&lt;br /&gt;[WITH CHECK OPTION] Altering Views&lt;br /&gt;ALTER VIEW owner.view_name [(column [,n])]&lt;br /&gt;[WITH {ENCRYPTION &lt;br /&gt;SCHEMABINDING &lt;br /&gt;VIEW_METADATA} [,N]]&lt;br /&gt;AS&lt;br /&gt;select_statement&lt;br /&gt;[WITH CHECK OPTION]&lt;br /&gt;&lt;br /&gt;Renaming a View&lt;br /&gt;Sp_rename old_view_name new_view_name&lt;br /&gt;Prints the text of rule, a default, or an unencrypted stored procedure, user-defined function, trigger, or view&lt;br /&gt;Sp_helptext object_name&lt;br /&gt;Getting Information on a View&lt;br /&gt;Sysobjects or information_schema.tables : View names&lt;br /&gt;Sysdepends or information_schema.view_table_usage : Base object names&lt;br /&gt;Syscomments or information_schema.views : View definition&lt;br /&gt;Syscolumns or information_schema.view_column_usage : columns that are defined in a view&lt;br /&gt;MANIPULATION DATA&lt;br /&gt;&lt;br /&gt;INSERTING ROWS&lt;br /&gt;&lt;br /&gt;INSERT [INTO] {table_name} [(column_list)]&lt;br /&gt;VALUES {DEFAULT VALUES  values_list  Select_statement&lt;br /&gt;&lt;br /&gt;DELETING ROWS&lt;br /&gt;&lt;br /&gt;DELETE [FROM] {table_name}&lt;br /&gt;[WHERE condition]&lt;br /&gt;UPDATING ROWS&lt;br /&gt;&lt;br /&gt;UPDATE {table_name}&lt;br /&gt;SET column_name = value&lt;br /&gt;FROM table_name&lt;br /&gt;WHERE condition&lt;br /&gt;&lt;br /&gt;Truncating a Table&lt;br /&gt;&lt;br /&gt;TRUNCATE TABLE table_name INDEXES&lt;br /&gt;Create an Index&lt;br /&gt;CREATE [UNIQUE][CLUSTERED  NONCLUSTERED] INDEX index_name&lt;br /&gt;ON table_name (column_name[, column_name]…)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7243287038504660386-8346378054824435394?l=adobytescode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://adobytescode.blogspot.com/feeds/8346378054824435394/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7243287038504660386&amp;postID=8346378054824435394' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7243287038504660386/posts/default/8346378054824435394'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7243287038504660386/posts/default/8346378054824435394'/><link rel='alternate' type='text/html' href='http://adobytescode.blogspot.com/2007/12/sql-syntax.html' title='SQL-syntax'/><author><name>ZeroCode</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7243287038504660386.post-7885359158468398852</id><published>2007-12-26T02:10:00.000-08:00</published><updated>2007-12-26T02:14:10.116-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SQL Server'/><title type='text'>SQL SERVER ARCHITECTURE</title><content type='html'>&lt;strong&gt;                                                            SQL SERVER ARCHITECTURE&lt;/strong&gt;&lt;br /&gt;&lt;p&gt;&lt;strong&gt;&lt;/strong&gt; &lt;/p&gt;&lt;p&gt;68. What is a transaction and what are ACID properties?&lt;br /&gt;A transaction is a logical unit of work in which, all the steps must be performed or none. ACID stands for Atomicity, Consistency, Isolation, Durability. These are the properties of a transaction. For more information and explanation of these properties, see SQL Server books online or any RDBMS fundamentals text book.&lt;br /&gt;&lt;br /&gt;69. Explain different isolation levels&lt;br /&gt;An isolation level determines the degree of isolation of data between concurrent transactions. The default SQL Server isolation level is Read Committed. Here are the other isolation levels (in the ascending order of isolation): Read Uncommitted, Read Committed, Repeatable Read, Serializable. See SQL Server books online for an explanation of the isolation levels. Be sure to read about SET TRANSACTION ISOLATION LEVEL, which lets you customize the isolation level at the connection level.&lt;br /&gt;&lt;br /&gt;CREATE INDEX myIndex ON myTable(myColumn)70. What type of Index will get created after executing the above statement?&lt;br /&gt;Non-clustered index. Important thing to note: By default a clustered index gets created on the primary key, unless specified otherwise.&lt;br /&gt;&lt;br /&gt;71. What's the maximum size of a row?&lt;br /&gt;8060 bytes. Don't be surprised with questions like 'what is the maximum number of columns per table'. Check out SQL Server books online for the page titled: "Maximum Capacity Specifications".&lt;br /&gt;&lt;br /&gt;72. Explain Active/Active and Active/Passive cluster configurations&lt;br /&gt;Hopefully you have experience setting up cluster servers. But if you don't, at least be familiar with the way clustering works and the two clusterning configurations Active/Active and Active/Passive. SQL Server books online has enough information on this topic and there is a good white paper available on &lt;a title="Microsoft" href="http://msdn.microsoft.com/" target="_blank"&gt;&lt;/a&gt;&lt;a title="Microsoft" href="http://msdn.microsoft.com/" target="_blank"&gt;&lt;/a&gt;&lt;a title="Microsoft" href="http://msdn.microsoft.com/" target="_blank"&gt;&lt;/a&gt;&lt;a title="Microsoft" href="http://msdn.microsoft.com/" target="_blank"&gt;Microsoft&lt;/a&gt; site.&lt;br /&gt;&lt;br /&gt;73. Explain the architecture of SQL Server?&lt;br /&gt;This is a very important question and you better be able to answer it if consider yourself a DBA. SQL Server books online is the best place to read about SQL Server architecture. Read up the chapter dedicated to SQL Server Architecture.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;74. What is lock escalation?&lt;br /&gt;Lock escalation is the process of converting a lot of low level locks (like row locks, page locks) into higher level locks (like table locks). Every lock is a memory structure too many locks would mean, more memory being occupied by locks. To prevent this from happening, SQL Server escalates the many fine-grain locks to fewer coarse-grain locks. Lock escalation threshold was definable in SQL Server 6.5, but from SQL Server 7.0 onwards it's dynamically managed by SQL Server.&lt;br /&gt;75. What's the difference between DELETE TABLE and TRUNCATE TABLE commands?&lt;br /&gt;DELETE TABLE is a logged operation, so the deletion of each row gets logged in the transaction log, which makes it slow. TRUNCATE TABLE also deletes all the rows in a table, but it won't log the deletion of each row, instead it logs the deallocation of the data pages of the table, which makes it faster. Of course, TRUNCATE TABLE can be rolled back.&lt;br /&gt;76. Explain the storage models of OLAP?&lt;br /&gt;Check out MOLAP, ROLAP and HOLAP in SQL Server books online for more infomation.&lt;br /&gt;  &lt;br /&gt;77. What are the new features introduced in SQL Server 2000 (or the latest release of SQL           &lt;br /&gt;Server at the time of your interview)? What changed between the previous version of SQL Server and the current version?&lt;br /&gt;This question is generally asked to see how current is your knowledge. Generally there is a section in the beginning of the books online titled "What's New", which has all such information. Of course, reading just that is not enough, you should have tried those things to better answer the questions. Also check out the section titled "Backward Compatibility" in books online which talks about the changes that have taken place in the new version.&lt;br /&gt;&lt;br /&gt;78. What are constraints? Explain different types of constraints.&lt;br /&gt;Constraints enable the RDBMS enforce the integrity of the database automatically, without needing you to create triggers, rule or defaults. Types of constraints: NOT NULL, CHECK, UNIQUE, PRIMARY KEY, FOREIGN KEYFor an explanation of these constraints see books online for the pages titled: "Constraints" and "CREATE TABLE", "ALTER TABLE"&lt;br /&gt;&lt;br /&gt;79. What is an index? What are the types of indexes? How many clustered indexes can be &lt;br /&gt;created on a table? I create a separate index on each column of a table. What are the advantages and disadvantages of this approach?&lt;br /&gt;&lt;br /&gt;Indexes in SQL Server are similar to the indexes in books. They help SQL Server retrieve the data quicker.Indexes are of two types. Clustered indexes and non-clustered indexes. When you craete a clustered index on a table, all the rows in the table are stored in the order of the clustered index key. So, there can be only one clustered index per table. Non-clustered indexes have their own storage separate from the table data storage. Non-clustered indexes are stored as B-tree structures (so do clustered indexes), with the leaf level nodes having the index key and it's row locater. The row located could be the RID or the Clustered index key, depending up on the absence or presence of clustered index on the table.If you create an index on each column of a table, it improves the query performance, as the query optimizer can choose from all the existing indexes to come up with an efficient execution plan. At the same t ime, data modification operations (such as INSERT, UPDATE, DELETE) will become slow, as every time data changes in the table, all the indexes need to be updated. Another disadvantage is that, indexes need disk space, the more indexes you have, more disk space is used.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7243287038504660386-7885359158468398852?l=adobytescode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://adobytescode.blogspot.com/feeds/7885359158468398852/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7243287038504660386&amp;postID=7885359158468398852' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7243287038504660386/posts/default/7885359158468398852'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7243287038504660386/posts/default/7885359158468398852'/><link rel='alternate' type='text/html' href='http://adobytescode.blogspot.com/2007/12/sql-server-architecture.html' title='SQL SERVER ARCHITECTURE'/><author><name>ZeroCode</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7243287038504660386.post-4459173480595660631</id><published>2007-12-26T02:05:00.000-08:00</published><updated>2007-12-26T02:06:43.399-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SQL Server'/><title type='text'>sql-faq-6</title><content type='html'>57. What is DTS?&lt;br /&gt;Microsoft® SQL Server™ 2000 Data Transformation Services (DTS) is a set of graphical tools and programmable objects that lets you extract, transform, and consolidate data from disparate sources into single or multiple destinations.&lt;br /&gt;&lt;br /&gt;58. What are defaults? Is there a column to which a default can't be bound?&lt;br /&gt;A default is a value that will be used by a column, if no value is supplied to that column while inserting data. IDENTITY columns and timestamp columns can't have defaults bound to them.&lt;br /&gt;&lt;br /&gt;59. What are the constraints?&lt;br /&gt;Table Constraints define rules regarding the values allowed in columns and are the standard mechanism for enforcing integrity. SQL Server 2000 supports five classes of constraints. NOT NULL, CHECK, UNIQUE, PRIMARY KEY, FOREIGN KEY.&lt;br /&gt;&lt;br /&gt;60. What is Transaction?&lt;br /&gt;A transaction is a sequence of operations performed as a single logical unit of work. A logical unit of work must exhibit four properties, called the ACID (Atomicity, Consistency, Isolation, and Durability) properties, to qualify as a transaction.&lt;br /&gt;&lt;br /&gt;61. What is Isolation Level?&lt;br /&gt;An isolation level determines the degree of isolation of data between concurrent transactions. The default SQL Server isolation level is Read Committed. A lower isolation level increases concurrency, but at the expense of data correctness. Conversely, a higher isolation level ensures that data is correct, but can affect concurrency negatively. The isolation level required by an application determines the locking behavior SQL Server uses. SQL-92 defines the following isolation levels, all of which are supported by SQL Server:&lt;br /&gt;1.      Read uncommitted (the lowest level where transactions are isolated only enough to ensure that physically corrupt data is not read).&lt;br /&gt;2.      Read committed (SQL Server default level).&lt;br /&gt;3.      Repeatable read.&lt;br /&gt;4.      Serializable (the highest level, where transactions are completely isolated from one another).&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7243287038504660386-4459173480595660631?l=adobytescode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://adobytescode.blogspot.com/feeds/4459173480595660631/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7243287038504660386&amp;postID=4459173480595660631' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7243287038504660386/posts/default/4459173480595660631'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7243287038504660386/posts/default/4459173480595660631'/><link rel='alternate' type='text/html' href='http://adobytescode.blogspot.com/2007/12/sql-faq-6.html' title='sql-faq-6'/><author><name>ZeroCode</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7243287038504660386.post-5741023725711374289</id><published>2007-12-26T02:03:00.000-08:00</published><updated>2007-12-26T02:04:14.267-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SQL Server'/><title type='text'>sql-faq-5</title><content type='html'>transaction across all the servers enlisted in the transaction.&lt;br /&gt;49. What are the different ways of moving data/databases between servers and databases in &lt;br /&gt;SQL Server?&lt;br /&gt;There are lots of options available, you have to choose your option depending upon your requirements. Some of the options you have are: BACKUP/RESTORE, detaching and attaching databases, replication, DTS, BCP, logshipping, INSERT...SELECT, SELECT...INTO, creating INSERT scripts to generate data.&lt;br /&gt;&lt;br /&gt;50. Do you transfer data from text file to database (other than DTS)?&lt;br /&gt;Using the BCP (Bulk Copy Program) utility&lt;br /&gt;&lt;br /&gt;51. What's the difference between DELETE TABLE and TRUNCATE TABLE commands?&lt;br /&gt;DELETE TABLE is a logged operation, so the deletion of each row gets logged in the transaction log, which makes it slow. TRUNCATE TABLE also deletes all the rows in a table, but it won't log the deletion of each row, instead it logs the deallocation of the data pages of the table, which makes it faster. Of course, TRUNCATE TABLE can be rolled back.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;52. What is a deadlock?&lt;br /&gt;Deadlock is a situation when two processes, each having a lock on one piece of data, attempt to acquire a lock on the other's piece. Each process would wait indefinitely for the other to release the lock, unless one of the user processes is terminated. SQL Server detects deadlocks and terminates one user's process.&lt;br /&gt;&lt;br /&gt;53. What is a LiveLock?&lt;br /&gt;A livelock is one, where a request for an exclusive lock is repeatedly denied because a series of overlapping shared locks keeps interfering. SQL Server detects the situation after four denials and refuses further shared locks. A livelock also occurs when read transactions monopolize a table or page, forcing a write transaction to wait indefinitely.&lt;br /&gt;&lt;br /&gt;54. How to restart SQL Server in single user mode?&lt;br /&gt;From Startup Options :- Go to SQL Server Properties by right-clicking on the Server name in the Enterprise manager. Under the 'General' tab, click on 'Startup Parameters'. Enter a value of -m in the Parameter.&lt;br /&gt;&lt;br /&gt;55. Does SQL Server 2000 clustering support load balancing?&lt;br /&gt;SQL Server 2000 clustering does not provide load balancing; it provides failover support. To achieve load balancing, you need software that balances the load between clusters, not between servers within a cluster.&lt;br /&gt;&lt;br /&gt;56. What is DTC?&lt;br /&gt;The Microsoft Distributed Transaction Coordinator (MS DTC) is a transaction manager that allows client applications to include several different sources of data in one transaction. MS DTC coordinates committing the distributed&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7243287038504660386-5741023725711374289?l=adobytescode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://adobytescode.blogspot.com/feeds/5741023725711374289/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7243287038504660386&amp;postID=5741023725711374289' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7243287038504660386/posts/default/5741023725711374289'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7243287038504660386/posts/default/5741023725711374289'/><link rel='alternate' type='text/html' href='http://adobytescode.blogspot.com/2007/12/sql-faq-5.html' title='sql-faq-5'/><author><name>ZeroCode</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7243287038504660386.post-4557374973255561712</id><published>2007-12-26T02:02:00.000-08:00</published><updated>2007-12-26T02:03:04.471-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SQL Server'/><title type='text'>sql-faq-4</title><content type='html'>41. How can I enforce to use particular index?&lt;br /&gt;You can use index hint (index=index_name) after the table name.&lt;br /&gt;SELECT au_lname&lt;br /&gt;FROM authors (index=aunmind)&lt;br /&gt;&lt;br /&gt;42. What is sorting and what is the difference between sorting and clustered indexes?&lt;br /&gt;The ORDER BY clause sorts query results by one or more columns up to 8,060 bytes. This will happen by the time when we retrieve data from database. Clustered indexes physically sorting data, while inserting/updating the table.&lt;br /&gt;&lt;br /&gt;43. What are the differences between UNION and JOINS?&lt;br /&gt;A JOIN selects columns from 2 or more tables. A UNION selects rows.&lt;br /&gt;The UNION operator allows you to combine the results of two or more SELECT statements into a single result set.&lt;br /&gt;&lt;br /&gt;44. What is the Referential Integrity?&lt;br /&gt;Referential integrity refers to the consistency that must be maintained between primary and foreign keys, i.e. every foreign key value must have a corresponding primary key value.&lt;br /&gt;&lt;br /&gt;45. What is the row size in SQL Server 2000?&lt;br /&gt;8060 bytes.&lt;br /&gt;&lt;br /&gt;46. How to determine the service pack currently installed on SQL Server?&lt;br /&gt;The global variable @@Version stores the build number of the sqlservr.exe, which is used to determine the service pack installed. eg: Microsoft SQL Server 2000 - 8.00.760 (Intel X86) Dec 17 2002 14:22:05 Copyright (c) 1988-2003 Microsoft Corporation Enterprise Edition on Windows NT 5.0 (Build 2195: Service Pack 3)&lt;br /&gt;&lt;br /&gt;47. What is the purpose of UPDATE STATISTICS?&lt;br /&gt;Updates information about the distribution of key values for one or more statistics groups (collections) in the specified table or indexed view.&lt;br /&gt;&lt;br /&gt;48. What is the use of SCOPE_IDENTITY() function?&lt;br /&gt;Returns the most recently created identity value for the tables in the current execution scope.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7243287038504660386-4557374973255561712?l=adobytescode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://adobytescode.blogspot.com/feeds/4557374973255561712/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7243287038504660386&amp;postID=4557374973255561712' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7243287038504660386/posts/default/4557374973255561712'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7243287038504660386/posts/default/4557374973255561712'/><link rel='alternate' type='text/html' href='http://adobytescode.blogspot.com/2007/12/sql-faq-4.html' title='sql-faq-4'/><author><name>ZeroCode</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7243287038504660386.post-3641976435148005192</id><published>2007-12-26T02:01:00.002-08:00</published><updated>2007-12-26T02:02:22.412-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='StoredProcedures'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL Server'/><title type='text'>sql-faq-3</title><content type='html'>29. Can you explain the role of each service?&lt;br /&gt;SQL SERVER - is for running the databases SQL AGENT - is for automation such as Jobs, DB Maintanance, Backups DTC - Is for linking and connecting to other SQL Servers.&lt;br /&gt;&lt;br /&gt;30. How do you troubleshoot SQL Server if its running very slow?&lt;br /&gt;First check the processor and memory usage to see that processor is not above 80% utilization and memory not above 40-45% utilization then check the disk utilization using Performance Monitor, Secondly, use SQL Profiler to check for the users and current SQL activities and jobs running which might be a problem. Third would be to run UPDATE_STATISTICS command to update the indexes.&lt;br /&gt;&lt;br /&gt;31. Lets say due to N/W or Security issues client is not able to connect to server or vice versa.&lt;br /&gt;How do you troubleshoot?&lt;br /&gt;First I will look to ensure that port settings are proper on server and client Network utility for connections. ODBC is properly configured at client end for connection ——Makepipe &amp;amp; readpipe are utilities to check for connection. Makepipe is run on Server and readpipe on client to check for any connection issues.&lt;br /&gt;&lt;br /&gt;32. What are the authentication modes in SQL Server?&lt;br /&gt;Windows mode and mixed mode (SQL &amp;amp; Windows).&lt;br /&gt;&lt;br /&gt;33. Where do you think the users names and passwords will be stored in sql server?&lt;br /&gt;They get stored in master db in the sysxlogins table.&lt;br /&gt;&lt;br /&gt;34. What is log shipping?&lt;br /&gt;Can we do logshipping with SQL Server 7.0 - Logshipping is a new feature of SQL Server 2000. We should have two SQL Server - Enterprise Editions. From Enterprise Manager we can configure the logshipping. In logshipping the transactional log file from one server is automatically updated into the backup database on the other server. If one server fails, the other server will have the same db and we can use this as the DR (disaster recovery) plan.&lt;br /&gt;&lt;br /&gt;35. Let us say the SQL Server crashed and you are rebuilding the databases including the&lt;br /&gt;master database what procedure to you follow?&lt;br /&gt;For restoring the master db we have to stop the SQL Server first and then from command line we can type SQLSERVER .m which will basically bring it into the maintenance mode after which we can restore the master db.&lt;br /&gt;&lt;br /&gt;36. Let us say master db itself has no backup. Now you have to rebuild the db so what kind of&lt;br /&gt;action do you take?&lt;br /&gt;(I am not sure- but I think we have a command to do it).&lt;br /&gt;&lt;br /&gt;37. What’s the difference between a primary key and a unique key?&lt;br /&gt;Both primary key and unique enforce uniqueness of the column on which they are defined. But by default primary key creates a clustered index on the column, where are unique creates a nonclustered index by default. Another major difference is that, primary key doesn’t allow NULLs, but unique key allows one NULL only.&lt;br /&gt;&lt;br /&gt;38. Write a SQL Query to find first Week Day of month?&lt;br /&gt;SELECT&lt;br /&gt;DATENAME(dw, DATEADD(dd, - DATEPART(dd, GETDATE()) + 1, GETDATE())) AS FirstDay&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;39. How to find 6th highest salary from Employee table&lt;br /&gt;SELECT TOP 1 salary&lt;br /&gt;FROM (SELECT DISTINCT TOP 6 salary&lt;br /&gt;FROM employee&lt;br /&gt;ORDER BY salary DESC)&lt;br /&gt;ORDER BY salary&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;40. What is a join and List different types of joins?&lt;br /&gt;Joins are used in queries to explain how different tables are related. Joins also let you select data from a table depending upon data from another table. Types of joins: INNER JOINs, OUTER JOINs, CROSS JOINs. OUTER JOINs are further classified as LEFT OUTER JOINS, RIGHT OUTER JOINS and FULL OUTER JOINS.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7243287038504660386-3641976435148005192?l=adobytescode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://adobytescode.blogspot.com/feeds/3641976435148005192/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7243287038504660386&amp;postID=3641976435148005192' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7243287038504660386/posts/default/3641976435148005192'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7243287038504660386/posts/default/3641976435148005192'/><link rel='alternate' type='text/html' href='http://adobytescode.blogspot.com/2007/12/sql-faq-3.html' title='sql-faq-3'/><author><name>ZeroCode</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7243287038504660386.post-2776828012887349610</id><published>2007-12-26T02:01:00.001-08:00</published><updated>2007-12-26T02:01:26.081-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='StoredProcedures'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL Server'/><title type='text'>sql-faq-2</title><content type='html'>16. Can you give me some DBCC command options?&lt;br /&gt;(Database consistency check) - DBCC CHECKDB - Ensures that tables in the db and the indexes are correctly linked.and DBCC CHECKALLOC - To check that all pages in a db are correctly allocated. DBCC SQLPERF - It gives report on current usage of transaction log in percentage. DBCC CHECKFILEGROUP - Checks all tables file group for any damage.&lt;br /&gt;&lt;br /&gt;17. What command do we use to rename a db?&lt;br /&gt;sp_renamedb ‘oldname’ , ‘newname’&lt;br /&gt;&lt;br /&gt;18. Well sometimes sp_reanmedb may not work you know because if some one is using the db         &lt;br /&gt;it will not accept this command so what do you think you can do in such cases?&lt;br /&gt;In such cases we can first bring to db to single user using sp_dboptions and then we can rename that db and then we can rerun the sp_dboptions command to remove the single user mode.&lt;br /&gt;&lt;br /&gt;19. What is the difference between a HAVING CLAUSE and a WHERE CLAUSE?&lt;br /&gt;Having Clause is basically used only with the GROUP BY function in a query. WHERE Clause is applied to each row before they are part of the GROUP BY function in a query.&lt;br /&gt;&lt;br /&gt;20. What do you mean by COLLATION?&lt;br /&gt;Collation is basically the sort order. There are three types of sort order Dictionary case sensitive, Dictonary - case insensitive and Binary.&lt;br /&gt;&lt;br /&gt;21. What is a Join in SQL Server?&lt;br /&gt;Join actually puts data from two or more tables into a single result set.&lt;br /&gt;&lt;br /&gt;22. Can you explain the types of Joins that we can have with Sql Server?&lt;br /&gt;There are three types of joins: Inner Join, Outer Join, Cross Join&lt;br /&gt;&lt;br /&gt;23. When do you use &lt;a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/adminsql/ad_mon_perf_86ib.asp"&gt;SQL Profiler&lt;/a&gt;?&lt;br /&gt;SQL Profiler utility allows us to basically track connections to the SQL Server and also determine activities such as which SQL Scripts are running, failed jobs etc..&lt;br /&gt;&lt;br /&gt;24. What is a &lt;a href="http://www.databasejournal.com/features/mssql/article.php/3085211"&gt;Linked Server&lt;/a&gt;?&lt;br /&gt;Linked Servers is a concept in SQL Server by which we can add other SQL Server to a Group and query both the SQL Server dbs using T-SQL Statements.&lt;br /&gt;&lt;br /&gt;26. Which stored procedure will you be running to add a linked server?&lt;br /&gt;&lt;a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/tsqlref/ts_sp_adda_8gqa.asp"&gt;sp_addlinkedserver&lt;/a&gt;, &lt;a href="http://www.dbazine.com/sharma2.shtml"&gt;sp_addlinkedsrvlogin&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;27. Can you link only other SQL Servers or any database servers such as Oracle?&lt;br /&gt;We can link any server provided we have the OLE-DB provider from Microsoft to allow a link. For Oracle we have a OLE-DB provider for oracle that microsoft provides to add it as a linked server to the sql server group.&lt;br /&gt;&lt;br /&gt;28. What are the OS services that the SQL Server installation adds?&lt;br /&gt;MS SQL SERVER SERVICE, SQL AGENT SERVICE, DTC (Distribution transac co-ordinator)&lt;br /&gt;29. Can you explain the role of each service?&lt;br /&gt;SQL SERVER - is for running the databases SQL AGENT - is for automation such as Jobs, DB Maintanance, Backups DTC - Is for linking and connecting to other SQL Servers.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7243287038504660386-2776828012887349610?l=adobytescode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://adobytescode.blogspot.com/feeds/2776828012887349610/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7243287038504660386&amp;postID=2776828012887349610' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7243287038504660386/posts/default/2776828012887349610'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7243287038504660386/posts/default/2776828012887349610'/><link rel='alternate' type='text/html' href='http://adobytescode.blogspot.com/2007/12/sql-faq-2.html' title='sql-faq-2'/><author><name>ZeroCode</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7243287038504660386.post-2871580143950180181</id><published>2007-12-26T01:59:00.000-08:00</published><updated>2007-12-26T02:00:37.030-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='StoredProcedures'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL Server'/><title type='text'>sql-faq-1</title><content type='html'>1.   What is normalization?&lt;br /&gt;Well a relational database is basically composed of tables that contain related data. So the Process of organizing this data into tables is actually referred to as normalization.&lt;br /&gt;&lt;br /&gt;2.   What is a &lt;a href="http://www.google.com/search?num=100&amp;amp;hl=en&amp;amp;lr=&amp;amp;c2coff=1&amp;amp;client=firefox-a&amp;amp;oi=defmore&amp;amp;q=define:stored+procedure"&gt;Stored Procedure&lt;/a&gt;?&lt;br /&gt;Its nothing but a set of T-SQL statements combined to perform a single task of several tasks. Its basically like a Macro so when you invoke the Stored procedure, you actually run a set of statements.&lt;br /&gt;&lt;br /&gt;3.   Can you give an example of Stored Procedure?&lt;br /&gt;sp_helpdb , sp_who2, sp_renamedb are a set of system defined stored procedures. We can also have user defined stored procedures which can be called in similar way.&lt;br /&gt;&lt;br /&gt;4.   What is a trigger?&lt;br /&gt;Triggers are basically used to implement business rules. Triggers is also similar to stored procedures. The difference is that it can be activated when data is added or edited or deleted from a table in a database.&lt;br /&gt;&lt;br /&gt;5.   What is a view?&lt;br /&gt;If we have several tables in a db and we want to view only specific columns from specific tables we can go for views. It would also suffice the needs of security some times allowing specfic users to see only specific columns based on the permission that we can configure on the view. Views also reduce the effort that is required for writing queries to access specific columns every time.&lt;br /&gt;&lt;br /&gt;6.   What is an Index?&lt;br /&gt;When queries are run against a db, an index on that db basically helps in the way the data is sorted to process the query for faster and data retrievals are much faster when we have an index.&lt;br /&gt;&lt;br /&gt;7.   What are the types of indexes available with SQL Server?&lt;br /&gt;There are basically two types of indexes that we use with the &lt;a href="http://www.microsoft.com/sql/default.asp"&gt;SQL Server&lt;/a&gt;. Clustered and the Non-Clustered.&lt;br /&gt;&lt;br /&gt;8.   What is the basic difference between &lt;a href="http://www.sql-server-performance.com/gv_index_data_structures.asp"&gt;clustered and a non-clustered index&lt;/a&gt;?&lt;br /&gt;The difference is that, Clustered index is unique for any given table and we can have only one clustered index on a table. The leaf level of a clustered index is the actual data and the data is resorted in case of clustered index. Whereas in case of non-clustered index the leaf level is actually a pointer to the data in rows so we can have as many non-clustered indexes as we can on the db.&lt;br /&gt;&lt;br /&gt;9.   What are cursors?&lt;br /&gt;Well cursors help us to do an operation on a set of data that we retreive by commands such as Select columns from table. For example : If we have duplicate records in a table we can remove it by declaring a cursor which would check the records during retreival one by one and remove rows which have duplicate values.&lt;br /&gt;&lt;br /&gt;10. When do we use the UPDATE_STATISTICS command?&lt;br /&gt;This command is basically used when we do a large processing of data. If we do a large amount of deletions any modification or Bulk Copy into the tables, we need to basically update the indexes to take these changes into account. UPDATE_STATISTICS updates the indexes on these tables accordingly.&lt;br /&gt;&lt;br /&gt;11. Which TCP/IP port does SQL Server run on?&lt;br /&gt;SQL Server runs on port 1433 but we can also change it for better security.&lt;br /&gt;&lt;br /&gt;12. From where can you change the default port?&lt;br /&gt;From the Network Utility TCP/IP properties –&gt; Port number.both on client and the server.&lt;br /&gt;13. Can you tell me the difference between DELETE &amp;amp; TRUNCATE commands?&lt;br /&gt;Delete command removes the rows from a table based on the condition that we provide with a WHERE clause. Truncate will actually remove all the rows from a table and there will be no data in the table after we run the truncate command.&lt;br /&gt;&lt;br /&gt;14. Can we use Truncate command on a table which is referenced by FOREIGN KEY?&lt;br /&gt;No. We cannot use Truncate command on a table with Foreign Key because of referential integrity.&lt;br /&gt;&lt;br /&gt;15. What is the use of DBCC commands?&lt;br /&gt;DBCC stands for database consistency checker. We use these commands to check the consistency of the databases, i.e., maintenance, validation task and status checks.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7243287038504660386-2871580143950180181?l=adobytescode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://adobytescode.blogspot.com/feeds/2871580143950180181/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7243287038504660386&amp;postID=2871580143950180181' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7243287038504660386/posts/default/2871580143950180181'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7243287038504660386/posts/default/2871580143950180181'/><link rel='alternate' type='text/html' href='http://adobytescode.blogspot.com/2007/12/sql-faq-1.html' title='sql-faq-1'/><author><name>ZeroCode</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7243287038504660386.post-4618907923951542810</id><published>2007-12-26T01:56:00.000-08:00</published><updated>2007-12-26T01:57:20.747-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='CONSTRAINT'/><title type='text'>CONSTRAINT-12</title><content type='html'>A CONSTRAINT clause is an optional part of a &lt;a href="http://db.apache.org/derby/manuals/reference/sqlj27.html#HDRSII-SQLJ-24513" target="_blank"&gt;CREATE TABLE statement&lt;/a&gt; or &lt;a href="http://db.apache.org/derby/manuals/reference/sqlj26.html#HDRSII-SQLJ-33145" target="_blank"&gt;ALTER TABLE&lt;/a&gt;. A constraint is a rule to which data must conform. Constraint names are o       ptional.&lt;br /&gt;A CONSTRAINT can be one of the following:&lt;br /&gt;&lt;a name="IDX826"&gt;&lt;/a&gt;·                                             a column-level constraint&lt;br /&gt;Column-level constraints refer to a single column in the table and do not specify a column name (except check constraints). They refer to the column that they follow.&lt;br /&gt;&lt;a name="IDX828"&gt;&lt;/a&gt;·                                             a table-level constraint&lt;br /&gt;Table-level constraints refer to one or more columns in the table. Table-level constraints specify the names of the columns to which they apply. Table-level CHECK constraints can refer to 0 or more columns in the table.&lt;br /&gt;&lt;a name="IDX830"&gt;&lt;/a&gt;Column constraints include:&lt;br /&gt;·                                 NOT NULL&lt;br /&gt;Specifies that this column cannot hold NULL values (constraints of this type are not nameable).&lt;br /&gt;·                                 NULL&lt;br /&gt;The opposite of NOT NULL (not really a constraint), it specifies that the column can hold NULL values. Specifying NULL is the same as saying nothing at all, except when the column is included in a PRIMARY KEY constraint.&lt;br /&gt;·                                 PRIMARY KEY&lt;br /&gt;Specifies the column that uniquely identifies a row in the table. The identified columns must be defined as NOT NULL.&lt;br /&gt;Note:&lt;br /&gt;If you attempt to add a primary key using ALTER TABLE and any of the columns included in the primary key contain null values, an error will be generated and the primary                                                                                      key will not be added. See &lt;a href="http://db.apache.org/derby/manuals/reference/sqlj26.html#HDRSII-SQLJ-33145" target="_blank"&gt;ALTER TABLE&lt;/a&gt; for more information.&lt;br /&gt;·                                 UNIQUE&lt;br /&gt;Specifies that values in the column must be unique. NULL values are not allowed.&lt;br /&gt;·                                 FOREIGN KEY&lt;br /&gt;Specifies that the values in the column must correspond to values in a referenced primary key or unique key column or that they are NULL.&lt;br /&gt;·                                 CHECK&lt;br /&gt;Specifies rules for values in the column.&lt;br /&gt;&lt;a name="IDX834"&gt;&lt;/a&gt;Table constraints include:&lt;br /&gt;·                                 PRIMARY KEY&lt;br /&gt;Specifies the column or columns that uniquely identify a row in the table. NULL values are not allowed.&lt;br /&gt;·                                 UNIQUE&lt;br /&gt;Specifies that values in the columns must be unique. The identified columns must be defined as NOT NULL.&lt;br /&gt;·                                 FOREIGN KEY&lt;br /&gt;Specifies that the values in the columns must correspond to values in referenced primary key or unique columns or that they are NULL.&lt;br /&gt;Note:&lt;br /&gt;If the foreign key consists of multiple columns, and any column is NULL, the whole key is considered NULL. The insert is permitted no matter what is on the non-null columns.&lt;br /&gt;·                                 CHECK&lt;br /&gt;Specifies a wide range of rules for values in the table.&lt;br /&gt;&lt;a name="IDX838"&gt;&lt;/a&gt;Column constraints and table constraints have the same function; the difference is in where you specify them. Table constraints allow you to specify more than one column in a PRIMARY KEY, UNIQUE, CHECK, or FOREIGN KEY constraint definition. Column-level constraints (except for check constraints) refer to only one column&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7243287038504660386-4618907923951542810?l=adobytescode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://adobytescode.blogspot.com/feeds/4618907923951542810/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7243287038504660386&amp;postID=4618907923951542810' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7243287038504660386/posts/default/4618907923951542810'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7243287038504660386/posts/default/4618907923951542810'/><link rel='alternate' type='text/html' href='http://adobytescode.blogspot.com/2007/12/constraint-12.html' title='CONSTRAINT-12'/><author><name>ZeroCode</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7243287038504660386.post-6589867428799447476</id><published>2007-12-26T01:54:00.000-08:00</published><updated>2007-12-26T01:56:03.319-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='indexes'/><title type='text'>indexes</title><content type='html'>Data access: SQL server uses following two methods to access data&lt;br /&gt;&lt;br /&gt;1). Table scan&lt;br /&gt;2). By using index&lt;br /&gt;&lt;br /&gt;Table scan: it has to start from the beginning of the table and scan each and every page for the required data.&lt;br /&gt;&lt;br /&gt;By using index: it will traverse through the index tree structure to find the required data and extract the data that satisfy the query criteria.&lt;br /&gt;&lt;br /&gt;Indexes: indexes in sql server are similar to index in a book. Indexes are used to improve the performance of quires.&lt;br /&gt;&lt;br /&gt;Indexes are generally created for following columns.&lt;br /&gt;1). Primary key column&lt;br /&gt;2). Foreign key column: Frequently used in join conditions&lt;br /&gt;3). Column which are frequently used in where clause&lt;br /&gt;4). Columns which are used to retrieve the data in sorting order&lt;br /&gt;&lt;br /&gt;Indexes are cannot be created for following columns&lt;br /&gt;The columns which are not frequently used in where clause.&lt;br /&gt;Columns containing the duplicate and NULL values.&lt;br /&gt;Columns containing images, binary information, and text information.&lt;br /&gt;&lt;br /&gt;Types of indexes&lt;br /&gt;1). Clustered index&lt;br /&gt;2). Non-clustered index&lt;br /&gt;3). Unique index&lt;br /&gt;4). Composite index&lt;br /&gt;&lt;br /&gt;1). Clustered index: Only one clustered index is allowed for a table. The order of values in a table. Order of values in index is also same. When cluster index is created on table data is arranged in ascending order cluster index will occupy 5% of the table.&lt;br /&gt;&lt;br /&gt;Syntax:&lt;br /&gt;Create clustered index &lt;index_name&gt;an &lt;table_name&gt;(columns)&lt;br /&gt;Create clustered indew emp_clindex an emp (empno)&lt;br /&gt;&lt;br /&gt;2). Non-clustered index:&lt;br /&gt;It is the default index created by the server the physical order of the data in the table is different from the order of the values in index.&lt;br /&gt;&lt;br /&gt;Max no of non – clustered indexes allowed for table is 249.&lt;br /&gt;&lt;br /&gt;Syntax:&lt;br /&gt;Create non-clustered index &lt;index_name&gt;on table_name &lt;columns&gt;&lt;br /&gt;Create non-clustered index emp_sal on emp (deptno, sal)&lt;br /&gt;&lt;br /&gt;3). Unique index:&lt;br /&gt;An index with unique constraint. It will not allow duplicate values.&lt;br /&gt;&lt;br /&gt;Syntax:&lt;br /&gt;Create unique index &lt;index&gt;on &lt;tablename&gt;(column)&lt;br /&gt;Create unique index dept_index on dept (dname)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Transactions:&lt;br /&gt;1). Auto commit Transaction&lt;br /&gt;2). Explicit Transaction&lt;br /&gt;3). Implicit Transaction&lt;br /&gt;&lt;br /&gt;1). Auto commit Transaction: Every individual transaction is an Auto commit transaction&lt;br /&gt;&lt;br /&gt;Example: Update emp set sal = sal + 100 where deptno.&lt;br /&gt;&lt;br /&gt;2). Explicit transaction: Transaction begins with Begin Tran and ends explicitly with either commit or rollback&lt;br /&gt;Begin Tran&lt;br /&gt;insert into dept values (10, ‘ACCOUNTING’, ‘NEWYORK’)&lt;br /&gt;rollback&lt;br /&gt;insert operation is cancelled&lt;br /&gt;&lt;br /&gt;3). Implicit Transaction:&lt;br /&gt; Set Implicit_transactions on/off&lt;br /&gt; update emp set sal = sal + 1000 where job = ‘MANAGER’&lt;br /&gt; delete from emp where deptno = 10&lt;br /&gt; commit&lt;br /&gt;&lt;br /&gt;Update and delete operations are cancelled&lt;br /&gt;&lt;br /&gt;Save point: Save points are like paper markers used to marker the transactions.&lt;br /&gt;&lt;br /&gt;Syntax: save begin from &lt;save&gt;&lt;br /&gt;insert into emp (empno, ename) values (100, ‘RAM’)&lt;br /&gt;Save point from A&lt;br /&gt;Update emp set sal = sal + 100 where empno = 7839&lt;br /&gt;Save from B&lt;br /&gt;Insert into emp (empno, ename) values (200, ‘***’)&lt;br /&gt;Delete from emp where empno = 7369&lt;br /&gt;Rollback from B&lt;br /&gt;delete and INSERT will be cancelled&lt;br /&gt;Rollback from A&lt;br /&gt;update will be cancelled.&lt;br /&gt;Commit/rollback&lt;br /&gt;Insert will be saved/int will be cancelled&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7243287038504660386-6589867428799447476?l=adobytescode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://adobytescode.blogspot.com/feeds/6589867428799447476/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7243287038504660386&amp;postID=6589867428799447476' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7243287038504660386/posts/default/6589867428799447476'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7243287038504660386/posts/default/6589867428799447476'/><link rel='alternate' type='text/html' href='http://adobytescode.blogspot.com/2007/12/indexes.html' title='indexes'/><author><name>ZeroCode</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7243287038504660386.post-6562862747220391040</id><published>2007-12-26T01:51:00.000-08:00</published><updated>2007-12-26T01:53:58.969-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Normalization'/><title type='text'>normalization and denormalization</title><content type='html'>&lt;strong&gt;Normalization &lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;/strong&gt;&lt;br /&gt;          Normalization theory is built the concept of normal forms. Normalizations reduces redundancy. Redundancy is unnecessary repetition of data. It can cause problems with storage and retrieval of data. During the process of normalization, dependencies can be identified, which can cause problems during deletion and updation. Normalization theory is based on the fundamental notation of functional dependency. Normalization helps in simplifying the structure of tables.&lt;br /&gt;&lt;br /&gt;Suppose for an entity customer if attributes like cunno, name, address are required, then it can be perceived that for a particular cusno, only one name and address is possible. Hence the attribute name, address are said to be functionally dependent on the attribute cusno. There are four levels of normalization.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Denormalization &lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;br /&gt;&lt;/strong&gt;        Normalization helps in reducing redundancy. But at times when information is required from more than one table, at a faster rate, it is wiser to introduce some amount of redundancy in the table. This intentional introduction of redundancy in to the table is called Denormalization.&lt;br /&gt;&lt;br /&gt;For example, if the query were used to display the names of students and their marks obtained in each subject, then it would be advisable to maintain information about the students. Otherwise, every time such a query is made, a join will have to be carried out on the two tables. For the sake of better performance some amount of redundancy has to be introduced.&lt;br /&gt;&lt;br /&gt;The language widely used in relational database is Structured Query Language, more popularly known as SQL. It is the standard relational database access language. They can be roughly divided in to three categories based on their functions namely Data Definition Language, Data Manipulation Language and Data Control Language.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7243287038504660386-6562862747220391040?l=adobytescode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://adobytescode.blogspot.com/feeds/6562862747220391040/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7243287038504660386&amp;postID=6562862747220391040' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7243287038504660386/posts/default/6562862747220391040'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7243287038504660386/posts/default/6562862747220391040'/><link rel='alternate' type='text/html' href='http://adobytescode.blogspot.com/2007/12/normalization-and-denormalization.html' title='normalization and denormalization'/><author><name>ZeroCode</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7243287038504660386.post-2495067095380357462</id><published>2007-12-25T01:00:00.002-08:00</published><updated>2007-12-25T01:01:53.383-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SQL Server'/><title type='text'>sql server-11</title><content type='html'>What is de-normalization? When do you do it and how?&lt;br /&gt;De-normalization is the process of attempting to optimize the performance of a database by adding redundant data. It’s used To introduce redundancy into a table in order to incorporate data from a related table. The related table can then be eliminated. De-normalization can improve efficiency and performance by reducing complexity in a data warehouse schema. &lt;br /&gt;&lt;br /&gt;Explain features of SQL Server like Scalibility, Availability, Integration with Internet.&lt;br /&gt;Scalibility - The same Microsoft SQL Server 2000 database engine operates on Microsoft Windows 2000 Professional, Microsoft Windows 2000 Server, Microsoft Windows 2000 Advanced Server, Windows 98, and Windows Millennium Edition. It also runs on all editions of Microsoft Windows NT version 4.0. The database engine is a robust server that can manage terabyte-sized databases accessed by thousands of users. Availability - SQL Server 2000 can maintain the extremely high levels of availability required by large Web sites and enterprise systems. Integration -The SQL Server 2000 TCP/IP Sockets communications support can be integrated with Microsoft Proxy Server to implement secure Internet and intranet communications.&lt;br /&gt;&lt;br /&gt;What is DataWarehousing?&lt;br /&gt;A data warehouse is a collection of data gathered and organized so that it can easily by analyzed, extracted, synthesized, and otherwise be used for the purposes of further understanding the data. &lt;br /&gt;&lt;br /&gt;What is OLAP?&lt;br /&gt;OLAP is an acronym for On Line Analytical Processing. It is an approach to quickly provide the answer to analytical queries that are dimensional in nature. &lt;br /&gt;&lt;br /&gt;How do we upgrade SQL Server 7.0 to 2000?&lt;br /&gt;Run the installation of the SQL Server 2000&lt;br /&gt;In the Existing Installation dialog box, click Upgrade your existing installation, and then click Next.&lt;br /&gt;In the Upgrade dialog box, you are prompted as to whether you want to proceed with the requested upgrade. Click Yes, upgrade my to start the upgrade process, and then click Next. The upgrade runs until finished.&lt;br /&gt;In the Connect to Server dialog box, select an authentication mode, and then click Next.&lt;br /&gt;If you are not sure which mode to use, accept the default: The Windows account information I use to log on to my computer with (Windows). In Start Copying Files dialog box, click Next.&lt;br /&gt;Now your Sql Server would be upgraded. &lt;br /&gt;&lt;br /&gt;What is job?&lt;br /&gt;It can be defined as a task performed by a computer system. For example, printing a file is a job. Jobs can be performed by a single program or by a collection of programs. &lt;br /&gt;&lt;br /&gt;What is Task?&lt;br /&gt;Whenever you execute a program, the operating system creates a new task for it. The task is like an envelope for the program: it identifies the program with a task number and attaches other bookkeeping information to it.&lt;br /&gt;&lt;br /&gt;How do you find the error, how can you know the number of rows affected by last SQL Statement?&lt;br /&gt;Answer1&lt;br /&gt;@@errors-&gt;give the last error occured in the current DB.&lt;br /&gt;Ans. select @@rowcount &lt;br /&gt;&lt;br /&gt;Answer2.&lt;br /&gt;Use @@ERROR which returns the error number for the last Transact-SQL statement executed fro knowing the error.&lt;br /&gt;Use @@ROWCOUNT which returns the number of rows affected by the last statement for finding the no of rows affected.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7243287038504660386-2495067095380357462?l=adobytescode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://adobytescode.blogspot.com/feeds/2495067095380357462/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7243287038504660386&amp;postID=2495067095380357462' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7243287038504660386/posts/default/2495067095380357462'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7243287038504660386/posts/default/2495067095380357462'/><link rel='alternate' type='text/html' href='http://adobytescode.blogspot.com/2007/12/sql-server-11.html' title='sql server-11'/><author><name>ZeroCode</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7243287038504660386.post-1899134430242573386</id><published>2007-12-25T01:00:00.001-08:00</published><updated>2007-12-25T01:00:40.023-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SQL Server'/><title type='text'>sql server-10</title><content type='html'>What does it mean to have quoted_identifier on? What are the implications of having it off?&lt;br /&gt;SET QUOTED_IDENTIFIER ON- Causes SQL Server to follow the SQL-92 rules regarding quotation mark delimiting identifiers and literal strings. Identifiers delimited by double quotation marks can be either Transact-SQL reserved keywords or can contain characters not usually allowed by the Transact-SQL syntax rules for identifiers. &lt;br /&gt;&lt;br /&gt;What is the difference between a Local temporary table and a Global temporary table? How is each one used?&lt;br /&gt;Answer1: &lt;br /&gt;Local templrary table will have a single # (#tablename) appended with the table name.Global templrary table will have Double # (##tablename) appended with the table name.&lt;br /&gt;Ex:create table #table1&lt;br /&gt;local temp. table will be available until the session who created it logs out, but global temp. table is available till the last session gets close in SQLServer. &lt;br /&gt;&lt;br /&gt;Answer2:&lt;br /&gt;Local temporary tables are visible only in the current session; global temporary tables are visible to all sessions.Prefix local temporary table names with single number sign (#table_name), and prefix global temporary table names with a double number sign (##table_name).&lt;br /&gt;&lt;br /&gt;What are cursors? Name four type of cursors and when each one would be applied? &lt;br /&gt;Opening a cursor on a result set allows processing the result set one row at a time.&lt;br /&gt;The four API server cursor types supported by SQL Server are:&lt;br /&gt;a) Static cursors&lt;br /&gt;b) Dynamic cursors&lt;br /&gt;c) Forward-only cursors&lt;br /&gt;d) Keyset-driven cursors&lt;br /&gt;&lt;br /&gt;What is the purpose of UPDATE STATISTICS? &lt;br /&gt;UPDATE STATISTICS- it updates information about the distribution of key values for one or more statistics groups (collections) in the specified table or indexed view. &lt;br /&gt;&lt;br /&gt;How do you use DBCC statements to monitor various ASPects of a SQL Server installation?&lt;br /&gt;Database Consistency Checker (DBCC) - Is a statement used to check the logical and physical consistency of a database, check memory usage, decrease the size of a database, check performance statistics, and so on. Database consistency checker (DBCC) ensures the physical and logical consistency of a database, but is not corrective. DBCC can help in repairing or checking the installation in case of any failure. &lt;br /&gt;&lt;br /&gt;What is referential integrity and how can we achieve it?&lt;br /&gt;Referential integrity preserves the defined relationships between tables when records are entered or deleted. In SQL Server, referential integrity is based on relationships between foreign keys and primary keys or between foreign keys and unique keys. Referential integrity ensures that key values are consistent across tables. Such consistency requires that there be no references to nonexistent values and that if a key value changes, all references to it change consistently throughout the database.&lt;br /&gt;We can achieve this by using foreign key. &lt;br /&gt;&lt;br /&gt;What is indexing?&lt;br /&gt;If we give proper indexes on a table so that any queries written against this table can run efficiently. As your data sets grow over time, SQL Server will continue to rebuild indexes and move data around as efficiently as possible. This property is known as Indexing.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7243287038504660386-1899134430242573386?l=adobytescode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://adobytescode.blogspot.com/feeds/1899134430242573386/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7243287038504660386&amp;postID=1899134430242573386' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7243287038504660386/posts/default/1899134430242573386'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7243287038504660386/posts/default/1899134430242573386'/><link rel='alternate' type='text/html' href='http://adobytescode.blogspot.com/2007/12/sql-server-10.html' title='sql server-10'/><author><name>ZeroCode</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7243287038504660386.post-5288353363895467159</id><published>2007-12-25T00:55:00.000-08:00</published><updated>2007-12-25T00:59:53.308-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SQL Server'/><title type='text'>sql server-12</title><content type='html'>Which command using Query Analyzer will give you the version of SQL Server and Operating System?&lt;br /&gt;@@VERSION&lt;br /&gt;Returns version, processor architecture, build date, and operating system for the current installation of SQL Server. &lt;br /&gt;&lt;br /&gt;How to find the SQL server version from Query Analyser&lt;br /&gt;Answer1&lt;br /&gt;To determine which version of Microsoft SQL Server 2005 is running, connect to SQL Server 2005 by using SQL Server Management Studio, and then run the following Transact-SQL statement: &lt;br /&gt;SELECT SERVERPROPERTY(’productversion’), SERVERPROPERTY (’productlevel’), SERVERPROPERTY (’edition’) &lt;br /&gt;The results are:&lt;br /&gt;• The product version (for example, “9.00.1399.06?)&lt;br /&gt;. • The product level (for example, “RTM”).&lt;br /&gt;• The edition (for example, “Enterprise Edition”).&lt;br /&gt;For example, the result looks similar to:&lt;br /&gt;9.00.1399.06 RTM Enterprise Edition&lt;br /&gt;&lt;br /&gt;How to determine which version of SQL Server 2000 is running&lt;br /&gt;To determine which version of SQL Server 2000 is running, connect to SQL Server 2000 by using Query Analyzer, and then run the following code: &lt;br /&gt;SELECT SERVERPROPERTY(’productversion’), SERVERPROPERTY (’productlevel’), SERVERPROPERTY (’edition’)&lt;br /&gt;The results are:&lt;br /&gt;• The product version (for example, 8.00.534).&lt;br /&gt;• The product level (for example, “RTM” or “SP2?).&lt;br /&gt;• The edition (for example, “Standard Edition”). For example, the result looks similar to&lt;br /&gt;: &lt;br /&gt;8.00.534 RTM Standard Edition &lt;br /&gt;&lt;br /&gt;Answer2&lt;br /&gt;One can also use SELECT @@Version where the result would look like &lt;br /&gt;Microsoft SQL Server 2005 - 9.00.1399.06 (Intel X86)&lt;br /&gt;Oct 14 2005 00:33:37&lt;br /&gt;Copyright (c) 1988-2005 Microsoft Corporation&lt;br /&gt;Express Edition on Windows NT 5.1 (Build 2600: Service Pack 2)&lt;br /&gt;&lt;br /&gt;Using query analyzer, name 3 ways you can get an accurate count of the number of records in a table.&lt;br /&gt;Answer1.&lt;br /&gt;a. Select count(*) from table1&lt;br /&gt;b. SELECT object_name(id) ,rowcnt FROM sysindexes WHERE indid IN (1,0) AND OBJECTPROPERTY(id, ‘IsUserTable’) = 1&lt;br /&gt;c. exec sp_table_validation @table = ‘authors’ &lt;br /&gt;&lt;br /&gt;Answer2.&lt;br /&gt;SELECT count( * ) as totalrecords FROM employee&lt;br /&gt;This will display total records under the name totalrecords in the table employee&lt;br /&gt;use COUNT_BIG&lt;br /&gt;Returns the number of items in a group.&lt;br /&gt;@@ROWCOUNT&lt;br /&gt;Returns the number of rows affected by the last statement.&lt;br /&gt;Use this statement after an SQL select * statement, to retrieve the total number of rows in the table&lt;br /&gt;&lt;br /&gt;What is the purpose of using COLLATE in a query?&lt;br /&gt;Answer1.&lt;br /&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;br /&gt;&lt;br /&gt;Answer2.&lt;br /&gt;COLLATE is a clause that can be applied to a database definition or a column definition to define the collation, or to a character string expression to apply a collation cast. &lt;br /&gt;&lt;br /&gt;What is one of the first things you would do to increase performance of a query? For example, a boss tells you that “a query that ran yesterday took 30 seconds, but today it takes 6 minutes”?&lt;br /&gt;Answer1.&lt;br /&gt;Use Storedprocedure for any optimized result, because it is an compiled code. &lt;br /&gt;&lt;br /&gt;Answer2.&lt;br /&gt;One of the best ways to increase query performance is to use indexes. &lt;br /&gt;&lt;br /&gt;What is an execution plan? When would you use it? How would you view the execution plan?&lt;br /&gt;The Query Analyzer has a feature called Show Execution Plan. This option allows you to view the execution plan used by SQL Server’s Query Optimizer to actually execute the query. This option is available from the Query menu on the main menu of Query Analyzer, and must be turned on before the query is executed. Once the query is executed, the results of the execution plan are displayed in graphical format in a separate window, available from a tab that appears below the query results window on the screen. &lt;br /&gt;&lt;br /&gt;What is the STUFF function and how does it differ from the REPLACE function?&lt;br /&gt;Answer1:&lt;br /&gt;stuff-&gt; inserts into it without removing any thing. Replace-&gt;replace the given text with the new one. &lt;br /&gt;&lt;br /&gt;Answer2:&lt;br /&gt;STUFF - it deletes a specified length of characters and inserts another set of characters at a specified starting point. REPLACE -Replaces all occurrences of a specified string value with another string value.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7243287038504660386-5288353363895467159?l=adobytescode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://adobytescode.blogspot.com/feeds/5288353363895467159/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7243287038504660386&amp;postID=5288353363895467159' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7243287038504660386/posts/default/5288353363895467159'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7243287038504660386/posts/default/5288353363895467159'/><link rel='alternate' type='text/html' href='http://adobytescode.blogspot.com/2007/12/sql-server-12.html' title='sql server-12'/><author><name>ZeroCode</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7243287038504660386.post-3439662275219508386</id><published>2007-12-25T00:50:00.000-08:00</published><updated>2007-12-25T00:52:46.120-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='StoredProcedures'/><title type='text'>Stored Procedures</title><content type='html'>To test a Web Service you must create a windows application or web application to consume this service? It is True/False? &lt;br /&gt;FALSE &lt;br /&gt;&lt;br /&gt;How many classes can a single.NET DLL contain? &lt;br /&gt;Answer1:&lt;br /&gt;As many &lt;br /&gt;&lt;br /&gt;Answer2:&lt;br /&gt;One or more &lt;br /&gt;&lt;br /&gt;What are good ADO.NET object(s) to replace the ADO Recordset object? &lt;br /&gt;The differences includes &lt;br /&gt;In ADO, the in-memory representation of data is the recordset.&lt;br /&gt;In ADO.net, it is the dataset&lt;br /&gt;A recordset looks like a single table in ADO&lt;br /&gt;In contrast, a dataset is a collection of one or more tables in ADO.net&lt;br /&gt;ADO is designed primarily for connected access&lt;br /&gt;ADO.net the disconnected access to the database is used&lt;br /&gt;In ADO you communicate with the database by making calls to an OLE DB provider.&lt;br /&gt;In ADO.NET you communicate with the database through a data adapter (an OleDbDataAdapter, SqlDataAdapter, OdbcDataAdapter, or OracleDataAdapter object), which makes calls to an OLE DB provider or the APIs provided by the underlying data source. &lt;br /&gt;In ADO you cant update the database from the recordset. ADO.NET the data adapter allows you to control how the changes to the dataset are transmitted to the database. &lt;br /&gt;&lt;br /&gt;On order to get assembly info which namespace we should import? &lt;br /&gt;System.Reflection Namespace &lt;br /&gt;&lt;br /&gt;How do you declare a static variable and what is its lifetime? Give an example. &lt;br /&gt;Answer1&lt;br /&gt;static int Myint–The life time is during the entire application. &lt;br /&gt;br&gt; Answer2&lt;br /&gt;The static modifier is used to declare a static member, which belongs to the type itself rather than to a specific object. The static modifier can be used with fields, methods, properties, operators, events and constructors, but cannot be used with indexers, destructors, or types. In C#, the static keyword indicates a class variable. In VB, the equivalent keyword is Shared. Its scoped to the class in which it occurs. &lt;br /&gt;&lt;br /&gt;Example&lt;br /&gt;a. Static int var //in c#.net&lt;br /&gt;b. static void Time( ) //in c#.net&lt;br /&gt;&lt;br /&gt;How do you get records number from 5 to 15 in a dataset of 100 records? Write code.&lt;br /&gt;Answer1&lt;br /&gt;DataSet ds1=new DataSet(); String strCon=”data source=IBM-6BC8A0DACEF;initial catalog=pubs;integrated security=SSPI;persist” +” security info=False;user &lt;br /&gt;id=sa;workstation id=IBM-6BC8A0DACEF;packet size=4096?; &lt;br /&gt;String strCom1=”SELECT * FROM employee”;&lt;br /&gt;SqlDataAdapter sqlDa1=new SqlDataAdapter(strCom1,strCon);&lt;br /&gt;ds1.Tables.Add(”employee”);&lt;br /&gt;sqlDa1.Fill(ds1,40,50,ds1.Tables[”employee”].TableName);&lt;br /&gt;DataGrid dg1.DataSource=ds1.Tables[”employee”].DefaultView;&lt;br /&gt;dg1.DataBind();&lt;br /&gt;&lt;br /&gt;Answer2&lt;br /&gt;OleDbConnection1.Open()&lt;br /&gt;OleDbDataAdapter1.Fill(DataSet21, 5, 15, “tab”)&lt;br /&gt;This will fill the dataset with the records starting at 5 to 15&lt;br /&gt;.NET Database interview questions &lt;br /&gt;&lt;br /&gt;How do you call and execute a Stored Procedure in.NET? Give an example. &lt;br /&gt;Answer1&lt;br /&gt;ds1=new DataSet();&lt;br /&gt;sqlCon1=new SqlConnection(connectionstring);&lt;br /&gt;String strCom1=”byroyalty”;&lt;br /&gt;sqlCom1=new SqlCommand(strCom1,sqlCon1);&lt;br /&gt;sqlCom1.CommandType=CommandType.StoredProcedure;&lt;br /&gt;sqlDa1=new SqlDataAdapter(sqlCom1);&lt;br /&gt;SqlParameter myPar=new SqlParameter(”@percentage”,SqlDbType.Int);&lt;br /&gt;sqlCom1.Parameters.Add (myPar);&lt;br /&gt;myPar.Value=40;&lt;br /&gt;sqlDa1.Fill(ds1);&lt;br /&gt;dg1.DataSource=ds1;&lt;br /&gt;dg1.DataBind(); &lt;br /&gt;&lt;br /&gt;Answer2&lt;br /&gt;Yes&lt;br /&gt;Dim cn as new OleDbConnection ( “Provider=Microsoft.Jet.OLEDB.4.0;”+ _&lt;br /&gt;“Data Source=C:\Documents and Settings\User\My Documents\Visual Studio Projects\1209\db1.mdb”+ _&lt;br /&gt;“User ID=Admin;”+ _&lt;br /&gt;“Password=;”);&lt;br /&gt;Dim cmd As New OleDbCommand(”Products”, cn)&lt;br /&gt;cmd.CommandType = CommandType.StoredProcedure&lt;br /&gt;Dim da As New OleDataAdapter(cmd)&lt;br /&gt;Dim ds As New DataSet()&lt;br /&gt;da.Fill(ds, “Products”)&lt;br /&gt;DataGrid1.DataSource = ds.Tables(”Products”) &lt;br /&gt;&lt;br /&gt;What is the maximum length of a varchar in SQL Server? &lt;br /&gt;Answer1&lt;br /&gt;VARCHAR[(n)]&lt;br /&gt;Null-terminated Unicode character string of length n,&lt;br /&gt;with a maximum of 255 characters. If n is not supplied, then 1 is assumed. &lt;br /&gt;&lt;br /&gt;Answer2&lt;br /&gt;8000 &lt;br /&gt;&lt;br /&gt;Answer3&lt;br /&gt;The business logic is the aspx.cs or the aspx.vb where the code is being written. The presentation logic is done with .aspx extention.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7243287038504660386-3439662275219508386?l=adobytescode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://adobytescode.blogspot.com/feeds/3439662275219508386/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7243287038504660386&amp;postID=3439662275219508386' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7243287038504660386/posts/default/3439662275219508386'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7243287038504660386/posts/default/3439662275219508386'/><link rel='alternate' type='text/html' href='http://adobytescode.blogspot.com/2007/12/stored-procedures.html' title='Stored Procedures'/><author><name>ZeroCode</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7243287038504660386.post-7298861402149140145</id><published>2007-12-24T15:05:00.000-08:00</published><updated>2007-12-24T15:07:15.480-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='FAQS'/><title type='text'>faqs-88</title><content type='html'>&lt;em&gt;&lt;span style="color:#660000;"&gt;Can you explain the difference between an ADO.NET Dataset and an ADO Recordset?&lt;/span&gt;&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;Let’s take a look at the differences between ADO Recordset and ADO.Net DataSet:&lt;br /&gt;&lt;br /&gt;1. Table Collection: ADO Recordset provides the ability to navigate through a single table of information. That table would have been formed with a join of multiple tables and returning columns from multiple tables. ADO.NET DataSet is capable of holding instances of multiple tables. It has got a Table Collection, which holds multiple tables in it. If the tables are having a relation, then it can be manipulated on a Parent-Child relationship. It has the ability to support multiple tables with keys, constraints and interconnected relationships. With this ability the DataSet can be considered as a small, in-memory relational database cache.&lt;br /&gt;&lt;br /&gt;2. Navigation: Navigation in ADO Recordset is based on the cursor mode. Even though it is specified to be a client-side Recordset, still the navigation pointer will move from one location to another on cursor model only. ADO.NET DataSet is an entirely offline, in-memory, and cache of data. All of its data is available all the time. At any time, we can retrieve any row or column, constraints or relation simply by accessing it either ordinarily or by retrieving it from a name-based collection.&lt;br /&gt;&lt;br /&gt;3. Connectivity Model: The ADO Recordset was originally designed without the ability to operate in a disconnected environment. ADO.NET DataSet is specifically designed to be a disconnected in-memory database. ADO.NET DataSet follows a pure disconnected connectivity model and this gives it much more scalability and versatility in the amount of things it can do and how easily it can do that.&lt;br /&gt;&lt;br /&gt;4. Marshalling and Serialization: In COM, through Marshalling, we can pass data from 1 COM component to another component at any time. Marshalling involves copying and processing data so that a complex type can appear to the receiving component the same as it appeared to the sending component. Marshalling is an expensive operation. ADO.NET Dataset and DataTable components support Remoting in the form of XML serialization. Rather than doing expensive Marshalling, it uses XML and sent data across boundaries.&lt;br /&gt;&lt;br /&gt;5. Firewalls and DCOM and Remoting: Those who have worked with DCOM know that how difficult it is to marshal a DCOM component across a router. People generally came up with workarounds to solve this issue. ADO.NET DataSet uses Remoting, through which a DataSet / DataTable component can be serialized into XML, sent across the wire to a new AppDomain, and then Desterilized back to a fully functional DataSet. As the DataSet is completely disconnected, and it has no dependency, we lose absolutely nothing by serializing and transferring it through Remoting.&lt;br /&gt;&lt;br /&gt;&lt;em&gt;&lt;span style="color:#660000;"&gt;How do you handle data concurrency in .NET ? &lt;/span&gt;&lt;/em&gt;&lt;br /&gt;&lt;em&gt;&lt;span style="color:#660000;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/em&gt;One of the key features of the ADO.NET DataSet is that it can be a self-contained and disconnected data store. It can contain the schema and data from several rowsets in DataTable objects as well as information about how to relate the DataTable objects-all in memory. The DataSet neither knows nor cares where the data came from, nor does it need a link to an underlying data source. Because it is data source agnostic you can pass the DataSet around networks or even serialize it to XML and pass it across the Internet without losing any of its features. However, in a disconnected model, concurrency obviously becomes a much bigger problem than it is in a connected model.&lt;br /&gt;In this column, I'll explore how ADO.NET is equipped to detect and handle concurrency violations. I'll begin by discussing scenarios in which concurrency violations can occur using the ADO.NET disconnected model. Then I will walk through an ASP.NET application that handles concurrency violations by giving the user the choice to overwrite the changes or to refresh the out-of-sync data and begin editing again. Because part of managing an optimistic concurrency model can involve keeping a timestamp (rowversion) or another type of flag that indicates when a row was last updated, I will show how to implement this type of flag and how to maintain its value after each database update.&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;Is Your Glass Half Full?&lt;br /&gt;&lt;br /&gt;There are three common techniques for managing what happens when users try to modify the same data at the same time: pessimistic, optimistic, and last-in wins. They each handle concurrency issues differently.&lt;br /&gt;&lt;br /&gt;The pessimistic approach says: "Nobody can cause a concurrency violation with my data if I do not let them get at the data while I have it." This tactic prevents concurrency in the first place but it limits scalability because it prevents all concurrent access. Pessimistic concurrency generally locks a row from the time it is retrieved until the time updates are flushed to the database. Since this requires a connection to remain open during the entire process, pessimistic concurrency cannot successfully be implemented in a disconnected model like the ADO.NET DataSet, which opens a connection only long enough to populate the DataSet then releases and closes, so a database lock cannot be held.&lt;br /&gt;&lt;br /&gt;Another technique for dealing with concurrency is the last-in wins approach. This model is pretty straightforward and easy to implement-whatever data modification was made last is what gets written to the database. To implement this technique you only need to put the primary key fields of the row in the UPDATE statement's WHERE clause. No matter what is changed, the UPDATE statement will overwrite the changes with its own changes since all it is looking for is the row that matches the primary key values. Unlike the pessimistic model, the last-in wins approach allows users to read the data while it is being edited on screen. However, problems can occur when users try to modify the same data at the same time because users can overwrite each other's changes without being notified of the collision. The last-in wins approach does not detect or notify the user of violations because it does not care. However the optimistic technique does detect violations.&lt;br /&gt;&lt;br /&gt;In optimistic concurrency models, a row is only locked during the update to the database. Therefore the data can be retrieved and updated by other users at any time other than during the actual row update operation. Optimistic concurrency allows the data to be read simultaneously by multiple users and blocks other users less often than its pessimistic counterpart, making it a good choice for ADO.NET. In optimistic models, it is important to implement some type of concurrency violation detection that will catch any additional attempt to modify records that have already been modified but not committed. You can write your code to handle the violation by always rejecting and canceling the change request or by overwriting the request based on some business rules. Another way to handle the concurrency violation is to let the user decide what to do. The sample application that is shown in Figure 1 illustrates some of the options that can be presented to the user in the event of a concurrency violation.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7243287038504660386-7298861402149140145?l=adobytescode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://adobytescode.blogspot.com/feeds/7298861402149140145/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7243287038504660386&amp;postID=7298861402149140145' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7243287038504660386/posts/default/7298861402149140145'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7243287038504660386/posts/default/7298861402149140145'/><link rel='alternate' type='text/html' href='http://adobytescode.blogspot.com/2007/12/faqs-88.html' title='faqs-88'/><author><name>ZeroCode</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7243287038504660386.post-4134406404498784680</id><published>2007-12-24T14:55:00.000-08:00</published><updated>2007-12-24T15:04:04.910-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='FAQS'/><title type='text'>connection objcts</title><content type='html'>Explain what a diffgram is and its usage ?&lt;br /&gt;&lt;br /&gt;A DiffGram is an XML format that is used to identify current and original versions of data elements. The DataSet uses the DiffGram format to load and persist its contents, and to serialize its contents for transport across a network connection. When a DataSet is written as a DiffGram, it populates the DiffGram with all the necessary information to accurately recreate the contents, though not the schema, of the DataSet, including column values from both the Original and Current row versions, row error information, and row order.&lt;br /&gt;When sending and retrieving a DataSet from an XML Web service, the DiffGram format is implicitly used. Additionally, when loading the contents of a DataSet from XML using the ReadXml method, or when writing the contents of a DataSet in XML using the WriteXml method, you can select that the contents be read or written as a DiffGram.&lt;br /&gt;The DiffGram format is divided into three sections: the current data, the original (or "before") data, and an errors section, as shown in the following example.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;?xml:namespace prefix = diffgr /&gt;&lt;diffgr:diffgram msdata="urn:schemas-microsoft-com:xml-msdata" diffgr="urn:schemas-microsoft-com:xml-diffgram-v1" xsd="http://www.w3.org/2001/XMLSchema"&gt;&lt;br /&gt;&lt;datainstance&gt;&lt;br /&gt;&lt;/datainstance&gt;&lt;br /&gt;&lt;diffgr:before&gt;&lt;br /&gt;&lt;/diffgr:before&gt;&lt;br /&gt;&lt;diffgr:errors&gt;&lt;br /&gt;&lt;/diffgr:errors&gt;&lt;br /&gt;&lt;/diffgr:diffgram&gt;&lt;br /&gt;The DiffGram format consists of the following blocks of data:&lt;br /&gt;&lt;datainstance&gt;&lt;br /&gt;&lt;br /&gt;The name of this element, DataInstance, is used for explanation purposes in this documentation. A DataInstance element represents a DataSet or a row of a DataTable. Instead of DataInstance, the element would contain the name of the DataSet or DataTable. This block of the DiffGram format contains the current data, whether it has been modified or not. An element, or row, that has been modified is identified with the diffgr:hasChanges annotation.&lt;br /&gt;&lt;diffgr:before&gt;&lt;br /&gt;&lt;br /&gt;This block of the DiffGram format contains the original version of a row. Elements in this block are matched to elements in the DataInstance block using the diffgr:id annotation.&lt;br /&gt;&lt;diffgr:errors&gt;&lt;br /&gt;&lt;br /&gt;This block of the DiffGram format contains error information for a particular row in the DataInstance block. Elements in this block are matched to elements in the DataInstance block using the diffgr:id annotation.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Which method do you invoke on the DataAdapter control to load your generated dataset with data?&lt;br /&gt;You have to use the Fill method of the DataAdapter control and pass the dataset object as an argument to load the generated data.&lt;br /&gt;Can you edit data in the Repeater control?&lt;br /&gt;NO.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Which are the different IsolationLevels ?&lt;br /&gt;&lt;br /&gt;Following are the various IsolationLevels:&lt;br /&gt;&lt;br /&gt;• Serialized Data read by a current transaction cannot be changed by another transaction until the current transaction finishes. No new data can be inserted that would affect the current transaction. This is the safest isolation level and is the default.&lt;br /&gt;&lt;br /&gt;• Repeatable Read Data read by a current transaction cannot be changed by another transaction until the current transaction finishes. Any type of new data can be inserted during a transaction.&lt;br /&gt;&lt;br /&gt;• Read Committed A transaction cannot read data that is being modified by another transaction that has not committed. This is the default isolation level in Microsoft® SQL Server.&lt;br /&gt;&lt;br /&gt;• Read Uncommitted A transaction can read any data, even if it is being modified by another transaction. This is the least safe isolation level but allows the highest concurrency.&lt;br /&gt;&lt;br /&gt;• Any Any isolation level is supported. This setting is most commonly used by downstream components to avoid conflicts. This setting is useful because any downstream component must be configured with an isolation level that is equal to or less than the isolation level of its immediate upstream component. Therefore, a downstream component that has its isolation level configured as Any always uses the same isolation level that its immediate upstream component uses. If the root object in a transaction has its isolation level configured to Any, its isolation level becomes Serialized.&lt;br /&gt;&lt;br /&gt;How xml files and be read and write using dataset?.&lt;br /&gt;DataSet exposes method like ReadXml and WriteXml to read and write xml&lt;br /&gt;&lt;br /&gt;What are the different rowversions available?&lt;br /&gt;&lt;br /&gt;There are four types of Rowversions.&lt;br /&gt;Current:&lt;br /&gt;The current values for the row. This row version does not exist for rows with a RowState of Deleted.&lt;br /&gt;Default :&lt;br /&gt;The row the default version for the current DataRowState. For a DataRowState value of Added, Modified or Current, the default version is Current. For a DataRowState of Deleted, the version is Original. For a DataRowState value of Detached, the version is Proposed.&lt;br /&gt;Original:&lt;br /&gt;The row contains its original values.&lt;br /&gt;Proposed:&lt;br /&gt;The proposed values for the row. This row version exists during an edit operation on a row, or for a row that is not part of a DataRowCollection&lt;br /&gt;&lt;br /&gt;What are different types of Commands available with DataAdapter ?&lt;br /&gt;The SqlDataAdapter has SelectCommand, InsertCommand, DeleteCommand and UpdateCommand&lt;br /&gt;What is a Dataset?&lt;br /&gt;Datasets are the result of bringing together ADO and XML. A dataset contains one or more data of tabular XML, known as DataTables, these data can be treated separately, or can have relationships defined between them. Indeed these relationships give you ADO data SHAPING without needing to master the SHAPE language, which many people are not comfortable with.&lt;br /&gt;The dataset is a disconnected in-memory cache database. The dataset object model looks like this:&lt;br /&gt;&lt;br /&gt;Dataset&lt;br /&gt;DataTableCollection&lt;br /&gt;DataTable&lt;br /&gt;DataView&lt;br /&gt;DataRowCollection&lt;br /&gt;DataRow&lt;br /&gt;DataColumnCollection&lt;br /&gt;DataColumn&lt;br /&gt;ChildRelations&lt;br /&gt;ParentRelations&lt;br /&gt;Constraints&lt;br /&gt;PrimaryKey&lt;br /&gt;DataRelationCollection&lt;br /&gt;&lt;br /&gt;Let’s take a look at each of these:&lt;br /&gt;&lt;br /&gt;DataTableCollection: As we say that a DataSet is an in-memory database. So it has this collection, which holds data from multiple tables in a single DataSet object.&lt;br /&gt;&lt;br /&gt;DataTable: In the DataTableCollection, we have DataTable objects, which represents the individual tables of the dataset.&lt;br /&gt;&lt;br /&gt;DataView: The way we have views in database, same way we can have DataViews. We can use these DataViews to do Sort, filter data.&lt;br /&gt;DataRowCollection: Similar to DataTableCollection, to represent each row in each Table we have DataRowCollection.&lt;br /&gt;&lt;br /&gt;DataRow: To represent each and every row of the DataRowCollection, we have DataRows.&lt;br /&gt;DataColumnCollection: Similar to DataTableCollection, to represent each column in each Table we have DataColumnCollection.&lt;br /&gt;&lt;br /&gt;DataColumn: To represent each and every Column of the DataColumnCollection, we have DataColumn.&lt;br /&gt;&lt;br /&gt;PrimaryKey: Dataset defines Primary key for the table and the primary key validation will take place without going to the database.&lt;br /&gt;Constraints: We can define various constraints on the Tables, and can use Dataset.Tables(0).enforceConstraints. This will execute all the constraints, whenever we enter data in DataTable.&lt;br /&gt;&lt;br /&gt;DataRelationCollection: as we know that we can have more than 1 table in the dataset, we can also define relationship between these tables using this collection and maintain a parent-child relationship.&lt;br /&gt;&lt;br /&gt;&lt;em&gt;Explain the ADO . Net Architecture ( .Net Data Provider)&lt;br /&gt;&lt;/em&gt;&lt;br /&gt;ADO.Net is the data access model for .Net –based applications. It can be used to access relational database systems such as SQL SERVER 2000, Oracle, and many other data sources for which there is an OLD DB or ODBC provider. To a certain extent, ADO.NET represents the latest evolution of ADO technology. However, ADO.NET introduces some major changes and innovations that are aimed at the loosely coupled and inherently disconnected – nature of web applications. &lt;/diffgr:errors&gt;&lt;/diffgr:before&gt;&lt;br /&gt;&lt;diffgr:before&gt;&lt;diffgr:errors&gt;&lt;br /&gt;A .Net Framework data provider is used to connecting to a database, executing commands, and retrieving results. Those results are either processed directly, or placed in an ADO.NET DataSet in order to be exposed to the user in an ad-hoc manner, combined with data from multiple sources, or remoted between tiers. The .NET Framework data provider is designed to be lightweight, creating a minimal layer between the data source and your code, increasing performance without sacrificing functionality.&lt;br /&gt;Following are the 4 core objects of .Net Framework Data provider:&lt;br /&gt;&lt;br /&gt;• Connection: Establishes a connection to a specific data source&lt;br /&gt;&lt;br /&gt;• Command: Executes a command against a data source. Exposes Parameters and can execute within the scope of a Transaction from a Connection.&lt;br /&gt;&lt;br /&gt;• DataReader: Reads a forward-only, read-only stream of data from a data source.&lt;br /&gt;&lt;br /&gt;• DataAdapter: Populates a DataSet and resolves updates with the data source.&lt;br /&gt;The .NET Framework includes the .NET Framework Data Provider for SQL Server (for Microsoft SQL Server version 7.0 or later), the .NET Framework Data Provider for OLE DB, and the .NET Framework Data Provider for ODBC.&lt;br /&gt;The .NET Framework Data Provider for SQL Server: The .NET Framework Data Provider for SQL Server uses its own protocol to communicate with SQL Server. It is lightweight and performs well because it is optimized to access a SQL Server directly without adding an OLE DB or Open Database Connectivity (ODBC) layer. The following illustration contrasts the .NET Framework Data Provider for SQL Server with the .NET Framework Data Provider for OLE DB. The .NET Framework Data Provider for OLE DB communicates to an OLE DB data source through both the OLE DB Service component, which provides connection pooling and transaction services, and the OLE DB Provider for the data source&lt;br /&gt;The .NET Framework Data Provider for OLE DB: The .NET Framework Data Provider for OLE DB uses native OLE DB through COM interoperability to enable data access. The .NET Framework Data Provider for OLE DB supports both local and distributed transactions. For distributed transactions, the .NET Framework Data Provider for OLE DB, by default, automatically enlists in a transaction and obtains transaction details from Windows 2000 Component Services.&lt;br /&gt;The .NET Framework Data Provider for ODBC: The .NET Framework Data Provider for ODBC uses native ODBC Driver Manager (DM) through COM interoperability to enable data access. The ODBC data provider supports both local and distributed transactions. For distributed transactions, the ODBC data provider, by default, automatically enlists in a transaction and obtains transaction details from Windows 2000 Component Services.&lt;br /&gt;The .NET Framework Data Provider for Oracle: The .NET Framework Data Provider for Oracle enables data access to Oracle data sources through Oracle client connectivity software. The data provider supports Oracle client software version 8.1.7 and later. The data provider supports both local and distributed transactions (the data provider automatically enlists in existing distributed transactions, but does not currently support the EnlistDistributedTransaction method).&lt;br /&gt;The .NET Framework Data Provider for Oracle requires that Oracle client software (version 8.1.7 or later) be installed on the system before you can use it to connect to an Oracle data source.&lt;br /&gt;.NET Framework Data Provider for Oracle classes are located in the System.Data.OracleClient namespace and are contained in the System.Data.OracleClient.dll assembly. You will need to reference both the System.Data.dll and the System.Data.OracleClient.dll when compiling an application that uses the data provider.&lt;br /&gt;Choosing a .NET Framework Data Provider&lt;br /&gt;.NET Framework Data Provider for SQL Server: Recommended for middle-tier applications using Microsoft SQL Server 7.0 or later. Recommended for single-tier applications using Microsoft Data Engine (MSDE) or Microsoft SQL Server 7.0 or later.&lt;br /&gt;Recommended over use of the OLE DB Provider for SQL Server (SQLOLEDB) with the .NET Framework Data Provider for OLE DB. For Microsoft SQL Server version 6.5 and earlier, you must use the OLE DB Provider for SQL Server with the .NET Framework Data Provider for OLE DB.&lt;br /&gt;.NET Framework Data Provider for OLE DB: Recommended for middle-tier applications using Microsoft SQL Server 6.5 or earlier, or any OLE DB provider. For Microsoft SQL Server 7.0 or later, the .NET Framework Data Provider for SQL Server is recommended. Recommended for single-tier applications using Microsoft Access databases. Use of a Microsoft Access database for a middle-tier application is not recommended.&lt;br /&gt;.NET Framework Data Provider for ODBC: Recommended for middle-tier applications using ODBC data sources. Recommended for single-tier applications using ODBC data sources.&lt;br /&gt;.NET Framework Data Provider for Oracle: Recommended for middle-tier applications using Oracle data sources. Recommended for single-tier applications using Oracle data sources. Supports Oracle client software version 8.1.7 and later. The .NET Framework Data Provider for Oracle classes are located in the System.Data.OracleClient namespace and are contained in the System.Data.OracleClient.dll assembly. You need to reference both the System.Data.dll and the System.Data.OracleClient.dll when compiling an application that uses the data provider&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/diffgr:errors&gt;&lt;/diffgr:before&gt;&lt;diffgr:before&gt;&lt;diffgr:errors&gt;&lt;/diffgr:errors&gt;&lt;/diffgr:before&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7243287038504660386-4134406404498784680?l=adobytescode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://adobytescode.blogspot.com/feeds/4134406404498784680/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7243287038504660386&amp;postID=4134406404498784680' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7243287038504660386/posts/default/4134406404498784680'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7243287038504660386/posts/default/4134406404498784680'/><link rel='alternate' type='text/html' href='http://adobytescode.blogspot.com/2007/12/connection-objcts.html' title='connection objcts'/><author><name>ZeroCode</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>
