0

I have two store procedures, in one of them I want to get one field form my view that has a Date value.

In the another one which is called StoredProcedure I want to convert the output value of first stored procedure to Hijri Shamsi Date:

This is my first stored procedure that gets the date column:

ALTER PROCEDURE GetExamDate 
    @Id INT
AS
    SELECT ExamTime 
    FROM View_SubjectStudyCourse
    WHERE @Id = CourseId
GO

and then I want to use the below code in the second procedure to converts the Gregorian date to Hijri date is:

DECLARE @DateTime AS DATETIME
SET @DateTime = GETDATE()

SELECT 
    @DateTime AS [Gregorian Date],
    CONVERT(VARCHAR(11), @DateTime, 131) AS [Gregorian date to Hijri date]
GO

Now I don't know how to use the above code in second stored procedure and how can I return value of the GetExamDate Procedure in the second procedure?!

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
dorsa
  • 85
  • 7

1 Answers1

1

In First Stored Procedure, return the date as an out parameter

In Second Stored Procedure,

DECLARE @examDate DateTime
EXECUTE GetExamDate @examDate OUTPUT

Then you can use the value of @examDate, which is the result from 1st SP.

Habeeb
  • 7,601
  • 1
  • 30
  • 33