You are on page 1of 66

Difference between SQL Server 2008 and SQL Server 2012 Difference between SQL Server 2008 and

SQL Server 2012 S.No 1 SQL Server 2008 Maximum number of concurrent connections: The Maximum number of concurrent connections to SQL Server 2008 is 32767. Precision used for spatial calculations: The SQL Server 2008 uses 27 bit bit precision for spatial calculations. TRY_CONVERT() and FORMAT() functions: TRY_CONVERT() and FORMAT() functions are not available in SQL Server 2008 ORDER BY Clause with OFFSET / FETCH options: ORDER BY Clause does not have OFFSET / FETCH options as in SQL Server 2012 SQL Server 2012 Maximum number of concurrent connections: SQL server 2012 has unlimited concurrent connections. Precision used for spatial calculations: The SQL Server 2012 uses 48 bit precision for spatial calculations TRY_CONVERT() and FORMAT() functions: TRY_CONVERT() and FORMAT() functions are newly included in SQL Server 2012 ORDER BY Clause with OFFSET / FETCH options: ORDER BY Clause now have OFFSET / FETCH options to use paging to show required rows per page in applications and allow the user to scroll through each page of results rather than download the entire set In the sample query below, SQL Server would return 10 records beginning with record 11. The OFFSET command provides a starting point for the SELECT statement in terms of paging, and the FETCH command provides how many records to return at a time. SELECT BusinessEntityID, FirstName, LastName FROM Person.Person ORDER BY BusinessEntityID OFFSET 10 ROWS FETCH NEXT 10 ROWS ONLY;

Code Name: SQL Server 2008 is code named as Katmai. In SQL Server 2008, audit is an Enterprise-only feature. Only available in Enterprise, Evaluation, and Developer Edition.

Code Name: SQL Server 2012 is code named as Denali In SQL Server 2012,support for server auditing is expanded to include all editions of SQL Server.

Sequence Object: Sequence is not available in SQL Server 2008

Sequence Object: Sequence is included in SQL Server 2012.Sequence is a user defined object that generates a sequence of a number. Here is an example using Sequence. /****** Create Sequence Object ******/ CREATE SEQUENCE MySequence START WITH 1 INCREMENT BY 1; /****** Create Temp Table ******/ DECLARE @Person TABLE ( ID int NOT NULL PRIMARY KEY, FullName nvarchar(100) NOT NULL ); /****** Insert Some Data ******/ INSERT @Person (ID, FullName) VALUES (NEXT VALUE FOR MySequence, 'Umar Ali'), (NEXT VALUE FOR MySequence, 'John Peter'), (NEXT VALUE FOR MySequence, 'Mohamed Iqbal'); /****** Show the Data ******/ SELECT * FROM @Person; The results would look like this: ID FullName 1 Umar Ali 2 John Peter 3 Mohamed Iqbal

Full Text Search Capability: The Full Text Search in SQL Server 2008 does not allow us to search and index data stored in extended properties or metadata.

Full Text Search Capability: The Full Text Search in SQL Server 2012 has been enhanced by allowing us to search and index data stored in extended properties or metadata. Consider a PDF document that has "properties" filled in like Name, Type, Folder path, Size, Date Created, etc. In the newest release of SQL Server, this data could be indexes and searched along with the data in the document itself. The data does have to be exposed to work, but it's possible now. BISM Model: Analysis Services will include a new BI Semantic Model (BISM). BISM is a 3-layer model that includes: Data Model Business Logic Data Access BISM will enhance Microsoft's front end analysis experiencing including Excel, Reporting Services and SharePoint Insights. Microsoft has said that BISM is not a replacement for the current BI Models but more of an alternative model. In simple terms, BISM is a relation model that includes BI artifact such as KPIs and hierarchies.

BISM Model: Analysis Services in SQL Server does not have BI Semantic Model (BISM) concept.

Reference: http://onlydifferencefaqs.blogspot.in/2012/08/difference-between-sql-server2008-and.html

SQL Server Difference FAQs-1 1. What are the Differences between TRUNCATE and Delete? S.No 1 2 3 4 5 Truncate Truncate is faster Removes all rows from a table Is DDL Command Resets identity of the table Removes the data by deallocating the data pages and logs the deallocation. Cannot be rolled back Delete Delete is comparatively slower Can remove specific rows with Where clause Is DML Command Does not reset identity of the table Removes one row at a time and records an entry in the transaction log for each deleted row. Can be rolled back

2. What are the differences between Primary key and Unique key? S.No 1 2 Primary Key Creates Clustered index Null values are not allowed Unique Key Creates Non-Clustered index Allows only one null value

3. What are the Differences between Clustered Indexes and Non-Clustered Indexes? S.No 1 2 3 4 Clustered Indexes It reorders the physical storage of records in the table There can be only one Clustered index per table The leaf nodes contain data To create clustered index Sql server required more memory because the leaf pages in the tree structure will maintain actual data . By using clustered index retrieving data is more faster,when we compare with non-clustered index. Non-Clustered Indexes It sorts and maintain a separate storage We can have 249 non-clustered indexes in a table The leaf node contains pointer to data To create non-clustered index Sql server requires less memory because the leaf pages will contain pointers to actual data By using non-clustered index retrieving data is slower than clustered index.

4. What are the differences between Stored Procedures and User Defined Functions?

S.No 1 2 3

Stored Procedures Stored Procedure cannot be used in a Select statement Stored procedure supports Deferred Name Resolution Stored Procedures are generally used for performing Business Logic Stored Procedure need not return a value Stored Procedures can return any datatype Stored Procedures can accept more number of input parameters than User Defined Functions. Stored Procedures can have upto 21000 input parameters Stored Procedures can use Temporary Tables Stored Procedures can execute Dynamic SQL Stored Procedure supports error handling

User Defined Functions User Defined Function can be used in a Select statement User Defined Function does not support Deferred Name Resolution User Defined Functions are generally used for Computations User Defined Functions should return a value User Defined Functions cannot return Image User Defined Functions accept lesser number of input parameters than Stored Procedures. UDF can have upto 1023 input parameters

4 5 6

7 8 9

Temporary Tables cannot be used in a User Defined Function User Defined Functions cannot execute Dynamic SQL User Defined Function does not support error handling. RAISEERROR or @@ERROR are not allowed in UDFs Non-deterministic functions cannot be used in User Defined Functions (UDFs). For example, GETDATE() cannot be used in User Defined Functions(UDFs)

10

Non-deterministic functions can be used in Stored Procedures.

5. What are the differences between Where and Having clauses? S.No 1 2 3 4 Where clause It applies to individual rows It selects rows before grouping It cannot contain aggregate functions It can be used in select, delete Having clause It applies to a group as a whole It selects rows after grouping It can contain aggregate functions It is used only in select clause

,insert etc. 6. What are the differences between Union and UnionAll? S.No 1 2 3 4 5 6 Union This is used to eliminate duplicate rows This selects only distinct rows It can be used to combine any number of queries It cannot contain aggregate functions Union is slower than UnionAll Output is in sorted order Example : SELECT Col FROM @Table1 UNION SELECT Col FROM @Table2 Result: 1 2 3 5 UnionAll It will not eliminate duplicate rows It selects all the values It can be used to combine maximum of 2 queries It can contain aggregate functions UnionAll is faster than Union Output is not in sorted order Example : SELECT Col FROM @Table1 UNION ALL SELECT Col FROM @Table2 Result: 1 2 3 2 5

7. What is the difference between normal Select statement and a Cursor? S.No 1 Select statement Cursor

Select statements are used for Cursors are used for row-level table-level processing processing

Reference: http://onlydifferencefaqs.blogspot.in/2012/07/sql-server-difference-faqs1_11.html SQL Server Difference FAQs-2 1. What are the differences between Instead of Triggers and After Triggers? S.No 1 Instead of Triggers Each table or view can have one After Triggers A table can have several AFTER

INSTEAD OF trigger for each triggering action (UPDATE, DELETE, and INSERT) 2 INSTEAD OF triggers fire in place of the triggering action and before constraints are processed.

triggers for each triggering action.

AFTER triggers fire after the triggering action (INSERT, UPDATE, or DELETE) and after any constraints are processed.

2. What are the differences between Views and User-Defined Functions? S.No 1 2 Views Views cannot accept parameters. Output of the Views cannot be directly used in the SELECT clause. User-Defined Functions User-Defined Functions can accept parameters. Output of the User-Defined Functions can be directly used in the SELECT clause.

3. What are the differences between Triggers and Stored Procedures? S.No 1 2 3 4 Triggers Triggers cannot return a value We cannot pass parameters in Triggers We can write a Stored procedure within a Trigger Triggers are implicitly fired whenever insert, update or delete operations take place on table Stored Procedures Stored Procedures may return a value We can pass parameter in Stored Procedures We cannot write a Trigger within a Stored Procedure Stored Procedures need to be explicitly called by the programmer

5 6

Triggers can only be implemented Stored procedures can be written for on Tables or Views the Database We cannot schedule a trigger. Stored procedures can be scheduled through a job to execute on a predefined time We can use the Print commands inside the stored procedure for debugging purpose We can call a stored procedure from front end (.asp files, .aspx files, .ascx files etc.)

We cannot use the print command inside a trigger. We cannot call a trigger from these files.

Reference: http://onlydifferencefaqs.blogspot.in/2012/07/sql-server-difference-faqs-2.html

SQL Server Difference FAQs-3 1.Difference between Identity and Sequence in SQL Server 2012 S.No 1 2 Identity Dependant on table. Identity is a property in a table. Example : CREATE TABLE Table test_Identity ( [ID] int Identity (1,1), [Product Name] varchar(50) ) Sequence Independent from table. Sequence is an object. Example : CREATE SEQUENCE [dbo]. [Sequence_ID] AS [int] START WITH 1 INCREMENT BY 1 MINVALUE 1 MAXVALUE 1000 NO CYCLE NO CACHE 3 If we need a new ID from an identity column we need to insert and then get new ID. Example : Insert into [test_Identity] Values (SQL Server) GO SELECT @@IDENTITY AS Identity OR Select SCOPE_IDENTITY() AS Identity 4 We cannot perform a cycle in identity column. Meaning, we In the sequence, we can simply add one property to make it a In the sequence, we do not need to insert new ID, we can view the new ID directly. Example : SELECT NEXT VALUE FOR dbo.[Sequence_ID]

cannot restart the counter after a particular interval.

cycle. Example : ALTER SEQUENCE [dbo]. [Sequence_ID] CYCLE;

We cannot cache Identity column property.

Sequence can be easily cached by just setting cache property of sequence. It also improves the performance. Example : ALTER SEQUENCE [dbo]. [Sequence_ID] CACHE 3;

We cannot remove the identity column from the table directly.

