SlideShare ist ein Scribd-Unternehmen logo
1 von 4
Downloaden Sie, um offline zu lesen
1.Difference between Identity and Sequence in SQL Server 2012

      S.No   Identity                             Sequence

      1      Dependant on table.                  Independent from table.

      2      Identity is a property in a table.   Sequence is an object.

             Example :                            Example :

             CREATE TABLE Table                   CREATE SEQUENCE [dbo].
             test_Identity                        [Sequence_ID]

             (                                    AS [int]

             [ID] int Identity (1,1),             START WITH 1

             [Product Name] varchar(50)           INCREMENT BY 1

             )                                    MINVALUE 1

                                                  MAXVALUE 1000

                                                  NO CYCLE

                                                  NO CACHE

      3      If we need a new ID from an          In the sequence, we do not need to
             identity column we need to           insert new ID, we can view the new ID
             insert and then get new ID.          directly.

             Example :                            Example :

             Insert into [test_Identity] Values   SELECT NEXT VALUE
             (‘SQL Server’)                       FOR dbo.[Sequence_ID]

             GO

             SELECT @@IDENTITY AS
             ‘Identity’

             –OR

             Select SCOPE_IDENTITY() AS
             ‘Identity’

      4      We cannot perform a cycle in         In the sequence, we can simply add
             identity column. Meaning, we         one property to make it a cycle.
             cannot restart the counter after a
             particular interval.                 Example :

                                                  ALTER SEQUENCE [dbo].
                                                  [Sequence_ID]
CYCLE;

5   We cannot cache Identity column   Sequence can be easily cached by just
    property.                         setting cache property of
                                      sequence. It also improves the
                                      performance.

                                      Example :

                                      ALTER SEQUENCE [dbo].
                                      [Sequence_ID]

                                      CACHE 3;

6   We cannot remove the identity     The sequence is not table dependent so
    column from the table directly.   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      Here we can set up its maximum
    value in identity column it is    value.
    based on the data type limit.
                                      Example :
ALTER SEQUENCE [dbo].
                                                   [Sequence_ID]

                                                   MAXVALUE 2000;

      8      We can reseed it but cannot           We can reseed as well as change the
             change the step size.                 step size.

             Example :                             Example :

             DBCC CHECKIDENT                       ALTER SEQUENCE [dbo].
             (test_Identity, RESEED, 4)            [Sequence_ID]

                                                   RESTART WITH 7

                                                   INCREMENT BY 2;

      9      We cannot generate range from         We can generate a range of sequence
             identity.                             values from a sequence object with the
                                                   help of sp_sequence_get_range.



2.Difference between Temp table and Table variable

      S.No   Temp table                            Table variable

      1      A Temp table is easy to create and    But the table variable involves the
             back up data.                         effort when we usually create the
                                                   normal tables.

      2      Temp table result can be used by      But the table variable can be used by
             multiple users.                       the current user only.

      3      Temp table will be stored in the      But a table variable will store in the
             tempdb. It will make network          physical memory for some of the data,
             traffic. When we have large data      then later when the size increases it
             in the temp table then it has to      will be moved to the tempdb.
             work across the database. A
             Performance issue will exist.

      4      Temp table can do all the DDL         Whereas table variable won't allow
             operations. It allows creating the    doing the DDL operations. But the
             indexes, dropping, altering, etc..,   table variable allows us to create the
                                                   clustered index only.

      5      Temp table can be used for the       But the table variable can be used up
             current session or global. So that a to that program. (Stored procedure)
             multiple user session can utilize
             the results in the table.

      6      Temp variable cannot use the          But we cannot do it for table variable.
transactions. When we do the
              DML operations with the temp
              table then it can be rollback or
              commit the transactions.

      7       Functions cannot use the temp       But the function allows us to use the
              variable. More over we cannot do    table variable. But using the table
              the DML operation in the            variable we can do that.
              functions .

      8       The stored procedure will do the    Whereas the table variable won't do
              recompilation (can't use same       like that.
              execution plan) when we use the
              temp variable for every sub
              sequent calls.

Another Good Reference:

http://sqljunkieshare.com/2011/11/05/difference-between-temporary-tables-and-table-variables/

