Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
Node is saved as draft in My Content >> Draft
  • SQL Server 2012 Programmability Enhancements

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 278
    Comment on it

    SQL Server 2012 Programmability Enhancements


    SQL Server 2012 supports a great programmability enhancements and functions :


    T-SQL THROW Statement


    Now SQL Server 2012 has improved error handling by introducing throw statement for throwing exception in T-SQL.


    Conversion Functions


    SQL Server 2012 has support for new conversion functions for converting numeric, date, and time values to desired format.


    T-SQL built-in pagination


    SQL Server 2012 also supports built-in pagination with the help of OFFSET and FETCH like MySQL.


    --Suppose Employee tables has 500 records
        --Below query skip 200 rows and fetch the next 20 records
        SELECT EmpID, EmpName, Salary FROM dbo.Employee
        ORDER BY EmpID
        OFFSET 200 ROWS
        FETCH NEXT 20 ROWS ONLY 
        T-SQL Sequence</p>
    


    SQL Server 2012 also supports sequence like Oracle database. It works like as IDENTITY field without being a field.


      --Create Sequence object
        CREATE SEQUENCE objSequence
        START WITH 1
        INCREMENT BY 1;
         --Create Employee object
        DECLARE @Employee TABLE
        (
        ID int NOT NULL PRIMARY KEY,
        FullName nvarchar(100) NOT NULL
        )
         --Insert values
        INSERT @Employee (ID, FullName)
        VALUES (NEXT VALUE FOR objSequence, 'Mohan'),
        (NEXT VALUE FOR objSequence, 'Deepak'),
        (NEXT VALUE FOR objSequence, 'Pavan');
         --Show data
        SELECT * FROM @Employee
    


    Metadata Discovery Enhancements


    SQL Server 2012 also has improved metadata discovery, which allow you to determine the shape of projected output from queries, tables, stored procedure, views, and other objects.

    SQL Server

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: