title: Temp Procedure Not giving Output
body: <p>I created a temporary procedure in SQL Server but when I am trying to execute it, it worls fine except for output parameter.
  Output prarameter is not being able to get the output from SP. 
  I am not sure why this is occuring.</p>
  
  <pre><code>Alter Procedure #AgeDifference
  @DOB date,
  @output nvarchar(500) Out
  AS
  Begin
  Declare @tempdate date,@year int,@month int,@day int
  Set @tempdate=@DOB
  
  Select @year=DateDiff(Year,@tempdate,Getdate())-
     CASE
      WHEN DatePart(Month,@tempdate)&gt;DatePart(Month,Getdate()) 
      OR ( DatePart(Month,@tempdate)=DatePart(Month,Getdate()) AND 
  DatePart(Day,@tempdate)&gt;DatePart(Day,Getdate()))
      THEN 1
      Else 0
     END
  
  
  Set @tempdate=DateAdd(Year,@year,@tempdate)
  
  
  Select @month=DateDiff(Month,@tempdate,Getdate())-
     CASE
      WHEN DatePart(Day,@tempdate)&gt;DatePart(Day,Getdate()) 
      THEN 1
      Else 0
     END
  
  
  Set @tempdate=DateAdd(Month,@month,@tempdate)
  
  Select @day=DateDiff(Day,@tempdate,Getdate())
  
  Set @output= 'The difference is '+CAST(@year as nvarchar(10))+ ' Years '+CAST(@month as nvarchar(10))+ ' Months '
    +CAST(@day as nvarchar(10)) +' Days '
  
  print @output
  End
  
  
  Declare @out nvarchar(100)
  EXEC #AgeDifference '27/04/1994',@out
  print @out
  </code></pre>