3.Difference between RAISERROR and THROW statements


      S.No    RAISERROR Statement                 THROW Statement

      1       If a msg_id is passed to            The error_number parameter does not
              RAISERROR, the ID must be           have to be defined in sys.messages.
              defined in sys.messages.

      2       The msg_str parameter can           The message parameter does not
              contain printf formatting styles.   accept printf style formatting.

      3       The severity parameter specifies    There is no severity parameter. The
              the severity of the exception.      exception severity is always set to 16.

4.Difference between Local temporary table and Global temporary table


      S.No    Local temporary table               Global temporary table

      1       Denoted by # symbol.                Denoted by ## symbol.

      2       Valid for the current connection    Available to all the connections once
              only. They are cleared as soon as   created. They are deleted when all
              the current connection closes.      users referencing the table disconnect
                                                  from SQL Server .

      3       Cannot be shared between            Can be shared between multiple users.
              multiple users.

Weitere ähnliche Inhalte

Was ist angesagt?

High performance JPA with Oracle Coherence
High performance JPA with Oracle CoherenceHigh performance JPA with Oracle Coherence
High performance JPA with Oracle CoherenceMarkus Eisele
 
Database Systems - SQL - DDL Statements (Chapter 3/3)
Database Systems - SQL - DDL Statements (Chapter 3/3)Database Systems - SQL - DDL Statements (Chapter 3/3)
Database Systems - SQL - DDL Statements (Chapter 3/3)Vidyasagar Mundroy
 
Tom Lazar Using Zope3 Views And Viewlets For Plone 3.0 Product Development
Tom Lazar   Using Zope3 Views And Viewlets For Plone 3.0 Product DevelopmentTom Lazar   Using Zope3 Views And Viewlets For Plone 3.0 Product Development
Tom Lazar Using Zope3 Views And Viewlets For Plone 3.0 Product DevelopmentVincenzo Barone
 
That’s My App - Running in Your Background - Draining Your Battery
That’s My App - Running in Your Background - Draining Your BatteryThat’s My App - Running in Your Background - Draining Your Battery
That’s My App - Running in Your Background - Draining Your BatteryMichael Galpin
 
VJET bringing the best of Java and JavaScript together
VJET bringing the best of Java and JavaScript togetherVJET bringing the best of Java and JavaScript together
VJET bringing the best of Java and JavaScript togetherJustin Early
 
SQL Tutorial - Basic Commands
SQL Tutorial - Basic CommandsSQL Tutorial - Basic Commands
SQL Tutorial - Basic Commands1keydata
 
究極のコントローラを目指す
究極のコントローラを目指す究極のコントローラを目指す
究極のコントローラを目指すYasuo Harada
 
10 qmds2005 session14
10 qmds2005 session1410 qmds2005 session14
10 qmds2005 session14Niit Care
 
الوحدة التاسعة - قاعدة البيانات وادارتها
الوحدة التاسعة - قاعدة البيانات وادارتهاالوحدة التاسعة - قاعدة البيانات وادارتها
الوحدة التاسعة - قاعدة البيانات وادارتهاAmin Abu Hammad
 
Software architecture2008 ejbql-quickref
Software architecture2008 ejbql-quickrefSoftware architecture2008 ejbql-quickref
Software architecture2008 ejbql-quickrefjaiverlh
 
Green plum培训材料
Green plum培训材料Green plum培训材料
Green plum培训材料锐 张
 
DCI
DCIDCI
DCIlpld
 

Was ist angesagt? (19)

High performance JPA with Oracle Coherence
High performance JPA with Oracle CoherenceHigh performance JPA with Oracle Coherence
High performance JPA with Oracle Coherence
 
Database Systems - SQL - DDL Statements (Chapter 3/3)
Database Systems - SQL - DDL Statements (Chapter 3/3)Database Systems - SQL - DDL Statements (Chapter 3/3)
Database Systems - SQL - DDL Statements (Chapter 3/3)
 
Tom Lazar Using Zope3 Views And Viewlets For Plone 3.0 Product Development
Tom Lazar   Using Zope3 Views And Viewlets For Plone 3.0 Product DevelopmentTom Lazar   Using Zope3 Views And Viewlets For Plone 3.0 Product Development
Tom Lazar Using Zope3 Views And Viewlets For Plone 3.0 Product Development
 
That’s My App - Running in Your Background - Draining Your Battery
That’s My App - Running in Your Background - Draining Your BatteryThat’s My App - Running in Your Background - Draining Your Battery
That’s My App - Running in Your Background - Draining Your Battery
 