The sequence is not table dependent so we can easily remove it Example : Create table dbo.[test_Sequence] ( [ID] int, [Product Name] varchar(50) ) GO First Insert With Sequence object INSERT INTO dbo.test_Sequence ([ID],[Product Name]) VALUES (NEXT VALUE FOR [Ticket] , MICROSOFT SQL SERVER 2008) GO Second Insert without Sequence INSERT INTO dbo.test_Sequence

([ID],[Product Name]) VALUES (2 , MICROSOFT SQL SERVER 2012) 7 We cannot define the maximum value in identity column it is based on the data type limit. Here we can set up its maximum value. Example : ALTER SEQUENCE [dbo]. [Sequence_ID] MAXVALUE 2000; 8 We can reseed it but cannot change the step size. Example : DBCC CHECKIDENT (test_Identity, RESEED, 4) We can reseed as well as change the step size. Example : ALTER SEQUENCE [dbo]. [Sequence_ID] RESTART WITH 7 INCREMENT BY 2; 9 We cannot generate range from identity. We can generate a range of sequence values from a sequence object with the help of sp_sequence_get_range.

2.Difference between Temp table and Table variable S.No 1 Temp table A Temp table is easy to create and back up data. Temp table result can be used by multiple users. Temp table will be stored in the tempdb. It will make network traffic. When we have large data in the temp table then it has to work across the database. A Performance issue will exist. Table variable But the table variable involves the effort when we usually create the normal tables. But the table variable can be used by the current user only. But a table variable will store in the physical memory for some of the data, then later when the size increases it will be moved to the tempdb.

2 3

