Sql Server Interview Questions and Answers

1) SQL Server query to split the Field into 2 Column.
This query the developer can use when the name consists of numeric value like Ram1, Ram2

Note – First 3 Character will be in First Column and the Last One in another Column

2) SQL Server query to returns the index of First numeric in the column

Note – The SQL Server (Transact-SQL) PATINDEX functions returns the location of a pattern in a string.
The search is not case-sensitive.

3) SQL server query to remove special characters from a string value.
Here all characters except 0-9, a-z and A-Z are removed and the remaining characters are returned.

Example of how to use the function:

Result:
abc123ABC

4) Queries to get the DepartmentName and the Employee in that Department
i.e  Software | RamBabu,Sandhya,Amatya,Urvi,Shryansh

5) SQL query to fetch value in tblUsersDay but not in tblUsersNight
In SQL Server, PostgreSQL, and SQLite, this can be done using the except keyword as follows:

6) Add the 3 more when Nmber column value is greater then zero otherwise add 2

7)  Alpha-Numeric Sorting in SQL Server

OR In Ascending

8) When we want to copy table from one Table to another new table

9) DateTime Example Modification in SQL Server.

10) SQL Server query to find the  third highest Salary from Salary Table.

Tagged , , . Bookmark the permalink.

Leave a Reply

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