14 hql
14 hql14 hql
14 hql
 
Eclipse Banking Day
Eclipse Banking DayEclipse Banking Day
Eclipse Banking Day
 
XStream
XStreamXStream
XStream
 
VJET bringing the best of Java and JavaScript together
VJET bringing the best of Java and JavaScript togetherVJET bringing the best of Java and JavaScript together
VJET bringing the best of Java and JavaScript together
 
SQL Tutorial - Basic Commands
SQL Tutorial - Basic CommandsSQL Tutorial - Basic Commands
SQL Tutorial - Basic Commands
 
究極のコントローラを目指す
究極のコントローラを目指す究極のコントローラを目指す
究極のコントローラを目指す
 
10 qmds2005 session14
10 qmds2005 session1410 qmds2005 session14
10 qmds2005 session14
 
The messy lecture
The messy lectureThe messy lecture
The messy lecture
 
Java beans
Java beansJava beans
Java beans
 
Database security
Database securityDatabase security
Database security
 
الوحدة التاسعة - قاعدة البيانات وادارتها
الوحدة التاسعة - قاعدة البيانات وادارتهاالوحدة التاسعة - قاعدة البيانات وادارتها
الوحدة التاسعة - قاعدة البيانات وادارتها
 
Software architecture2008 ejbql-quickref
Software architecture2008 ejbql-quickrefSoftware architecture2008 ejbql-quickref
Software architecture2008 ejbql-quickref
 
Simple Jdbc With Spring 2.5
Simple Jdbc With Spring 2.5Simple Jdbc With Spring 2.5
Simple Jdbc With Spring 2.5
 
Green plum培训材料
Green plum培训材料Green plum培训材料
Green plum培训材料
 
DCI
DCIDCI
DCI
 

Andere mochten auch

Chapter 7 of 'The Beckoning of Gyanganj'
Chapter 7 of 'The Beckoning of Gyanganj'Chapter 7 of 'The Beckoning of Gyanganj'
Chapter 7 of 'The Beckoning of Gyanganj'Chandan Pathak
 
Dotnet difference questions & answers Compiled-1(updated)
Dotnet difference questions & answers Compiled-1(updated) Dotnet difference questions & answers Compiled-1(updated)
Dotnet difference questions & answers Compiled-1(updated) Umar Ali
 
Lion Consumer Distributor & Agent Info
Lion Consumer Distributor & Agent InfoLion Consumer Distributor & Agent Info
Lion Consumer Distributor & Agent Infoemployment
 
.NET Difference Between Interview Questions - Compiled
.NET Difference Between Interview Questions - Compiled.NET Difference Between Interview Questions - Compiled
.NET Difference Between Interview Questions - CompiledUmar Ali
 
Dotnet differences compiled -1
Dotnet differences compiled -1Dotnet differences compiled -1
Dotnet differences compiled -1Umar Ali
 
Power Plant Training Certificates
Power Plant Training CertificatesPower Plant Training Certificates
Power Plant Training Certificatesatavane
 
Difference between c# generics and c++ templates
Difference between c# generics and c++ templatesDifference between c# generics and c++ templates
Difference between c# generics and c++ templatesUmar Ali
 
Difference between sql server 2008 and sql server 2012
Difference between sql server 2008 and sql server 2012Difference between sql server 2008 and sql server 2012
Difference between sql server 2008 and sql server 2012Umar Ali
 
Asset Management Abstract
Asset Management AbstractAsset Management Abstract
Asset Management Abstractatavane
 
Design patterns difference between interview questions
Design patterns   difference between interview questionsDesign patterns   difference between interview questions
Design patterns difference between interview questionsUmar Ali
 

Andere mochten auch (13)

Chapter 7 of 'The Beckoning of Gyanganj'
Chapter 7 of 'The Beckoning of Gyanganj'Chapter 7 of 'The Beckoning of Gyanganj'
Chapter 7 of 'The Beckoning of Gyanganj'
 
Dotnet difference questions & answers Compiled-1(updated)
Dotnet difference questions & answers Compiled-1(updated) Dotnet difference questions & answers Compiled-1(updated)
Dotnet difference questions & answers Compiled-1(updated)
 
Lion Consumer Distributor & Agent Info
Lion Consumer Distributor & Agent InfoLion Consumer Distributor & Agent Info
Lion Consumer Distributor & Agent Info
 