Temp table can do all the DDL operations. It allows creating the indexes, dropping, altering, etc.., Temp table can be used for the current session or global. So that a multiple user session can utilize the results in the table. Temp variable cannot use the transactions. When we do the DML operations with the temp table then it can be rollback or commit the transactions. Functions cannot use the temp variable. More over we cannot do the DML operation in the functions . The stored procedure will do the recompilation (can't use same execution plan) when we use the temp variable for every sub sequent calls.

Whereas table variable won't allow doing the DDL operations. But the table variable allows us to create the clustered index only. But the table variable can be used up to that program. (Stored procedure)

But we cannot do it for table variable.

But the function allows us to use the table variable. But using the table variable we can do that. Whereas the table variable won't do like that.

Another Good Reference: http://sqljunkieshare.com/2011/11/05/difference-between-temporary-tables-and-tablevariables/ 3.Difference between RAISERROR and THROW statements S.No 1 RAISERROR Statement If a msg_id is passed to RAISERROR, the ID must be defined in sys.messages. The msg_str parameter can contain printf formatting styles. The severity parameter specifies the severity of the exception. THROW Statement The error_number parameter does not have to be defined in sys.messages. The message parameter does not accept printf style formatting. There is no severity parameter. The exception severity is always set to 16.

2 3

4.Difference between Local temporary table and Global temporary table

S.No 1 2

Local temporary table Denoted by # symbol. Valid for the current connection only. They are cleared as soon as the current connection closes. Cannot be shared between multiple users.

Global temporary table Denoted by ## symbol. Available to all the connections once created. They are deleted when all users referencing the table disconnect from SQL Server . Can be shared between multiple users.

Reference: http://onlydifferencefaqs.blogspot.in/2012/07/sql-server-difference-faqs-3.html SQL Server Difference FAQs-4 1.Difference between Correlated subquery and Nested subquery S.No 1 Correlated subquery Correlated subquery runs once for each row selected by the outer query. It contains a reference to a value from the row selected by the outer query. Correlated subquery follows down to top approach i.e., main query is executed first(even though parenthesis are present) and then child query. We can also say: in a Correlated subquery,Inner query condition is used in the outer query 4 Example: select e1.empname, e1.basicsal, e1.deptno from emp e1 where e1.basicsal = (select max(basicsal) from emp e2 where e2.deptno = e1.deptno) Example: select empname, basicsal, deptno from emp where (deptno, basicsal) in (select deptno, max(basicsal) from emp group by deptno) Nested subquery Nested subquery runs only once for the entire nesting (outer) query. It does not contain any reference to the outer query row.

Nested subquery follows top-down approach i.e., child query is executed first and then parent . We can also say:In a subquery Outer query condition is used in the the inner query.

2.Difference between Weak Entity Set and Strong Entity Set S.No 1 Weak Entity Set Strong Entity Set

An entity set which does not An entity set which does have a possess sufficient attributes to primary key is called a strong entity form a primary key is known as set. a weak entity set. Member of a weak entity set is a subordinate entity. Example: Specific Person,Company,Event,Plant Member of a strong entity set is a dominant entity. Example: Set of all Persons,Companies,Trees,Holiday s

2 3

3.Difference between char and varchar data types in Sql Server S.No 1 2 Char Fixed length memory storage CHAR takes up 1 byte per character Use Char when the data entries in a column are expected to be the same size like phone number Ex: Declare test Char(100); test="Test" Then "test" occupies 100 bytes first four bytes with values and rest with blank data Varchar Variable length memory storage(Changeable) VARCHAR takes up 1 byte per character, + 2 bytes to hold length information Use Varchar when the data entries in a column are expected to vary considerably in size like address Ex: Declare test VarChar(100); test="Test" Then "test" occupies only 4+2=6 bytes. first four bytes for value and other two bytes for variable length information.

4.Difference between Sql Server 2005 and Sql Server 2008 S.No 1 2 Sql Server 2005 XML datatype is introduced. Cannot encrypt the entire database. Sql Server 2008 XML datatype is used. Can encrypt the entire database introduced in 2008.

3 4 5 6 7

Datetime is used for both date and time. No table datatype is included. SSIS is started using. CMS is not available. PBM is not available

Date and time are seperately used for date and time Table datatype introduced. SSIS avails in this version. Central Management Server(CMS) is Introduced. Policy based management(PBM) server is Introduced.

Reference: http://onlydifferencefaqs.blogspot.in/2012/07/sql-server-difference-faqs-4.html SQL Server Difference FAQs- 5 1.Difference between Database Mail and SQL Mail S.No 1 Database Mail Based on SMTP (Simple Mail Transfer Protocol). Introduced in Sql Server 2005. No need to install Outlook. More secure than Sql mail. SQL Mail Based on MAPI (Messaging Application Programming Interface). Used prior versions of Sql Server 2005. Require Outlook to be installed. Less secure than Database mail.

2 3 4

2.Difference between Azure Table storage and SQL Azure S.No 1 Azure Table storage It is built on top of the Azure Storage platform. SQL Azure It is an SQL Server that has been configured to be hosted on top of the Windows Azure in a high availability mode. It comprises standard SQL Tables with indexes and referential integrity.

It comprises flexible or schema-less entities. No referential integrity between the tables, and no custom indexes. It can scale massive amounts of data due to the partition key.

It may not scale as far as Azure Table storage.

Can be thought as single spreadsheet.

Look familiar to any .Net developer who has used Sql server 2008 prior.

3.Difference between DBMS and RDBMS S.No 1 2 DBMS Stands for DataBase Management System In dbms no relationship concept It supports Single User only It treats Data as Files internally It supports 3 rules of E.F.CODD out off 12 rules It requires low Software and Hardware Requirements. DBMS is used for simpler business applications DBMS does not impose any constraints or security with regard to data manipulation In DBMS Normalization process will not be present RDBMS Stands for Relational DataBase Management System It is used to establish the relationship concept between two database objects, i.e, tables It supports multiple users It treats data as Tables internally It supports minimum 6 rules of E.F.CODD It requires High software and hardware requirements. RDBMS is used for more complex applications. RDBMS defines the integrity constraint for the purpose of holding ACID PROPERTY In RDBMS, normalization process will be present to check the database table consistency

3 4 5 6 7 8

10

There is no enforcement to use Although the foreign key concept is foreign key concept supported by both DBMS and compulsorily in DBMS RDBMS but its only RDBMS that enforces the rules FoxPro, IMS are Examples SQL Server, Oracle are examples

11

4.Difference between SQL Server 2000 and SQL Server 2005 S.No 1 2 SQL Server 2000 Query Analyser and Enterprise manager are separate. No XML datatype is used. SQL Server 2005 Both are combined as SSMS(Sql Server management Studio). .XML datatype is introduced.

3 4 5 6 7 8 9

We can create maximum of 65,535 databases. Exception Handling mechanism is not available There is no Varchar(Max) data type is not available DDL Triggers is not available DataBase Mirroring facility is not available RowNumber function for paging is not available Table fragmentation facility is not available Full Text Search facility is not available

We can create 2(pow(20))-1 databases. Exception Handling mechanism is available Varchar(Max) data type is introduced. DDL Triggers is introduced DataBase Mirroring facility is introduced RowNumber function for paging is introduced Table fragmentation facility is introduced Full Text Search facility is introduced

10

11 12

Bulk Copy Update facility is not Bulk Copy Update facility is available introduced Data Encryption concept is not introduced Cannot compress the tables and indexes. No varchar(max) or varbinary(max) is available. Data Transformation Services(DTS) is used as ETL tool .Cannot encrypt the entire database Can Compress tables and indexes. (Introduced in 2005 SP2) Varchar(max) and varbinary(max) is used. SQL Server Integration Services(SSIS) is started using from this SQL Server version and which is used as ETL tool

13 14 15

Reference: http://onlydifferencefaqs.blogspot.in/2012/07/sql-server-difference-faqs-5.html

SQL Server Difference FAQs-6 1.Difference between SQL Server and PostgreSQL S.No 1 2 SQL Server INSERT t VALUES () BULK INSERT and BCP PostgreSQL This syntax is not allowed. Allows: INSERT INTO t VALUES () uses COPY instead (which has the functionality of both BCP and BULK INSERT) pgAdmin Boolean type (accepts values true and false) Has sequencers (like Oracle) default schema is PostgreSQL Default listening on 5432 datatype: text key is not clustered by default (and it is enforced by a constraint and not an an index!) Domains user: postgres NATURAL and USING joins SELECT * FROM t LIMIT 10 Query plan read from left to right Estimate Query Plan: F7

3 4 5 6 7 8 9

Management Studio Bit type IDENITTY default schema is dbo Default Listening on 1433 datatype: varchar(max) Key is clustered by default

10 11 12 13 14 15

User Defined Data Types user: sa No such thing SELECT TOP 10 * FROM t Query plans read from right to left Estimate Query Plan: CTRL+L

2.Difference between Cross Join and Full Outer Join S.No 1 2 Cross Join No join conditions are specified. Results in pairs of rows. Full Outer Join A combination of both left and right outer joins. Results in every row from both of the tables , at least once.

Results in Cartesian product of two tables.

Assigns NULL for unmatched fields.

3.Difference between SQL Server and Oracle

S.No 1

SQL Server SQL History: IBM introduced structured Query Language (SQL) as the language to interface with its prototype relational database management system; System R. Oracle Corporation introduced the first commercially available SQL relational database management system in 1979. Today, SQL has become an industry standard, and Oracle Corporation clearly leads the world in RDBMS technology. SQL is used for all types of DB activities by all type of users. The basic SQL commands can be learned in a few hours and even the most advanced commands can be mastered in a few days.

Oracle Oracle History: Oracle Corp is the leading supplier for S/w products, headquartered in Redwood shores, California, USA. It was founded by Larry Ellison, Bob Miner and Ed Oates in 1977. Now they have 43,000 Employees in 150 countries. Oracle first commercial RDBMS was built in 1979, and it is the first to support the SQL. Oracle is the first S/w company to develop and deploy 100 % Internet-enabled enterprise Software.

SQL (Structure Query Language):

Oracle (RDBMS):

Oracle is fastest and easiest way to When a user wants to get create applications in MS windows. some information from any DB It provides the ability to store and file, he can issue a query. access data. Whether you are Structured query language experienced or new to windows in (SQL), pronounced Sequel, is programming, Oracle provides you the set of commands that all with the complete set of tools to programs and users must use simplify rapid application to access data within the development. The Oracle refers to Oracle. SQL is a high the method used to create the performance fault tolerant data graphical user inter face. There is base management system. no need to write numerous lines of The database is mostly code to describe the appearance maintained by SQL language, and location of inter face elements. which is conceded as the heart

of the RDBMS. 3 SQL Technology: SQL is divided into four parts: Oracle Technology:

Oracle DB structure is divided into two parts, one is called Physical structure (these files define the DDL (Data Definition Language): Create, Alter, Drop, operating system that make up the DB, each Oracle DB is made by Rename, Truncate. three types of files, data-files, redo logs file-controls file) and the other DML (Data Manipulate Language): Select, Update and is called Logical structure (these files define the logical areas of Delete, Insert, Into. storage like schema, table spaces, DCL (Data Control Language): segments and extents). Grant, Revoke TCL (Transaction Control Language): Commit, Rollback. 4 Advantages: Provides easy access to all data. Flexibility in data molding. Reduced data storage and redundancy. Provides a high-level manipulation language. SQL can save data in common PC file formats that can be imported into other application (like Ms-Excel). SQL is not case sensitive. It can enter one or more lines. Tabs and indents can be used to make code more readable. Can be used by a range of users. It is a nonprocedural language (English-like language). 5 Differences: Advantages: Data consistency Integration of data Easy file generation Increased security Easy updating of records No wastage of time Enforcement of standards Controlled data redundancy Reduce the total expenditures Searching of particular data is easy Dispose of heavy files and register work The work of three persons is reduced to one Instant intimation of modification of information

Differences:

SQL is a tool for all DB like DBMS, RDBMS, TSQL, and SQL Plus. SQL maintains different RDBMS. SQL is combination of different commands and functions that why, SQL is worked for Oracle DB as a command prompt shell (SQL is the command prompt shell, where we can communicate with any DB).

Oracle Corp is the worlds leading supplier of S/w products. Oracle is the platform, where we develop and implement different DB designs and software. Oracle is the combination of different S/w products, where they work together for designing DB. Oracle works with different front and back end products/tools (like SQL).

4.Difference between View and Stored Procedure S.No 1 2 3 4 5 View Does not accepts parameters Can be used as a building block in large query. Can contain only one single Select query. Cannot perform modification to any table. Can be used (sometimes) as the target for Insert, update, delete queries. Stored Procedure Accept parameters Cannot be used as a building block in large query. Can contain several statement like if, else, loop etc. Can perform modification to one or several tables. Cannot be used as the target for Insert, update, delete queries.

5.Difference between IN and EXISTS S.No 1 IN Returns true if specified value matches any value in the sub query or a list. The sub query will run first and then only outer query. IN is slower than EXISTS. The IN is used in the widely For Static variables for eg: select EXISTS Return true if sub query contain any rows. The Outer query will ran first and then only sub query. Exists is faster than IN.The Outer query will run first and then only inner query.So it will reduce the

2 3

name from table where ID in (Select ID from table2). 4 Example: SELECT id, [Name] FROM dbo.tablea WHERE id IN (SELECT id FROM dbo.tableb)

over head. The Exists is useful mostly in IF conditional statements. Example: SELECT id, [Name] FROM dbo.tablea AS a WHERE EXISTS (SELECT id2 FROM dbo.tableb WHERE id2 = a.id)

Reference: http://onlydifferencefaqs.blogspot.in/2012/08/sql-server-difference-faqs-6.html SQL Server Difference FAQs-7 1.Difference between Checkpoint and Lazy Writer S.No 1 2 CheckPoint Flush dirty pages to Disk Flush only Data pages to disk Lazy Writer Flush dirty pages to disk Check for available memory and removed Buffer pool (execution plan/compile plan/ Data pages /Memory objects) Occurs depending upon memory pressure and resource availability It is lazy, Sql server manages by its own. Monitor the memory pressure and try maintain the available free memory. No role in recovery

3 4

Default, Occurs approximately every 1 minute Can be managed with sp_confige -recovery interval option Does not check the memory pressure Crash recovery process will be fast to read log as data file is updated. Occurs for any DDL statement Occurs before Backup/Detach command Depends upon the

7 8 9

Occurs per requirement Occurs per requirement Works on Least recent used pages

configuration setting, we can control. 10 11 12 For simple recovery it flush the tlog file after 70% full. Can manually /Forcefully run command Checkpoint Very Less performance impact

and removed unused plans first, no user control. No effect on recovery model. No command for Lazy Writer No performance impact

2.Difference between Mirroring and Log Shipping S.No 1 2 3 Mirroring Principle can have single mirror Generally good to have 10 DBs for one server No data loss and can be used as high availability like Clustering Read log read and transfer the committed transaction through endpoints. Only committed transaction PAGE repair is possible if principle database page gets corrupt Mirrored DB can only be accessed using snapshot DB Principle and Mirror server should have same edition Require FULL recovery model Requires Sql Server 2005 SP1 or higher Enterprise or Developer Editions Log Shipping Multiple stand by servers can be possible. No limit May be some data loss as per schedule. And secondary server takes some manual work and time to be primary Transfer the log back up and restored at standby server. Committed as well as uncommitted and whole log backup restores. N/A

5 6

7 8

Secondary server can be reporting server (read-only) Primary and secondary server should be compatible server for restore. Require FULL or Bulk-Logged recovery model Enterprise edition for Sql Server 2000 and even Standard edition for 2005 can works

9 10

11

Immediate data moved Can control the flow of data by depending on SEND and WAIT scheduling jobs queue As Immediate data moves, user error reflects at mirrored DB As delay in data transfer can avoided user error.

12

3.Difference between Change Track and Change Data Capture CDC in SQL Server 2008 S.No 1 Change Track It is about fact: It captures only the fact as the tracking table has changed. It does NOT capture the data. Therefore, change tracking is more limited in the historical questions it can answer compared to change data capture. However, for those applications that do not require the historical information, there is far less storage overhead because of the changed data not being captured Storage: Internal tables are placed on the same filegroup as the parent entity. You could use the sys.internal_tables catalog view to show all the internal tables and parent entities. For example: select name, object_name(parent_id) as parent_object from sys.internal_tables Change Data Capture It is about the Data: Change data capture provides historical change information for a user table by capturing both the fact that DML changes were made and the actual data that was changed.

Storage: When change data capture is enabled for a database, a few things are added to the database, including a new schema (called cdc), some metadata tables, and a trigger to capture Data Definition Language (DDL) events. The two function names are, respectively, fn_cdc_get_all_changes_ and fn_cdc_get_net_changes_, with the capture instance name appended. Note that (like the change tracking feature) this functionality requires the table to have a primary key or other unique index. Prevents Log truncation. Forces full logging of some bulk operations.

Supported on Simple recovery model also. It is recommended that you

use snapshot isolation when change tracking is enabled. Snapshot isolation itself can add significant workload overhead and requires much more careful management of tempdb.

One major point to note here is that once change data capture is enabled, the transaction log behaves just as it does with transactional replicationthe log cannot be truncated until the log reader has processed it. This means a checkpoint operation, even in SIMPLE recovery mode, will not truncate the log unless it has already been processed by the log reader. Change Data Capture (CDC) uses the asynchronous process that reads the transaction log.

It uses synchronous tracking mechanism. once a database is enabled for change tracking, a version number is instituted, which allows ordering of operations Change Tracking has minimal impact on the system. It uses TempDB heavily DDL Restriction: There are restrictions on the DDL that can be performed on a table being tracked. The most notable restriction is that the primary key cannot be altered in any way. The other restriction worth calling out here is that an ALTER TABLE SWITCH will fail if either table involved has change tracking enabled. SQL Agent not needed

It has almost nil impact as it asynchronous mechanism reads from the transaction log. It uses transaction log. No such DDL restriction

6 7

t requires SQL Agent to be running. SQL Agent Job & Transaction Replication: Two SQL Agent jobs may be created: the capture job and the cleanup job. I say "may be created" because the capture job is the same as the one used for harvesting transactions in transactional replication. If transactional replication is

already configured, then only the cleanup job will be created and the existing log reader job will also be used as the capture job 9 Permission required to enable: SYSADMIN Permission required to enable: DBOwner

4.Difference between Index Rebuild and Index Reorganize in SQL Server 2005 S.No 1 Index Rebuild Index Rebuild drops the existing Index and Recreates the index from scratch. Rebuild the Index when an index is over 30% fragmented. Rebuilding takes more server resources and uses locks unless you use the ONLINE option available in 2005 Enterprise and Development editions. T-SQL for Rebuilding all Indexes of a particular table. USE AdventureWorks; GO ALTER INDEX ALL ON HumanResources.Employee REBUILD GO Index Reorganize Index Reorganize physically reorganizes the leaf nodes of the index. Reorganize the Index when an index is between 10% and 30% fragmented. Always prefer to do Reorganize the Index.

T-SQL for Reorganize all Indexes of a particular table. USE AdventureWorks; GO ALTER INDEX ALL ON HumanResources.Employee REORGANIZE GO

Note: If fragmentation is below 10%, no action required. 5.Difference between User -defined SP and System-defined SP S.No 1 User-defined SP Once we create User defined SP in one database i.e available to only that database directly.i.e we cannot call it from some other DBs directly System-defined SP System defined sp are available in master DB.These sps can be directly called from any DB

UDSP will be used to fulfill the user requirements

SDSP will be used for managing sql server

Reference: http://onlydifferencefaqs.blogspot.in/2012/08/sql-server-difference-faqs-7.html SQL Server Difference FAQs-8 1.Difference between Constraints and Triggers S.No 1 Constraints Once we define some constraint in a table they will be stored along with table definition Constraints will do memory location to table comparison. In the order of precedence first Constraints will be fired Performance wise Constraints will not give best performance because memory location to table comparison is slower than table to table comparison. Constraints cannot start a chain reaction as like triggers for instance each delete, update action etc. can trigger off another function Triggers It will be stored as separate object

Triggers will do table to table comparison.For this triggers will use magic tables(inserted,deleted). In the order of precedence only after Constraints is fired,then only Triggers will be fired Performance wise triggers will give best performance because table to table comparison is faster than memory location to table comparison. Triggers are used to carry out tasks which cant be done using constraints. For eg:-A change in the "sal" column of a table should change the "tax" column in another table.This cant be done using constraints.It has to be done using triggers.Thats where the importance of triggers lie. Trigger is used for table Trigger is a user defined business rule for which user is responsible for logic for business rule

6 7

Constraint is used for column Constraints are predefined business rules in which all the organizations follow this constraints without any modification. Constraints are used to maintain the integrity and

Triggers are basically stored procedures which automatically

atomicity of database .In other words it can be said they are used to prevent invalid data entry . the main 5 constraints are NOT NULL,PRIMARY KEY,FOREIGN KEY,UNIQUE KEY and CHECK

fired when any insert,update or delete is issued on table

2.Difference between Cast and Convert in SQL Server S.No 1 2 Cast Cast is ANSII Standard Cast cannot be used for Formatting Purposes. Convert Convert is Specific to SQL SERVER Convert can be used for Formatting Purposes.For example Select convert (varchar, datetime, 101)

3 4

Cast cannot convert a datetime Convert can be used to convert a to specific format datetime to specific format Usage of CAST: USE Sample GO SELECT SUBSTRING(Name, 1, 30) AS ProductName, ListPrice FROM Production.Product WHERE CAST(ListPrice AS int) LIKE '3%'; GO Usage of CONVERT: USE Sample GO SELECT SUBSTRING(Name, 1, 30) AS ProductName, ListPrice FROM Production.Product WHERE CAST(int, ListPrice) LIKE '3%'; GO

3.Difference between CUBE and ROLLUP S.No 1 CUBE It is an additional switch to GROUP BY clause. It can be applied to all aggregation functions to return cross tabular result sets. Produces all possible combinations of subtotals specified in GROUP BY clause ROLLUP It is an extension to GROUP BY clause. Its used to extract statistical and summarized information from result sets. It creates groupings and then applies aggregation functions on them. Produces only some possible subtotal combinations

and a Grand Total.

Reference: http://onlydifferencefaqs.blogspot.in/2012/08/sql-server-difference-faqs-8.html Sql Server Difference FAQs-9 1.Difference between VARCHAR and NVARCHAR in SQL Server S.No 1 Varchar[(n)] Basic Definition: Non-Unicode Variable Length character data type. Example: DECLARE @FirstName AS VARCHAR(50) = UMAR SELECT @FirstName NVarchar[(n)] Basic Definition: UNicode Variable Length character data type. It can store both nonUnicode and Unicode (i.e. Japanese, Korean etc) characters. Example: DECLARE @FirstName AS NVARCHAR(50)= UMAR SELECT @FirstName No. of Bytes required for each character: It takes 2 bytes per Unicode/NonUnicode character. Example: DECLARE @FirstName AS NVARCHAR(50)= UMAR SELECT @FirstName AS FirstName,DATALENGTH(@FirstN ame) AS Length Result: FirstName Length UMAR 8 Optional Parameter n range: Optional Parameter n value can be from 1 to 4000.Can store maximum 4000 Unicode/Non-Unicode characters If Optional Parameter n is not specified in the variable declaration or column definition:

No. of Bytes required for each character: It takes 1 byte per character Example: DECLARE @FirstName AS VARCHAR(50) = UMAR SELECT @FirstName AS FirstName,DATALENGTH(@Fi rstName) AS Length Result: FirstName Length UMAR 4

Optional Parameter n range: Optional Parameter n value can be from 1 to 8000.Can store maximum 8000 NonUnicode characters.

If Optional Parameter n is not specified in the variable declaration or column definition:

If Optional parameter value n is not If Optional parameter value is specified in the variable declaration not specified in the variable or column definition then it is declaration or column definition considered as 2 then it is considered as 1. Example: Example: DECLARE @firstName DECLARE @firstName NVARCHAR =UMAR VARCHAR =UMAR SELECT @firstName SELECT @firstName FirstName,DATALENGTH(@firstNa FirstName,DATALENGTH(@fir me) Length stName) Length Result: Result: FirstName Length FirstName Length U2 U1 5 If Optional Parameter n is not specified in while using CAST/CONVERT functions: When this optional parameter n is not specified while using the CAST/CONVERT functions, then it is considered as 30. If Optional Parameter n is not specified in while using CAST/CONVERT functions: When this optional parameter n is not specified while using the CAST CONVERT functions, then it is considered as 30.

Example: Example: DECLARE @firstName DECLARE @firstName NVARCHAR(35) =UMAR ASIA VARCHAR(35) =UMAR ASIA INDIA TAMIL NADU CUDDALORE INDIA TAMIL NADU SELECT CAST(@firstName AS CUDDALORE NVARCHAR) SELECT CAST(@firstName FirstName,DATALENGTH(CAST( AS VARCHAR) @firstName AS NVARCHAR)) FirstName,DATALENGTH(CAS Length T(@firstName AS VARCHAR)) Length Result: FirstName Length Result: UMAR ASIA INDIA TAMIL NADU FirstName Length CUD 60 UMAR ASIA INDIA TAMIL NADU CUD 30 7 Which one to use? If we know that data to be stored in the column or variable doesnt have any Unicode characters. Which one to use? If we know that data to be stored in the column or variable can have Unicode characters.

Storage Size: Takes no. of bytes equal to the no. of Characters entered plus two bytes extra for defining offset.

Storage Size: Takes no. of bytes equal to twice the no. of Characters entered plus two bytes extra for defining offset.

2.Difference between SQL Server and MySQL S.No 1 SQL Server Current Date and Time: SELECT GETDATE() MySQL Current Date and Time: SELECT NOW() Optionally: Use CURDATE() for the date only. 2 Limiting Results: SELECT TOP 10 * FROM table WHERE id = 1 3 Date Field Default Value: DATETIME DEFAULT GETDATE() Limiting Results: SELECT * FROM table WHERE id = 1 LIMIT 10 Date Field Default Value: DATETIME fields cannot have a default value, i.e. "GETDATE()" We must use your INSERT statement to specify CURDATE() for the field. Optionally: Use datatype TIMESTAMP DEFAULT CURRENT_TIMESTAMP 4 Character Length: LEN() Character Length: CHARACTER_LENGTH() Aliases: CHAR_LENGTH(), LENGTH() Character Replace: REPLACE() works case sensitively Trim Functions: TRIM()

Character Replace: REPLACE() works case insensitively

Trim Functions: LTRIM() and RTRIM()

String Concatenation: CONCATENATION USING + (Does not automatically cast operands to compatible types)

String Concatenation: CONCAT(string, string), which accepts two or more arguments. (Automatically casts values into types which can be concatenated) Auto Increment Field Definition: tablename_id INTEGER AUTO_INCREMENT PRIMARY KEY Get a List of Tables: SHOW TABLES Get Table Properties: DESCRIBE tablename Get Database Version: SELECT VERSION() Recordset Paging: Add to end of SQL: "LIMIT " & ((intCurrentPage1)*intRecsPerPage) & ", " & intRecsPerPage LIMIT: The first argument specifies the offset of the first row to return, and the second specifies the maximum number of rows to return. The offset of the initial row is 0 (not 1). Get ID of Newest Inserted Record: Two step process: 1. Execute your statement: objConn.Execute("INSERT INTO...") 2. Set objRS = objConn.Execute("SELECT LAST_INSERT_ID() AS ID") Get a Random Record: SELECT * FROM Users ORDER BY RAND() LIMIT 1

Auto Increment Field Definition: tablename_id INT IDENTITY PRIMARY KEY

Get a List of Tables: SP_TABLES

10

Get Table Properties: HELP tablename

11

Get Database Version: SELECT @@VERSION

12

Recordset Paging: Recordset paging done by client side-ADO (very involved)

13

Get ID of Newest Inserted Record: SET NOCOUNT ON; INSERT INTO...; SELECT id=@@IDENTITY; SET NOCOUNT OFF;

14

Get a Random Record: SELECT TOP 1 * FROM Users ORDER BY NEWID()

15

Generate a Unique GUID: SELECT NEWID()

Generate a Unique GUID: SELECT UUID() Licensing: MySQL is available for free since MySQL is an open source. View Support: MySQL offers only updateable views. XML Support: MySQL does not support XML. Security: MySQL provides only table level security. Certiication for Security: MySQL does not offer any certification for security. Support for Triggers: Earlier versionsof MySQL does not support triggers. Only MySQL 5.0 supports triggers. Support for UDF: User defined functions are not supported in MySQL. Support for Cursors: Cursor feature is not available in MySQL. Support for SPs and Joins: Stored procedures and full join facility are offered in SQL Server. Support for Import/Export Functions: Import and Export functions have very limited support in MySQL. Support for Transaction: Transaction support is very much limited in MySQL.

16

Licensing: SQL Server is not an open source and payment has to be made to use SQL Server. View Support: SQL Server offers indexed views which are much more powerful, performance wise. XML Support: SQL Server supports XML. Security: SQL Server provides column level security. Certiication for Security: SQL Server has C2 compliant certification. Database security is verified by third party. Support for Triggers: SQL Server provides triggers.

17

18 19

20

21

22

Support for UDF: User defined functions are supported in SQL Server. Support for Cursors: Cursor feature is available in SQL Server. Support for SPs and Joins: Stored procedures and full join facility is not offered in MySQL. Support for Import/Export Functions: Import and export are extensively supported in MySQL. Support for Transaction: Transaction support is extensively and fully offered in SQL Server.

23

24

25

26

27

Support for Replication: Replication support is extensively and fully offered in SQL Server. Support for auto tuning: Auto tuning is supported in SQL Server. Support for job scheduling and profiling: Job scheduling and profiling are available in SQL Server. Support for online backup and clustering: Online backup support and clustering support is extensive and complete in SQL Server. Support for Log shipping and SAN: Log Shipping and Storage Area Network support is available in SQL Server. Support for OLAP Services, Data Reporting and Data Mining: OLAP Services, Data Reporting and Data Mining are supported in SQL Server.

Support for Replication: Replication support is very much limited in MySQL. Support for auto tuning: Auto tuning is not supported in MySQL. Support for job scheduling and profiling: Job scheduling and profiling are not available in MySQL. Support for online backup and clustering: Online backup support and clustering support is limited in MySQL. Support for Log shipping and SAN: Log Shipping and Storage Area Network support is not available in MySQL. Support for OLAP Services, Data Reporting and Data Mining: OLAP Services, Data Reporting and Data Mining are not supported in MySQL.

28

29

30

31

32

3.Difference between SET QUOTED_IDENTIFIER ON and SET QUOTED_IDENTIFIER OFF in SQL Server S.No 1 SET QUOTED_IDENTIFIER ON Characters Enclosed within double quotes: is treated as Identifier 2 Try using Characters Enclosed within double quotes as identifier: Works Example: Below statement to SET QUOTED_IDENTIFIER OFF Characters Enclosed within double quotes: is treated as Literal Try using Characters Enclosed within double quotes as identifier: Fails Example: Below statement to

create a table with table name Table succeeds. SET QUOTED_IDENTIFIER ON GO CREATE TABLE dbo.Table (id int,Function VARCHAR(20)) GO

create a table with table name Table Fails. SET QUOTED_IDENTIFIER OFF GO CREATE TABLE dbo.Table (id int,Function VARCHAR(20)) GO Error Message: Msg 102, Level 15, State 1, Line 1 Incorrect syntax near Table. Try using Characters Enclosed within double quotes as Literal: Works Example: Below Statement Works. SET QUOTED_IDENTIFIER OFF GO SELECT UMAR

Try using Characters Enclosed within double quotes as Literal: Fails Example: Below statement fails. SET QUOTED_IDENTIFIER ON GO SELECT BIRADAR Error Message: Msg 207, Level 16, State 1, Line 1 Invalid column name UMAR.

Characters Enclosed within single quotes: is treated as Literal Example: SET QUOTED_IDENTIFIER ON GO SELECT UMAR

Characters Enclosed within single quotes: is treated as Literal Example: SET QUOTED_IDENTIFIER ON GO SELECT UMAR

How to find all the objects which are created with SET QUTOED_IDENTIFIER ON/OFF: Below Statement can be used to find all the objects created with SET QUTOED_IDENTIFIER setting as ON: SELECT OBJECT_NAME (object_id) FROM sys.sql_modules WHERE

How to find all the objects which are created with SET QUTOED_IDENTIFIER ON/OFF: Below Statement can be used to find all the objects created with SET QUTOED_IDENTIFIER setting as OFF: SELECT OBJECT_NAME (object_id) FROM sys.sql_modules WHERE uses_quoted_identifier = 0

uses_quoted_identifier = 1 4.Difference between DateTime and DateTime2 DataType S.No 1 2 DateTime Min Value: 1753-01-01 00:00:00 Max Value: 9999-12-31 23:59:59.997 3 Storage Size: 8 Bytes DateTime2[(n)] Min Value: 0001-01-01 00:00:00 Max Value: 9999-12-31 23:59:59.9999999 Storage Size: 6 to 8 bytes Note: Parameter n is optional and if it is not specified then fractional seconds precision is 7 digit and it can be from 0 to 7 digit. For fractional seconds precision <3 6="6" bytes="bytes" font="font" takes="takes"> For fractional seconds precision 3 or 4 it will take 7 bytes For fractional seconds precision >4 it will take 8 bytes 4 Usage: Declare @now datetime 5 Current Date and Time function: GetDate() It returns DB Current Date and Time of DateTime Data Type Example: SELECT GETDATE() Result: 2011-09-16 13:23:18.767 6 +/- days: WORKS Example: DECLARE @nowDateTime DATETIME = GETDATE() Usage: Declare @now datetime2(7) Current Date and Time function: SYSDATETIME()- It returns DB Current Date and Time of DateTime2 Data Type Example: SELECT SYSDATETIME() Result: 2011-09-16 13:23:18.7676720 +/- days: FAILS Need to use only DateAdd function Example: DECLARE @nowDateTime2 DATETIME2=

SELECT @nowDateTime + 1 Result: 2011-09-17 13:44:31.247

SYSDATETIME() SELECT @nowDateTime2+1 Result: Msg 206, Level 16, State 2, Line 2 Operand type clash: datetime2 is incompatible with int Compliance: Is an ANSI/ISO compliant

Compliance: Is not an ANSI/ISO compliant

Reference: http://onlydifferencefaqs.blogspot.in/2012/08/sql-server-difference-faqs-9.html Difference Between Crystal Reports and SSRS Difference Between Crystal Reports and SSRS (OR) Difference Between Crystal Reports and SQL Server Reporting Services S.No 1 Crystal Reports Ease of hosting reports: SSRS Ease of hosting reports:

Using the URL technology in In SSRS, in order to host reports RS we can host reports more we need to make a UI for the easily than in crystal report . same. 2 Supporting platforms: Supporting platforms:

Crystal Reports can run on SSRS can run only on windows windows, IBM and sun environment. 3 Client tools: Client tools:

In crystal Reports, we have In reporting services we have Report designer. Business intelligence ( BI ) and development studio. 4 Caching: Caching:

This achieved in Crystal In SSRS,it is stored as snapshots Reports by using cache server. in Reportserver database. 5 Export formats: Export formats:

In Crystal Reports we have In SSRS, we have all the formats HTML,PDF,Excel,XML,Word , above it also gives capability to PDF , RTF , CSV, text files. extend custom reporting formats.

Data sources: Crystal Reports support more data sources which incudes ADO, COM, Database excel Access, Exchange, NT, Xbase, JDBC, File system and Paradox.

Data sources: SSRS only supports Microsoft and oracle data sources,namely,SQL Server, Oracle, ODBC, OLEDB and we can also extend additional data sources which does not exists in crystal reports. Version issues:

Version issues:

One of the main issues faced SSRS comes with SQL Server in crystal reports is it have minimizing the version issue. different versions which makes it difficult to use 8 Web server support: Web server support:

Crystal Reports can run on IIS SSRS works only with IIS 5.0 and 5/6, Apache, lotus etc above. Reference: http://onlydifferencefaqs.blogspot.in/2012/08/difference-between-crystalreports-and.html Sql Server Difference FAQs-10 1.Difference between OLTP and OLAP S.No 1 OLTP Abbreviation: OLAP Abbreviation:

OLTP stands for Online OLAP stands for Online analytical transactional processing . processing . 2 Meaning: OLTP is designed to efficiently process high volumes of transactions, instantly recording business events (such as a sales invoice payment) and reflecting changes as they occur. 3 Used in: Meaning: OLAP is designed for analysis and decision support, allowing exploration of often hidden relationships in large amounts of data by providing unlimited views of multiple relationships at any cross-section of defined business dimensions. Used in: -

ERP, TX system, Client Server Data warehouse application Architecture, Desktop MOLAP, ROLAP, HOLAP application

Data Provision: Current data

Data Provision: Current and historical data Database Type of Database Transactions: Long database transactions

Type of Transactions:

Short database transactions 6 Type of update/insert/delete: Online update/insert/delete 7 Normalization/Denomalizatio n: Type of update/insert/delete: Batch update/insert/delete Normalization/Denomalization:

Denormalization is promoted Normalization is promoted (1st (Dimension and Fact design). normal form, second normal form and third normal form). 8 Volume of Transactions: High volume of transactions 9 Transaction Needed: Transaction necessary 10 Volume of Transactions: Low volume of transactions

Recovery Transaction Recovery Needed: recovery Transaction is necessary recovery is not

Amount of Requirement: Less Index

Index Amount of Index Requirement: More Index

11

Amount of Requirement: More Joins Model: Adopts an relationship(ER) model

Join Amount of Join Requirement: Less Joins Model: entity Adopts star, snowflake or fact constellation model and a subjectoriented database design Orientation:

12

13

Orientation:

Customer-oriented, used for Market-oriented, used for data data analysis and querying by analysis by knowledge clerks, clients and IT workers( managers, executives, professionals analysis) 14 Source: Source:

Daily transactions. 15 Motive:

OLTP Motive:

Faster insert, updates, deletes Faster analysis and search by and improve data quality by combining tables. reducing redundancy. 16 SQL complexity: Simple and Medium. 2.Difference between DTS and SSIS S.No 1 2 DTS SSIS Sql Server SQL complexity: Highly complex due to analysis and forecasting.

DTS stands for Data SSIS stands for Transformation Services Integration Services

DTS is a set of objects using SSIS is an ETL tool provided by an ETS tool to extract, Microsoft to extra data from transform, and load information different sources. to or from a database DTS was originally part of the SSIS is a component of the Microsoft SQL Server 2000 Microsoft SQL Server 2005 Uses Activex Script No Deployment available wizard Uses Scripting Language is Deployment wizard is available

3 4 5 6 7 8 9 10

Limited Set of Transformation Huge of Transformations available available Does not Functionality support BI Completely supports end to end process of BI Multi Tasks run parallely It is managed by CLR through SSIS can develop through Business Intelligence Development Studio (BIDS, nothing but new version of VS IDE)

Single Task at a time It is Unmanaged script DTS can develop Enterprise manager

11 12

We can deploy only at local It can be deployed using multiple server server using BIDS Designer contains Single Pane SSIS designer contains 4 design panes:

a) Control Flow b) Data Flow c) Event Handlers & d) Package Explorer. 13 14 No Event Hander No Solution Explorer Event Handler Available Solution Explorer is available, with packages, connections and Data Source Views (DSV)

