SQLServer Lab
Note: Use ITI DB
1. Create a scalar function that takes date and returns Month name of that
date.
2. Create a multi-statements table-valued function that takes 2 integers
and returns the values between them.
3. Create inline function that takes Student No and returns Department
Name with Student full name.
4. Create a scalar function that takes Student ID and returns a message to
user
a. If first name and Last name are null then display 'First name &
last name are null'
b. If First name is null then display 'first name is null'
c. If Last name is null then display 'last name is null'
d. Else display 'First name & last name are not null'
5. Create inline function that takes integer which represents manager ID
and displays department name, Manager Name and hiring date
6. Create multi-statements table-valued function that takes a string
If string='first name' returns student first name
If string='last name' returns student last name
If string='full name' returns Full Name from student table
Note: Use “ISNULL” function
7. Write a query that returns the Student No and Student first name
without the last char
8. Write query to delete all grades for the students Located in SD
Department
Bonus:
1. Give an example for hierarchyid Data type
2. Create a batch that inserts 3000 rows in the student table(ITI database).
The values of the st_id column should be unique and between 3000 and
6000. All values of the columns st_fname, st_lname, should be set to 'Jane',
' Smith' respectively.