.NET Difference Between Interview Questions - Compiled
.NET Difference Between Interview Questions - Compiled.NET Difference Between Interview Questions - Compiled
.NET Difference Between Interview Questions - Compiled
 
Dotnet differences compiled -1
Dotnet differences compiled -1Dotnet differences compiled -1
Dotnet differences compiled -1
 
Power Plant Training Certificates
Power Plant Training CertificatesPower Plant Training Certificates
Power Plant Training Certificates
 
Difference between c# generics and c++ templates
Difference between c# generics and c++ templatesDifference between c# generics and c++ templates
Difference between c# generics and c++ templates
 
Difference between sql server 2008 and sql server 2012
Difference between sql server 2008 and sql server 2012Difference between sql server 2008 and sql server 2012
Difference between sql server 2008 and sql server 2012
 
Higiene en la adolecencia mujeres
Higiene en la adolecencia mujeresHigiene en la adolecencia mujeres
Higiene en la adolecencia mujeres
 
Asset Management Abstract
Asset Management AbstractAsset Management Abstract
Asset Management Abstract
 
Design patterns difference between interview questions
Design patterns   difference between interview questionsDesign patterns   difference between interview questions
Design patterns difference between interview questions
 
Motivation theory
Motivation theoryMotivation theory
Motivation theory
 
Break Even Analysis
Break Even AnalysisBreak Even Analysis
Break Even Analysis
 

Ähnlich wie Sql server difference faqs- 3

Dev Cast Dependency Injection
Dev Cast Dependency InjectionDev Cast Dependency Injection
Dev Cast Dependency InjectionDylan Thomas
 
M.TECH 1ST SEM COMPUTER SCIENCE ADBMS LAB PROGRAMS
M.TECH 1ST SEM COMPUTER SCIENCE ADBMS LAB PROGRAMSM.TECH 1ST SEM COMPUTER SCIENCE ADBMS LAB PROGRAMS
M.TECH 1ST SEM COMPUTER SCIENCE ADBMS LAB PROGRAMSSupriya Radhakrishna
 
Subqueries views stored procedures_triggers_transactions
Subqueries views stored procedures_triggers_transactionsSubqueries views stored procedures_triggers_transactions
Subqueries views stored procedures_triggers_transactionsmaxpane
 
Creating other schema objects
Creating other schema objectsCreating other schema objects
Creating other schema objectsSyed Zaid Irshad
 
DBA Commands and Concepts That Every Developer Should Know
DBA Commands and Concepts That Every Developer Should KnowDBA Commands and Concepts That Every Developer Should Know
DBA Commands and Concepts That Every Developer Should KnowAlex Zaballa
 
SQL_SERVER_BASIC_1_Training.pptx
SQL_SERVER_BASIC_1_Training.pptxSQL_SERVER_BASIC_1_Training.pptx
SQL_SERVER_BASIC_1_Training.pptxKashifManzoorMeo
 
Oracle Database 12c - New Features for Developers and DBAs
Oracle Database 12c - New Features for Developers and DBAsOracle Database 12c - New Features for Developers and DBAs
Oracle Database 12c - New Features for Developers and DBAsAlex Zaballa
 
Oracle Database 12c - New Features for Developers and DBAs
Oracle Database 12c  - New Features for Developers and DBAsOracle Database 12c  - New Features for Developers and DBAs
Oracle Database 12c - New Features for Developers and DBAsAlex Zaballa
 
OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...
OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...
OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...Alex Zaballa
 
OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...
OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...
OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...Alex Zaballa
 
Difference between group by and order by in sql server
Difference between group by and  order by in sql serverDifference between group by and  order by in sql server
Difference between group by and order by in sql serverUmar Ali
 
Sql views, stored procedure, functions
Sql views, stored procedure, functionsSql views, stored procedure, functions
Sql views, stored procedure, functionsOm Vikram Thapa
 

Ähnlich wie Sql server difference faqs- 3 (20)

My sql102
My sql102My sql102
My sql102
 
Dev Cast Dependency Injection
Dev Cast Dependency InjectionDev Cast Dependency Injection
Dev Cast Dependency Injection
 
Mysql
MysqlMysql
Mysql
 
SQL
SQLSQL
SQL
 
