Friday, 15 February 2013

IMPORTANT SQL QUERIES

1)How to remove duplicate records using cte?
A)

with cte as


select id,name,salary,ROW_NUMBER()
 over(partition by id order by id)
  as DUPS
  from emp40000
 )
 delete from cte where DUPS>1

2)How to find 2nd highest salary?
A)
with cte as
(
select salary,ROW_NUMBER()  over(order by salary asc)
 as highsalaries 
from employee 
)
select salary from cte where highsalaries=2

3)Self join example?

A)select e1.name Employeeselfjoin,e2.Name as manager 
from
Employeeselfjoin e1
inner join
Employeeselfjoin e2
on
e1.EmployeeID=e2.ManagerID






Thursday, 7 February 2013

SSIS INTERVIEW QUESTIONS



1)Difference between Sql server destination and oledb destination?
The SQL server destination uses shared memory to connect to the SQL server database.It also has some 
SQL Server specific optimizations that allow pushing data faster to the database (using insert Bulk).As a
 result, it will be faster than the OLEDB provider, but has more restrictions.
Most important restriction is that it will only work on a local server.So if your production environment
 has SSIS package running on a different server than the destination server, use Oledb.

2)How to handle failed rows in ssis? or 

how to handle redirected bad rows in ssis 


How to handle Failed Rows in a Data Flow

Reza Rad's Technical blog