Friday 11 October 2013

06. Create a user-defined function that accepts the account number of a customer and returns the customer's name from the Depositor table. Further, ensure that after creating the function, user is not able to alter or drop the Depositor table.

create Function fx_disp_Accdet(@accnum int)
Returns Table with Schemabinding
as
Return
(
select Customer_name, Acc_num
from dbo.Depositor
Where Acc_num=@accNum
)


select * from Fx_Disp_AccDet(101)

No comments:

Post a Comment