Click here to Skip to main content
15,910,877 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
This queastion asked in my interview
Posted

Several ways, but one is like this:

DECALRE @variable Varchar(MAX)

SET @variable = dbo.YourFunction("some expression and/or value to pass to your function")
 
Share this answer
 
v3
I am giving few steps:

1. Create a function for addition two number

SQL
CREATE FUNCTION AddTwoNumber
(
	@first int,
	@second int
)
RETURNS int
AS
Begin
declare @add int
SET @add= @first + @second
return @add
end


2. Create a stored procedure that call function

SQL
CREATE Procedure proc_AddTwoNumber
(
	@first int,
	@second int
)
AS
SELECT  dbo.AddTwoNumber(@first,@second)


3. call the stored procedure

SQL
exec proc_AddTwoNumber 12,13
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900