Top Sql Server Interview Questions and their Answers

1)  How to create an empty table emp1 with same structure as emp?

2)  How to find the Max Salary from each department?

3) Retreive year part from the table ..

Similarly for MONTH

4) Get the difference of month of DateTime.

    Similarly for Days

5) Get all Employee details whose Joining Year is 2016.

6) Select all the Employees whose JoiningDate is JAN(1).

7) Split Date, month, Year from DateTime
Here is query
You can achieve this task in two ways.
b) Year,Mont,Day
Let’s see the Query:
Split Year,Month and Day from DateTime Column in SQL Server
a )


8) Function to Retrieve only character part from the given string in SQL Server

You can call the function like – 

The output will be – 

9) Function to Retrieve only Integer part from the given string in SQL Server

You can call this function like – 

The Output will be – 

Tagged , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.