The document outlines a series of SQL Server tasks involving the creation of various functions and queries using the ITI database. It includes instructions for scalar and table-valued functions, as well as queries for data manipulation and retrieval. Additionally, there are bonus tasks related to Hierarch ID data type and batch insertion into an employee table in the CompanyDB.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
37 views2 pages
SQLServer Lab7
The document outlines a series of SQL Server tasks involving the creation of various functions and queries using the ITI database. It includes instructions for scalar and table-valued functions, as well as queries for data manipulation and retrieval. Additionally, there are bonus tasks related to Hierarch ID data type and batch insertion into an employee table in the CompanyDB.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2
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. Wirte query to delete all grades for the students Located in SD Department Bonus:
1. Give an example for Hierarch id Data type
2. Create a batch that inserts 3000 rows in the employee table. The values of the emp_no column should be unique and between 1 and 3000. All values of the columns emp_lname, emp_fname, and dept_no should be set to 'Jane', ' Smith', and ' d1', respectively.”USE CompnayDB”