15

Connection and other values It can be controlled dynamically are static, not controlled at using configuration runtime.

Reference: http://onlydifferencefaqs.blogspot.in/2012/08/sql-server-difference-faqs10.html Difference between Count(*) and Count(column_name) in SQL Server Difference between Count(*) and Count(column_name) in SQL Server S.No 1 Count(*) Will count all the rows in the specified table Count(column_name) Returns the number of rows which have a value (NULL values will not be counted)

Reference: http://onlydifferencefaqs.blogspot.in/2012/08/difference-between-countand.html Difference between Check Constraint and Rule Difference between Check Constraint and Rule S.No 1 Check Constraint Check constraint is associated with columns in a Table. So these cannot be re-used. Rule Rules are defined with in a database and can be applied to any number of columns

Example for Constraint: alter table Emp add constraint ck_op Check (Salary between 15000 and 45000) Example for Rule (Creation & Binding): Creating Rule: CREATE RULE SAL_RANGE as @Sal > 15000 and @Sal > 45000 Binding Rule to a Column: SP_BINDRULE 'SAL_RANGE','Emp.Salary'

Summary: The major difference between rule and Check is re usability Reference: http://onlydifferencefaqs.blogspot.in/2012/08/difference-between-checkconstraint-and.html Difference between MSDE and SQL Server 2000 Difference between MSDE and SQL Server 2000 S.No 1 MSDE Size: In MSDE database size limited to 2GB. 2 Performance: Performance of MSDE degrades when maximum number of concurrent operations greater then or equal to 8. Performance degradation is implemented with the help of SQL SERVER 2000 workload governor. 3 OLAP and Data warehousing: MSDE does not provide OLAP and Data warehousing capabilities 4 Mail: MSDE does not have support facility for SQL mail. 5 Administrative Tools: MSDE doesn't have its own administrative tools. There are many third party tools, which provide administrative capability GUI. SQL Server 2000 Size: In SQL Server database size limited to 1,048,516 TB1(1 Billion GB). Performance: In SQL SERVER 2000, possible number of concurrent connections are 32,767.

