February 28, 2013

Identity In temp Table



Insert data into table with identity column
This query is used to INSERT identity column into tamp table

SELECT IDENTITY(INT, 1 , 1) AS ID,  COLUMN1 , COLUMN2
INTO #TABLE1
FROM dbo.TABLE2;

February 4, 2013

Polymorphism


Polymorphism
One Name and many forms, Polymorphism is one of the fundamental concepts of OOP.
Polymorphism is of two types:
1. Compile time polymorphism/Overloading
2. Run time polymorphism/Overriding
Compile time polymorphism/Overloading (early binding):
In this type of polymorphism, compiler at compile time  identifies which form it has to execute
There are few advantages of compile time polymorphism:
Advantage of early binding is execution will be fast. Because every thing about the method is known to compiler during compilation it self

But disadvantage is lack of flexibility.
   Eg: Method Overloading
          Operator Overloading
Run time polymorphism/Overriding (Late binding):
In this type of polymorphism, compiler at Run time  identifies which form it has to execute
There are few advantages of run time polymorphism
Advantage of Late binding is execution will be slow. Because every thing about the method is known to compiler during run time
Example of Run time Polymorphism is:
Interface
Method overriding
Examples of early binding are overloaded methods, overloaded operators and overridden methods that are called directly by using derived objects.