You are on page 1of 2

1.

Select * from (
select ROW_NUMBER() over(order by salary) as SalaryRowno,* from TblsalaryMaster
)s where SalaryRowno =3

2.

3. select * from TblEmployeeMaster where empid%2=0 --Even Numbers

select * from TblEmployeeMaster where empid%2=1 -- Odd Numbers

4. Select 'C' as Text


union all
Select 'A'
union all
Select 'P'
union all
Select 'O'
union all
Select 'N'
union all
Select 'E'

5. Select top 1* from TblEmployeeMaster order by empid desc

6. set identity_insert [dbo].[TblDepartment] on

insert into [dbo].[TblDepartment](Deptid,DeptCode,DeptName,CreatedUser)


select 10,'ACC','Accounts',1

set identity_insert [dbo].[TblDepartment] off

7. Select * from (
select ROW_NUMBER() over(order by salary) as SalaryRowno,* from TblsalaryMaster
)s where SalaryRowno =5

8. select empid,count(*)DuplicateCount from [dbo].[TblEmpSalaryMaster]


Group by Empid having count(*)>1

9.ETL is used to Transfer data from one database to another.

10.

11.Blocking happens when multiple users access the same tables at a time.
Deadlock will totally block the database for further process.

12.

13.

14.Adding Indexes,Try to avoid sub querys,Removing unwanted joins.

15.This is mechanism for handing errors using try block and Catch block.

declare @Salary numeric(14,3),@monthsalary numeric(14,3)


Declare @Workays int
Set @Salary=10000
set @Workays=0

--set @monthsalary=@Salary/@Workays

begin try

select @Salary/@Workays

end try

begin catch

end catch

You might also like