OLAP and Data warehousing: MSDE provides OLAP and Data warehousing capabilities

Mail: MSDE supports facility for SQL mail. Administrative Tools: SQL Server have administrative tools such as enterprise manager, Query analyzer or Profiler.

Note: MSDE(Microsoft Desktop Engine) is a cut down version of the SQL SERVER database and free, redistributable software. Reference: http://onlydifferencefaqs.blogspot.in/2012/08/difference-between-msde-and-

sql-server_23.html Difference between MSDE and SQL Server Express 2005 Difference between MSDE and SQL Server Express 2005 S.No 1 MSDE MSDE (Micosoft Data Engine) is a cut down version of SQL Server 2000 MSDE maximum database size is 2GB In terms of programming language support MSDE has only TSQL MSDE had and was controlled through the Workload governer There was no XCOPY support for MSDE MSDE has DTS MSDE does not have reporting services MSDE does not have native XML support SQL Server Express 2005 SQL SERVER Express edition is a cut down version of SQL SERVER 2005 and the next evolution of MSDE SQL SERVER Express has around 4GB. SQLSERVER Express has TSQL and .NET. SQL SERVER Express does not have connection limitation SQL SERVER Express has it. DTS is not present in SQL SERVER express SQL SERVER Express has reporting services SQL SERVER Express has native XML support

