title: How to make a function where user can input the year and month which automatically find the last day of the month?
body: <p>I want to write a sql function where user has a text box to input the data where USER can input the year and month to find the last day of the month. 
  I have written this query but it is only returning last day of the current month. </p>
  
  <pre><code>CreateFunction [dbo].[Date]()
  Returns int
  AS
  BEGIN 
  DECLARE @aint
  
     set @a=  CAST( Convert(VARCHAR(10), EOMONTH(DateADD(d, -1, GETDATE())),112) As int )
  Return @a
  End
  </code></pre>