SQLTeam.com | Weblogs | Forums

How to create function by passing year and department

Please help me to wite the code

eid INT,
ename varchar(100),
dept VARCHAR(100),
j_date varchar(50)

insert into employee values

Create a function to find the early joined employee(id and name) by passing the year and dept as parameters.
note the dept might be given as empty if needed. in that case,find the early joined employee based on the year.if the dept is given,
then find the employee based on the respective dept with the year that are passing.

ex: func_early_emp('2002',") then output should be "emp id and name is 3 and CCC"
func_early_emp('2002','prod') then output should be "emp id and name is 1 and AAA"

What have you tried so far? You should start by using a proper date type instead of varchar for dates.

Im asking code for output.. please help me

Please help me to solve.

Can you please help me with code