M.TECH 1ST SEM COMPUTER SCIENCE ADBMS LAB PROGRAMS
M.TECH 1ST SEM COMPUTER SCIENCE ADBMS LAB PROGRAMSM.TECH 1ST SEM COMPUTER SCIENCE ADBMS LAB PROGRAMS
M.TECH 1ST SEM COMPUTER SCIENCE ADBMS LAB PROGRAMS
 
Subqueries views stored procedures_triggers_transactions
Subqueries views stored procedures_triggers_transactionsSubqueries views stored procedures_triggers_transactions
Subqueries views stored procedures_triggers_transactions
 
Chapter09
Chapter09Chapter09
Chapter09
 
Creating other schema objects
Creating other schema objectsCreating other schema objects
Creating other schema objects
 
DBA Commands and Concepts That Every Developer Should Know
DBA Commands and Concepts That Every Developer Should KnowDBA Commands and Concepts That Every Developer Should Know
DBA Commands and Concepts That Every Developer Should Know
 
Sql tutorial
Sql tutorialSql tutorial
Sql tutorial
 
SQL_SERVER_BASIC_1_Training.pptx
SQL_SERVER_BASIC_1_Training.pptxSQL_SERVER_BASIC_1_Training.pptx
SQL_SERVER_BASIC_1_Training.pptx
 
Oracle Database 12c - New Features for Developers and DBAs
Oracle Database 12c - New Features for Developers and DBAsOracle Database 12c - New Features for Developers and DBAs
Oracle Database 12c - New Features for Developers and DBAs
 
Oracle Database 12c - New Features for Developers and DBAs
Oracle Database 12c  - New Features for Developers and DBAsOracle Database 12c  - New Features for Developers and DBAs
Oracle Database 12c - New Features for Developers and DBAs
 
OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...
OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...
OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...
 
OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...
OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...
OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...
 
Database testing
Database testingDatabase testing
Database testing
 
Beg sql
Beg sqlBeg sql
Beg sql
 
Beg sql
Beg sqlBeg sql
Beg sql
 
Difference between group by and order by in sql server
Difference between group by and  order by in sql serverDifference between group by and  order by in sql server
Difference between group by and order by in sql server
 
Sql views, stored procedure, functions
Sql views, stored procedure, functionsSql views, stored procedure, functions
Sql views, stored procedure, functions
 

Mehr von Umar Ali

Difference between wcf and asp.net web api
Difference between wcf and asp.net web apiDifference between wcf and asp.net web api
Difference between wcf and asp.net web apiUmar Ali
 
Difference between ActionResult() and ViewResult()
Difference between ActionResult() and ViewResult()Difference between ActionResult() and ViewResult()
Difference between ActionResult() and ViewResult()Umar Ali
 
Difference between asp.net mvc 3 and asp.net mvc 4
Difference between asp.net mvc 3 and asp.net mvc 4Difference between asp.net mvc 3 and asp.net mvc 4
Difference between asp.net mvc 3 and asp.net mvc 4Umar Ali
 
Difference between asp.net web api and asp.net mvc
Difference between asp.net web api and asp.net mvcDifference between asp.net web api and asp.net mvc
Difference between asp.net web api and asp.net mvcUmar Ali
 
Difference between asp.net web forms and asp.net mvc
Difference between asp.net web forms and asp.net mvcDifference between asp.net web forms and asp.net mvc
Difference between asp.net web forms and asp.net mvcUmar Ali
 
ASP.NET MVC difference between questions list 1
ASP.NET MVC difference between questions list 1ASP.NET MVC difference between questions list 1
ASP.NET MVC difference between questions list 1Umar Ali
 
Link checkers 1
Link checkers 1Link checkers 1
Link checkers 1Umar Ali
 
Affiliate Networks Sites-1
Affiliate Networks Sites-1Affiliate Networks Sites-1
Affiliate Networks Sites-1Umar Ali
 
Technical Video Training Sites- 1
Technical Video Training Sites- 1Technical Video Training Sites- 1
Technical Video Training Sites- 1Umar Ali
 
US News Sites- 1
US News Sites- 1 US News Sites- 1
US News Sites- 1 Umar Ali
 
How to create user friendly file hosting link sites
How to create user friendly file hosting link sitesHow to create user friendly file hosting link sites
How to create user friendly file hosting link sitesUmar Ali
 