2 3

4 5 6 7 8

Reference: http://onlydifferencefaqs.blogspot.in/2012/08/difference-between-msde-andsql-server.html Difference between STUFF and REPLACE in SQL Server Difference between STUFF and REPLACE in SQL Server S.No 1 STUFF STUFF is used to replace the part of string with some other string. Syntax: STUFF (stringexpression, start, length, replacementcharacters) Example: REPLACE REPLACE is used to replace all the occurances of the given pattern in a string. Syntax: REPLACE ( string_expression , string_pattern , string_replacement ) Example:

SELECT STUFF('Umar's Blog select Replace('Umar','U','A') is USEFUL',8,4,'DATABASE') Output: Amar Output: Umar's DATABASE is USEFUL Reference: http://onlydifferencefaqs.blogspot.in/2012/08/difference-between-stuff-andreplace-in.html Difference between rdl and rdlc Difference between rdl and rdlc S.No 1 2 3 4 5 6 rdl It stands for Report Definition Language Created by Sql server with reporting services Runs on server side Requires values for all elements such as query text Takes less time to produce large data in reports As runs in server license of the reporting services not needed rdlc It stands for Report Definition Language, Client Side Created by Visual studio Runs on client side Does not require to have values for all elements such as query text Takes more time to produce large data in reports As runs in local license of the reporting services not needed

Reference: http://onlydifferencefaqs.blogspot.in/2012/08/difference-between-rdl-andrdlc.html Difference between Windows Authentication and SQL Server Authentication in SQL Server Difference between Windows Authentication and SQL Server Authentication in SQL Server S.No 1 Windows Authentication Windows Authentication is trusted because the user name and password are checked with the Active Directory Single User can only login SQL Server Authentication SQL Server authentication is untrusted , since SQL Server is the only verifier participating in the transaction Multi user can login

Reference: http://onlydifferencefaqs.blogspot.in/2012/08/difference-betweenwindows.html

Difference between SQL Server 2008 R2 and SQL Server 2012 Difference between SQL Server 2008 R2 and SQL Server 2012 (OR) Difference between SQL Server 10.5 and SQL Server 11.0 S.No 1 2 SQL Server 2008 R2 SQL Server 2008 R2 is codenamed as Kilimanjaro In SQL Server 2008 R2 , rebooting is requisite for OS patching , hence server down time is high SQL Server 2008 R2 does not have this feature of availability groups, hence fast recovery is not possible. SQL Server 2012 SQL Server 2012 is codenamed as Denali In SQL Server 2012, server down time is reduced by 50% , hence OS patching is not rebooting n times. In SQL Server 2012, high availability and disaster recovery factor has been introduced which duplicates the data and rapidly recovers the loss.

SQL Server 2008 R2 is slow In SQL Server 2012, the compared to SQL Server 2012. performance is 10 times faster than the predecessor. However buffer rate is less because there is no data redundancy in SQL Server 2008 R2 Data visualization is not supported in SQL Server 2008 R2 Spatial features are not supported more in SQL Server 2008 R2. Instead a traditional way for geographical elements have been set in SQL Server 2008 R2. Buffer rate is high in SQL Server 2012 because of data compression. Data visualization tool is available in SQL Server 2012.This allows snapshots of data. Support for persistent computed columns and extra geographical approach is possible with spatial features in SQL Server 2012.

Reference: http://onlydifferencefaqs.blogspot.in/2012/08/difference-between-sql-server2008-r2.html

Difference between a table scan and an index scan in SQL Server Database Difference between a table scan and an index scan in SQL Server Database

S.No 1

Table Scan Here, row by row scanning is done to get the data. In case, there are huge number of data in a table, it becomes an overhead.

Index Scan Here in the first, index is created in the table. It then uses the index to get to the data that we wanted. It increases the performance.

Reference: http://onlydifferencefaqs.blogspot.in/2012/08/difference-between-table-scanand-index.html Difference between SQL and T-SQL in SQL Server Difference between SQL and T-SQL in SQL Server S.No 1 2 SQL SQL stands for Structured Query Language ANSI/ISO(American National Standards Institute) standard database query language Set of queries submitted individually to the server. It is developed by IBM. T-SQL T-SQL stands for Transact SQL This is implementing in SQL SERVER. T-SQL can have one or more queries. It is a batch program, and submit to the server in a single shot. We can run all the programs at any time. T-Sql is implemetation of SQL in Microsoft SQL Server.

Reference: http://onlydifferencefaqs.blogspot.in/2012/08/difference-between-sql-and-t-sqlin-sql_24.html SET vs SELECT in SQL Server Difference between SET and SELECT in SQL Server S.No 1 SET Is it ANSI Standard ? SET is ANSI Standard for value assignment to variables. Variable Assignment: SET can be used to assign value to one variable at a time. DECLARE @i INT, @j INT, SELECT Is it ANSI Standard ? SELECT is Non-ANSI Standard for value assignment to variables. Variable Assignment: SELECT can be used to assign values to multiple variables in a single SELECT statement. The below query using SELECT is

@k INT SET @i = 10,@j = 20,@k = 30 It gives error: Msg 102, Level 15, State 1, Line 5 Incorrect syntax near ,.

valid: 1 2 3 4 5 DECLARE @i INT, @j INT, @k INT SELECT @i = 10,@j = 20,@k = 30 Output: Command(s) completed successfully. The below query using SET is not valid: 1 2 3 4 5

Behaviour of SET when query returns more then one value: When assigning from a query that returns more than one value, SET will fail with an error. The below query using set will fail: 1 2 3 DECLARE @i INT SET @i = (SELECT n FROM (VALUES (10),(20),(30)) AS List(n)) Error: Msg 512, Level 16, State 1, Line 5 Subquery returned more than 1 value. This is not permitted when the subquery follows =, ! =, <, <= , >, >= or when the subquery is used as an expression.

Behaviour of SELECT when query returns more then one value: When assigning from a query that returns more than one value, SELECT will assign the last value returned by the query and hide the fact that the query returned more than one row. The below query using select will execute successfully: 1 2 3 4 5 DECLARE @i INT SELECT @i = n FROM (VALUES (10),(20),(30)) AS List(n) SELECT @i Output: 30 (1 row(s) affected)

Behaviour of SET when query does not return any rows: If the variable is initially assigned a value following is the behavior of variable assignment for SET, Assigns null if the query does not return any rows. The output of the below statement will be NULL 1 2 3 4 5 6 7 DECLARE @i INT SET @i = 1 SET @i = (SELECT n FROM (VALUES (10),(20),(30)) AS List(n) WHERE 1=2) SELECT @i Output:

Behaviour of SELECT when query does not return any rows: If the variable is initially assigned a value following is the behavior of variable assignment for SELECT, Retains the initially assigned value and does not assign null if the query does not return any rows. The output of the below statement will be 1 1 2 3 4 5 6 7 DECLARE @i INT SET @i = 1 SELECT @i = n FROM (VALUES (10),(20),(30)) AS List(n) WHERE 1=2 SELECT @i Output: 1

NULL (1 row(s) affected) (1 row(s) affected) 5 Performance: Set does not provide better performance over select when used for assigning values to multiple variables at the same time. Assigning values to multiple variables using SET: 1 2 3 4 5 6 7 DECLARE @i INT, @j INT, @k INT Performance: Select has better performance over set when used for assigning values to multiple variables at the same time. Assigning values to multiple variables using Select: 1 2 3 4 5 DECLARE @i INT, @j INT, @k INT SELECT @i = 10,@j = 20,@k = 30

SET @i = 10 SET @j = 20 SET @k = 30 6 When to use ? When to use ? Following are few scenarios for Using SELECT is efficient and using SET flexible in the following few cases. 1. If we are required to assign a single value directly to variable and no query is involved to fetch value. 2. NULL assignments are expected (NULL returned in result set) 3. Standards are meant to be follow for any planned migration 4. Non scalar results are expected and are required to be handled 1. Multiple variables are being populated by assigning values directly 2. Multiple variables are being populated by single source (table , view) 3. Less coding for assigning multiple variables 4. Use this if we need to get @@ROWCOUNT and @ERROR for last statement executed

Reference: http://onlydifferencefaqs.blogspot.in/2012/09/difference-between-set-andselect-in.html Group By vs Order By in SQL Server Difference between Group By and Order By in SQL Server

S.No 1

Group By Meaning: Group By performs grouping operation i.e., it provides a way to sub-total SQL Query results,or perform some other aggregate functions (GROUPING SETS, CUBE, ROLLUP, WITH CUBE, or WITH ROLLUP) on them. Used for: Controlling the presentation of the rows for the results of the SELECT statement. Change in order of columns: Order of columns make no difference in the GROUP BY Clause. For Example, GROUP BY A, B, C and GROUP BY C,A,B Both returns the same results.

Order By Meaning: Order By performs sorting operation i.e., it provides a way to sort SQL Query results like ascending or descending . It does not affect what shows up in the result set,only what order it is displayed. Used for: Controlling the presentation of the columns for the results of the SELECT statement. Change in order of columns: Order of Columns makes difference in ORDER BY Clause. For Example, ORDER BY A, B, C and ORDER BY C,A,B Both returns the same number of Records. But Row order will be different. Allowed in Create View Statement or not: ORDER BY clause is not allowed in the CREATE VIEW statement. Execution Sequence: The ORDER BY clause is always placed after the GROUP BY clause in the SELECT statement. Impact on performance: As we now that Order By sorts the data either in ascending order or in descending order as specified in the query. So here Sorting the data is an overhead.

Allowed in Create View Statement or not: GROUP BY clause can be used in the CREATE VIEW statement to sort data. Execution Sequence: The GROUP BY clause is always placed before the ORDER BY clause in the SELECT statement. Impact on performance: As we know that Group By clubs all the similar rows and display only the distinct data. So here clubbing and displaying distinct data is an overhead.

Example-1 for Group By: select * from employee group by emp_name. this gives the output data in the group of the emp_name. Example-2 for Group By: SELECT department, sum(salary) FROM tblEmployee GROUP BY department; will give us salary totals by department, whereas the sum statement by itself would just give us the grand total of all salaries in tblEmployee. Example-3 for Group By: Group By helps us to display any aggregate of any column based on a field what has repeated names. use AdventureWorksDW2008R2 go select Title,SUM(BaseRate) as Rate from dbo.DimEmployee group by Title

Title 1 2 3 4 5 6 7 8 9 The Accountant Accounts Manager Accounts Payable Specialist Accounts Receivable Specialist Application Specialist Assistant to the Chief Financial Officer Benefits Specialist Buyer Chief Executive Officer

Rate 52.88 34.74 38 57 109.62 13.46 16.59 164.42 125.5 120.19 33.65 76.92

10 Chief Financial Officer 11 Control Specialist 12 Database Administrator

Example-1 for Order By: select * from employee order by emp_name desc,emp_no asc; this query gives the output in the ascending order of the emp_no and descending order of the emp_name. Example-2 for Order By: SELECT * FROM tblEmployee ORDER BY lastname; will give us all tblEmployee data, in order of last name. If we want the results in descending (reversed) order, simply add DESC to the end of the clause: ORDER BY lastname DESC; Example-3 for Order By: Order By clause helps us to display any table based on the values present on that particular column. use AdventureWorksDW2008R2 go select FirstName,Title from dbo.DimEmployee order by FirstName

First Name 1 2 3 4 5 6 7 8 9 A. Scott Alan

Title The Master Scheduler Scheduling Assistant

Alejandro Production Technician - WC40 Alex Alice Amy Andreas Andrew Andrew Production Technician - WC45 Production Technician - WC50 European Sales Manager Quality Assurance Technician Production Supervisor -WC10 Production Technician - WC45

10 Andy 11 Angela 12 Anibal Summary:

Production Technician - WC30 Production Technician - WC50 Production Technician - WC20

1. All non-aggregate columns selected must be listed in the GROUP BY clause. 2. Integers cannot be used in the GROUP BY to represent columns after the SELECT keyword, similar to using the ORDER BY clause. 3. The GROUP BY clause is generally not necessary unless using aggregate functions. 4. If we GROUP, the results are not necessarily sorted; although in many cases they may come out in an intuitive order, that's not guaranteed by the GROUP clause. If we want our groups sorted, always use an explicity ORDER BY after the GROUP BY. Dave Costa 5. Processing of "group by" or "order by" clause often requires creation of Temporary tables to process the results of the query. Which depending of the result set can be very expensive. Reference: http://onlydifferencefaqs.blogspot.in/2012/08/difference-between-group-byand-order.html Database vs Schema Difference between Database and Schema S.No 1 Database Database is a collection of organized data Schema Database schema describes the structure and organization of data in a database system

The database holds the Schema contains Databases and records, fields and cells of data describes how these database fields and cells are structured and organized and what types of relationships are mapped between these entities

Reference: http://onlydifferencefaqs.blogspot.in/2012/08/difference-between-databaseand-schema.html

Control Flow vs Data Flow in SSIS Difference between Control Flow and Data Flow in SSIS S.No 1 2 Control Flow Data Flow

The smallest unit in Control The smallest unit in Data Flow is Flow is called task. called component. In Control Flow , tasks require completion (success, failure or completion) before moving to next task. In Data Flow , one component will not wait for other component to finish, all of them will work together in processing and managing data in streaming way.

Reference: http://onlydifferencefaqs.blogspot.in/2012/09/difference-between-control-flowand.html TIMESTAMP vs UNIQUEIDENTIFIER Difference between TIMESTAMP and UNIQUEIDENTIFIER in SQL Server S.No 1 2 Timestamp UniqueIdentifier

Size of TIMESTAMP value is 8 Size of UNIQUEIDENTIFIER is 16 bytes. bytes. TIMESTAMP is not based on UNIQUEIDENTIFIER value is system date or time. based on the computer's MAC addresses and system date time. The purpose to TIMESTAMP is The purpose of to track the operation in tables UNIQUEIDENTIFIER is to have a on the database level. unique value assigned to a row (maybe as primary key). It remains unique in any system in the world.

Reference: http://onlydifferencefaqs.blogspot.in/2012/09/difference-between-timestampand.html COALESCE vs NULLIF in SQL Server Difference between COALESCE and NULLIF in SQL Server S.No 1 COALESCE NULLIF function works as if

This function works same as if This

else statement and it takes multiple arguments and it checks Null values for each if first argument is null then it considers the second value, if the both first and second arguments are nulls then it considers third argument. 2

statement and it takes two arguments and compares the 2 argument, if both are same then returns Null else returns the first argument.

Syntax: Syntax: COALESCE(argument1, NULLIF(argument1, argument2) argument2, argument3[, argument4, argument6, argument7]) It Accepts N Parameters, It It Accepts 2 Parameters, if both are returns first Not Null Values not equal then it will return first value. For Example:SELECT For Example:COALESCE(NULL,2,NULL,3) SELECT NULLIF(1,2) Output :- 2 Output :- 1 First argument can be NULL, but both argument can not NULL value First argument can be NULL, First argument can not be NULL but both argument can not input NULL value If Both argument are equal, If Both argument are equal, then it then it will return first value. will return NULL value. For Example:SELECT COALESCE(2,2) Output :- 2 For Example:SELECT NULLIF(2,2) Output :- NULL

Reference: http://onlydifferencefaqs.blogspot.in/2012/09/difference-between-coalesceand-nullif.html Star Schema vs Snowflake Schema Difference Between Star Schema and Snowflake Schema S.N o 1 2 Star Schema Data Structure: De-Normalized Data Structure Dimension: Category wise Dimension Table Snowflake Schema Data Structure: Normalized Data Structure

Dimension: Single Dimension table split into many pieces

Data dependency & Data dependency & redundancy: redundancy: Less data dependency and No More data dependency and redundancy redundancy Join: Join: No need to use complicated Complicated Join join Query Result: Query Results Faster Parent Table: No Parent Table DB Structure: Simple DB Structure Sample: http://blogmstechnology.blogspot.in/2010 /06/bi-dimensional-model-starschema.html Query Result: Some delay in Query Processing Parent Table: It may contain Parent Table DB Structure: Complicated DB Structure Sample: http://blogmstechnology.blogspot.in/2010/06/ bi-dimensional-model-snowflakeschema.html

5 6 7 8

Reference: http://onlydifferencefaqs.blogspot.in/2012/09/difference-between-star-schemaand.html Tabular Models vs PowerPivot Difference between Tabular Models and PowerPivot in SQL Server 2012 S.No 1 Tabular Models Scalability: i.No specified upper size limit ii.Partitions to process large volumes of data iii.Supports Direct Query and VertiPaq PowerPivot Scalability: i. 2 GB Excel file size limit (for uploading to SharePoint) ii. No partitioning iii. VertiPaq only

Manageability: Manageability: SSMS, AMO, ADOMD, XMLA, Excel / SharePoint Deployment Wizard, PowerShell, Integration Services Securability: Row level security and Securability: dynamic Excel workbook file security Deveolopment Tool: Excel

Deveolopment Tool: Visual Studio

Reference: http://onlydifferencefaqs.blogspot.in/2012/09/difference-between-tabularmodels-and.html ReportServer DB vs ReportServerTempDB Difference between ReportServer Database and ReportServerTempDB in SSRS S.No 1 ReportServer Database ReportServerTempDB

What it stores ? What it stores ? It Stores information about the It stores only the cached copy of report schema, report property, the report data. data sources, parameters, stores the folder hierarchy, report Execution log. How long it exists ? How long it exists ? It always exists until changes It expires based on Expiry settings. on the RDL Schema. How it helps ? How it helps ? It helps to access the It helps to improve the structure. performance of report execution as it is loading data from cache. Whether data will exist during / after service restart ? Data always exists during SSRS service restarts. Whether data will exist during / after service restart ? Services restarts will clear the Temp Data.

Reference: http://onlydifferencefaqs.blogspot.in/2012/09/difference-betweenreportserver.html Derived vs Calculated Measure Difference between Derived Measure and Calculated Measure in SSAS S.No 1 Derived Measure Calculated Measure ? after

When it is calculated ? When it is calculated This is calculated before the This is Calculated aggregation are created . aggregations are created . Whether Derived Measure value is stored in Cube or not ? The values of this measure is

Whether Calculated Measure value is stored in Cube or not ? This values are not stored in the Cube .

stored in the Cube. Reference: http://onlydifferencefaqs.blogspot.in/2012/09/difference-between-derivedmeasure-and.html Merge vs Union All transformations Differences between Merge and Union All transformations in SSIS S.No 1 Merge Union All

Number of inputs allowed: Number of inputs allowed: Merge transformation can Union all can take more than two accept only two inputs. inputs. Data to be sorted or not before Merge transformation: Data has to be sorted before Merge Transformation. Data to be sorted or not before Union All transformation: Union all does not have any condition like Merge.

For illustration, please visit @ http://sqljoe.wordpress.com/2011/03/03/differences-between-merge-and-unionalltransformations-in-ssis/ Summary: Both of them essentially takes outputs from more than one sources and combines them into a single result set. Reference: http://onlydifferencefaqs.blogspot.in/2012/09/differences-between-merge-andunion-all.html MOLAP vs ROLAP vs HOLAP Difference between MOLAP, ROLAP and HOLAP in SSAS MOLAP MOLAP stands for Multidimensional Online Analytical Processing The MOLAP storage mode causes the aggregations of the partition and a copy of its source data to be stored ROLAP HOLAP

ROLAP stands for HOLAP stands for Hybrid Relational Online Online Analytical Analytical Processing Processing The ROLAP storage mode causes the aggregations of the partition to be stored in indexed views in the relational database that The HOLAP storage mode combines attributes of both MOLAP and ROLAP. Like MOLAP, HOLAP causes the

in a multidimensional structure in Analysis Services when the partition is processed. This MOLAP structure is highly optimized to maximize query performance. The storage location can be on the computer where the partition is defined or on another computer running Analysis Services. Because a copy of the source data resides in the multidimensional structure, queries can be resolved without accessing the partitions source data. Query response times can be decreased substantially by using aggregations. The data in the partitions MOLAP structure is only as current as the most recent processing of the partition.

was specified in the aggregations of the partitions data source. partition to be stored in a multidimensional structure in an SQL Server Analysis Services instance. Unlike the MOLAP storage mode, ROLAP does not cause a copy of the source data to be stored in the Analysis Services data folders. Instead, when results cannot be derived from the query cache, the indexed views in the data source are accessed to answer queries. HOLAP does not cause a copy of the source data to be stored. For queries that access only summary data in the aggregations of a partition, HOLAP is the equivalent of MOLAP.

Query response is generally slower with ROLAP storage than with the MOLAP or HOLAP storage modes. Processing time is also typically slower with ROLAP. However, ROLAP enables users to view data in real time and can save storage space when you are working with large datasets that are infrequently queried, such as purely historical data.

Queries that access source datafor example, if you want to drill down to an atomic cube cell for which there is no aggregation data must retrieve data from the relational database and will not be as fast as they would be if the source data were stored in the MOLAP structure. With HOLAP storage mode, users will typically experience substantial differences in query times depending upon whether the query can be resolved from cache or aggregations versus from the source data itself. Pros HOLAP balances the disk space requirement, as it only stores the

Pros Provides maximum query performance, because all the

Pros Ability to view the data in near realtime. Since ROLAP does

required data (a copy of the detail data and calculated aggregate data) are stored in the OLAP server itself and there is no need to refer to the underlying relational database. All the calculations are pre-generated when the cube is processed and stored locally on the OLAP server hence even the complex calculations, as a part the query result, will be performed quickly. MOLAP uses compression to store the data on the OLAP server and so has less storage requirements than relational databases for same amount of data. MOLAP does not need to have a permanent connection to the underlying relational database (only at the time of processing) as it stores the detail and aggregate data in the OLAP server so the data can be viewed even when there is connection to the relational

not make another copy of data as in case of MOLAP, it has less storage requirements. This is very advantageous for large datasets which are queried infrequently such as historical data. In ROLAP mode, the detail data is stored on the underlying relational database, so there is no limitation on data size that ROLAP can support or limited by the data size of relational database. In nutshell, it can even handle huge volumes of data.

aggregate data on the OLAP server and the detail data remains in the relational database. So no duplicate copy of the detail data is maintained. Since HOLAP does not store detail data on the OLAP server, the cube and partitions would be smaller in size than MOLAP cubes and partitions. Performance is better than ROLAP as in HOLAP the summary data are stored on the OLAP server and queries can be satisfied from this summary data. HOLAP would be optimal in the scenario where query response is required and query results are based on aggregations on large volumes of data.

database. Cons With MOLAP mode, you need frequent processing to pull refreshed data after last processing resulting in drain on system resources. Latency; just after the processing if there is any changes in the relational database it will not be reflected on the OLAP server unless reprocessing is performed. MOLAP stores a copy of the relational data at OLAP server and so requires additional investment for storage. If the data volume is high, the cube processing can take longer, though you can use incremental processing to overcome this. Cons Compared to MOLAP or HOLAP the query response is generally slower because everything is stored on relational database and not locally on the OLAP server. A permanent connection to the underlying database must be maintained to view the cube data. Cons Query performance (response time) degrades if it has to drill through the detail data from relational data store, in this case HOLAP performs very much like ROLAP.

Reference: http://onlydifferencefaqs.blogspot.in/2012/09/difference-between-molap-rolapand.html

Compact Edition vs Express Edition Difference Between SQL Server Compact Edition and SQL Server Express Edition S.No 1 SQL Server Compact Edition Privately embedded, application: Yes Non-admin option: Yes SQL Server Express Edition

installed, Privately installed, embedded, with the with the application: No installation Non-admin installation option: No Windows Mobile

Runs on Windows Mobile Runs on platform: platform: Yes No Runs in-process with application: Yes Runs as a service: No File format: Single File Data file storage network share: Yes Support for extensions: Yes on

Runs in-process with application: No Runs as a service: Yes File format: Multiple Files a Data file storage on a network share: No file Support for extensions: No different file

5 6 7

different

Procedural T-SQLSelect Procedural T-SQLSelect Case, If, Case, If, features: features: No Yes Remote Data Access (RDA): Yes Distributed transactions: No Remote Data Access (RDA): No Distributed transactions: Yes views,

10 11 12

Stored procedures, views, Stored procedures, triggers :No triggers : Yes

13 14

Role-based security: No Number of connections: 256

Role-based security: Yes concurrent

concurrent Number of connections: Unlimited

Reference: http://onlydifferencefaqs.blogspot.in/2012/09/difference-between-sql-servercompact.html ISNULL vs COALESCE Functions Differences Between ISNULL and COALESCE Functions in SQL Server S.N o 1 ISNULL Meaning: This function works like if condition which we use in other program languages. It takes only two arguments, if first argument is Null then it returns second and one more thing is that the second argument should be of same size that means if first argument has varchar(2) and second has varchar(4) then it truncates last characters. Syntax: ISNULL(argument1, argument2) COALESCE Meaning: This function works same as if else statement and it takes multiple arguments and it checks Null values for each if first argument is null then it considers the second value, if the both first and second arguments are nulls then it considers third argument.

Syntax: COALESCE(argument1, argument2, argument3[, argument4, argument6, argument7]) Creating Computed Columns: With COALESCE() we can not create non-persisted computed column, but only persisted column. Number of Parameters: Takes a variable number parameters.

Creating Computed Columns: With ISNULL() we can create both persisted & non-persisted computed columns. Number of Parameters: Takes only 2 parameters. Note: If we use more than two parameters with the ISNULL function then we must use nested ISNULL functions.

of

ANSI standard or not:

ANSI standard or not:

A proprietary T-SQL function. 6

ANSI SQL standard.

Returned Data Type: Returned Data Type: Data type returned is the data Data type returned is the type of the first parameter. expression with the highest data type precedence. If all expressions are non-nullable, the result is typed as non-nullable. Whether translating to CASE Whether translating to CASE Expression possible ? Expression possible ? No Can be translated to a CASE expression: For Example, COALESCE (exp_1, exp_2, exp_n) Can be translated to CASE WHEN exp_1 IS NOT NULL THEN exp_1 WHEN exp_2 IS NOT NULL THEN exp_2 ELSE exp_n END

What happens when parameters datatypes are not determined ? If the data types of both parameters are not determined, the data type returned is int. ISNULL(NULL, NULL) Returns int

What happens when parameters datatypes are not determined ? At least one of the NULL values must be a typed NULL. If the data types of all parameters are not determined, the COALESCE function will throw an error: COALESCE(NULL, NULL) Throws an error COALESCE(CAST(NULL AS INT), NULL) Returns int Truncating parameter value: COALESCE() does not have this restriction. Example: declare @test varchar(3) select coalesce(@test, 'ABCD') AS coalesceResult

Truncating parameter value: The ISNULL() function looks at the first value and the second parameter value is automatically limited to that length . Example:

declare @test varchar(3) select isnull(@test, 'ABCD') AS ISNULLResult Output: ISNULLResult ABC

Output: coalesceResult ABCD

Reference: http://onlydifferencefaqs.blogspot.in/2012/09/differences-between-isnull-andcoalesce.html DML Triggers vs DDL Triggers Difference between DML Triggers and DDL Triggers S.No 1 DML Triggers DDL Triggers

Where it operates ? Where it operates ? Operates on INSERT, UPDATE Operates on CREATE, DROP and and DELETE. ALTER. Where it can be applied ? Applied on Tables and views. Whether it can be used as INSTEAD OF TRIGGERS ? Can be used as INSTEAD OF TRIGGERS. Whether Magic tables can be created ? Creates INSERTED and DELETED tables. Where it can be applied ? Applied on Databases and servers. Whether it can be used as INSTEAD OF TRIGGERS ? Cannot be used as INSTEAD OF TRIGGERS. Whether Magic tables can be created ? Cannot create INSERTED and DELETED tables.

2 3

When it runs ? When it runs ? DML triggers run either Before DDL triggers run only after a T-SQL or After a T-SQL statement is statement is completed . completed .

Reference: http://onlydifferencefaqs.blogspot.in/2012/09/difference-between-dml-triggersand-ddl.html Oracle vs SQL Server Indexes Difference between Oracle and SQL Server Indexes Type of index SQL Server Oracle 11g

2008 R2 B-tree indexes B+ tree indexes Function Based Indexes Hash cluster indexes B-Tree cluster indexes Bitmap Indexes Yes (Non- Yes (Default) clustered) Yes (CI) Yes (IOT)

Yes (Column has Yes to exist in table) No No No Yes Yes Yes

Here, CI - Clustered Indexes IOT - Index Organized Tables Note: Both SQL Server 2008 R2 and Oracle 11g supports Filtered Indexes Reference: http://onlydifferencefaqs.blogspot.in/2012/09/difference-between-oracle-andsql.html DT_STR vs DT_WSTR data types Difference between DT_STR and DT_WSTR data types in SSIS S.No 1 DT_STR Definition: A null-terminated ANSI/MBCS character string with a maximum length of 8000 characters. (If a column value contains additional null terminators, the string will be truncated at the occurrence of the first null.) When DT_STR can be used ? When data is in ANSI code then SSIS package takes the data type as DT_STR. DT_WSTR Definition: A null-terminated Unicode character string with a maximum length of 4000 characters. (If a column value contains additional null terminators, the string will be truncated at the occurrence of the first null.) When DT_STR can be used ? When data is in Unicode then SSIS package takes the data type as DT_WSTR.

How DT_STR can be mapped How DT_STR can be mapped in

in SQL Server ? DT_STR data type in SSIS can be mapped to Char or VarChar data types in SQL Server.

SQL Server ? DT_WSTR data type in SSIS can be mapped to nChar or nVarChar or Sql_Variant or image data types in SQL Server.

Reference: http://onlydifferencefaqs.blogspot.in/2012/09/difference-between-dtstr-anddtwstr.html

Full Load vs Incremental Load Difference between Full Load and Incremental Load S.No 1 Full Load Incremental Load

Truncates all rows and loads New records and updated ones are from scratch. loaded. Requires more time. Can easily be guaranteed. Requires less time. Difficult. ETL must new/updated rows. Retained. check for

2 3

Can be lost.

Reference: http://onlydifferencefaqs.blogspot.in/2012/09/difference-between-full-loadand.html

You might also like