Creating a basic table involves naming the table and defining its columns and each column's data type.The SQL CREATE TABLE statement is used to create a new table.there are two records with with Id column value as 1) From the above result it is clear that the example 2’s approach 1 and 2 script will not work in the scenarios where we have duplicates in the looping column.
Let us see what is the output of the example 1’s approach 1 and 2 if we have gaps in the looping column value.
This problem can solved in multiple ways, below are two such example approaches.
Approach 1: Looping through table records where looping column has duplicate values SET NOCOUNT ON DECLARE @Loop Counter INT , @Max Employee Id INT, @Employee Name NVARCHAR(100) SELECT @Loop Counter = min(id) , @Max Employee Id = max(Id) FROM #Employee WHILE ( @Loop Counter IS NOT NULL AND @Loop Counter RESULT: In this approach using the Status column to mark the records which are already processed.
As you probably know, one of the bigger features added in SQL Server 2014 is the In-Memory OLTP engine, with its support for memory optimized tables, hash and BW-Tree indexes and natively compiled stored procedures.
The initial implementation precludes the ability to alter the definition of a memory optimized table once you created it.