Weak hadiths in tamil
Weak hadiths in tamilWeak hadiths in tamil
Weak hadiths in tamilUmar Ali
 
Bulughul Maram in tamil
Bulughul Maram in tamilBulughul Maram in tamil
Bulughul Maram in tamilUmar Ali
 
Asp.net website usage and job trends
Asp.net website usage and job trendsAsp.net website usage and job trends
Asp.net website usage and job trendsUmar Ali
 
Indian news sites- 1
Indian news sites- 1 Indian news sites- 1
Indian news sites- 1 Umar Ali
 
Photo sharing sites- 1
Photo sharing sites- 1 Photo sharing sites- 1
Photo sharing sites- 1 Umar Ali
 
File hosting search engines
File hosting search enginesFile hosting search engines
File hosting search enginesUmar Ali
 
Ajax difference faqs compiled- 1
Ajax difference  faqs compiled- 1Ajax difference  faqs compiled- 1
Ajax difference faqs compiled- 1Umar Ali
 
ADO.NET difference faqs compiled- 1
ADO.NET difference  faqs compiled- 1ADO.NET difference  faqs compiled- 1
ADO.NET difference faqs compiled- 1Umar Ali
 
.NET Differences List
.NET Differences List.NET Differences List
.NET Differences ListUmar Ali
 

Mehr von Umar Ali (20)

Difference between wcf and asp.net web api
Difference between wcf and asp.net web apiDifference between wcf and asp.net web api
Difference between wcf and asp.net web api
 
Difference between ActionResult() and ViewResult()
Difference between ActionResult() and ViewResult()Difference between ActionResult() and ViewResult()
Difference between ActionResult() and ViewResult()
 
Difference between asp.net mvc 3 and asp.net mvc 4
Difference between asp.net mvc 3 and asp.net mvc 4Difference between asp.net mvc 3 and asp.net mvc 4
Difference between asp.net mvc 3 and asp.net mvc 4
 
Difference between asp.net web api and asp.net mvc
Difference between asp.net web api and asp.net mvcDifference between asp.net web api and asp.net mvc
Difference between asp.net web api and asp.net mvc
 
Difference between asp.net web forms and asp.net mvc
Difference between asp.net web forms and asp.net mvcDifference between asp.net web forms and asp.net mvc
Difference between asp.net web forms and asp.net mvc
 
ASP.NET MVC difference between questions list 1
ASP.NET MVC difference between questions list 1ASP.NET MVC difference between questions list 1
ASP.NET MVC difference between questions list 1
 
Link checkers 1
Link checkers 1Link checkers 1
Link checkers 1
 
Affiliate Networks Sites-1
Affiliate Networks Sites-1Affiliate Networks Sites-1
Affiliate Networks Sites-1
 
Technical Video Training Sites- 1
Technical Video Training Sites- 1Technical Video Training Sites- 1
Technical Video Training Sites- 1
 
US News Sites- 1
US News Sites- 1 US News Sites- 1
US News Sites- 1
 
How to create user friendly file hosting link sites
How to create user friendly file hosting link sitesHow to create user friendly file hosting link sites
How to create user friendly file hosting link sites
 
Weak hadiths in tamil
Weak hadiths in tamilWeak hadiths in tamil
Weak hadiths in tamil
 
Bulughul Maram in tamil
Bulughul Maram in tamilBulughul Maram in tamil
Bulughul Maram in tamil
 
Asp.net website usage and job trends
Asp.net website usage and job trendsAsp.net website usage and job trends
Asp.net website usage and job trends
 
Indian news sites- 1
Indian news sites- 1 Indian news sites- 1
Indian news sites- 1
 
Photo sharing sites- 1
Photo sharing sites- 1 Photo sharing sites- 1
Photo sharing sites- 1
 
File hosting search engines
File hosting search enginesFile hosting search engines
File hosting search engines
 
Ajax difference faqs compiled- 1
Ajax difference  faqs compiled- 1Ajax difference  faqs compiled- 1
Ajax difference faqs compiled- 1
 
ADO.NET difference faqs compiled- 1
ADO.NET difference  faqs compiled- 1ADO.NET difference  faqs compiled- 1
ADO.NET difference faqs compiled- 1
 
.NET Differences List
.NET Differences List.NET Differences List
.NET Differences List
 

Kürzlich hochgeladen

Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdfChristopherTHyatt
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 

Kürzlich hochgeladen (20)

Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdf
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 

Sql server difference faqs- 3

  • 1. 1.Difference between Identity and Sequence in SQL Server 2012 S.No Identity Sequence 1 Dependant on table. Independent from table. 2 Identity is a property in a table. Sequence is an object. Example : Example : CREATE TABLE Table CREATE SEQUENCE [dbo]. test_Identity [Sequence_ID] ( AS [int] [ID] int Identity (1,1), START WITH 1 [Product Name] varchar(50) INCREMENT BY 1 ) MINVALUE 1 MAXVALUE 1000 NO CYCLE NO CACHE 3 If we need a new ID from an In the sequence, we do not need to identity column we need to insert new ID, we can view the new ID insert and then get new ID. directly. Example : Example : Insert into [test_Identity] Values SELECT NEXT VALUE (‘SQL Server’) FOR dbo.[Sequence_ID] GO SELECT @@IDENTITY AS ‘Identity’ –OR Select SCOPE_IDENTITY() AS ‘Identity’ 4 We cannot perform a cycle in In the sequence, we can simply add identity column. Meaning, we one property to make it a cycle. cannot restart the counter after a particular interval. Example : ALTER SEQUENCE [dbo]. [Sequence_ID]
  • 2. CYCLE; 5 We cannot cache Identity column Sequence can be easily cached by just property. setting cache property of sequence. It also improves the performance. Example : ALTER SEQUENCE [dbo]. [Sequence_ID] CACHE 3; 6 We cannot remove the identity The sequence is not table dependent so column from the table directly. 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 Here we can set up its maximum value in identity column it is value. based on the data type limit. Example :
  • 3. ALTER SEQUENCE [dbo]. [Sequence_ID] MAXVALUE 2000; 8 We can reseed it but cannot We can reseed as well as change the change the step size. step size. Example : Example : DBCC CHECKIDENT ALTER SEQUENCE [dbo]. (test_Identity, RESEED, 4) [Sequence_ID] RESTART WITH 7 INCREMENT BY 2; 9 We cannot generate range from We can generate a range of sequence identity. values from a sequence object with the help of sp_sequence_get_range. 2.Difference between Temp table and Table variable S.No Temp table Table variable 1 A Temp table is easy to create and But the table variable involves the back up data. effort when we usually create the normal tables. 2 Temp table result can be used by But the table variable can be used by multiple users. the current user only. 3 Temp table will be stored in the But a table variable will store in the tempdb. It will make network physical memory for some of the data, traffic. When we have large data then later when the size increases it in the temp table then it has to will be moved to the tempdb. work across the database. A Performance issue will exist. 4 Temp table can do all the DDL Whereas table variable won't allow operations. It allows creating the doing the DDL operations. But the indexes, dropping, altering, etc.., table variable allows us to create the clustered index only. 5 Temp table can be used for the But the table variable can be used up current session or global. So that a to that program. (Stored procedure) multiple user session can utilize the results in the table. 6 Temp variable cannot use the But we cannot do it for table variable.
  • 4. transactions. When we do the DML operations with the temp table then it can be rollback or commit the transactions. 7 Functions cannot use the temp But the function allows us to use the variable. More over we cannot do table variable. But using the table the DML operation in the variable we can do that. functions . 8 The stored procedure will do the Whereas the table variable won't do recompilation (can't use same like that. execution plan) when we use the temp variable for every sub sequent calls. Another Good Reference: http://sqljunkieshare.com/2011/11/05/difference-between-temporary-tables-and-table-variables/ 3.Difference between RAISERROR and THROW statements S.No RAISERROR Statement THROW Statement 1 If a msg_id is passed to The error_number parameter does not RAISERROR, the ID must be have to be defined in sys.messages. defined in sys.messages. 2 The msg_str parameter can The message parameter does not contain printf formatting styles. accept printf style formatting. 3 The severity parameter specifies There is no severity parameter. The the severity of the exception. exception severity is always set to 16. 4.Difference between Local temporary table and Global temporary table S.No Local temporary table Global temporary table 1 Denoted by # symbol. Denoted by ## symbol. 2 Valid for the current connection Available to all the connections once only. They are cleared as soon as created. They are deleted when all the current connection closes. users referencing the table disconnect from SQL Server . 3 Cannot be shared between Can be shared between multiple users. multiple users.