Hi, I am trying to get the number of day between two dates. (A date and today's date)

The date is a string in the DD/MM/YYYY format.

I encoded the following function in SQL SSMS but I have a issue, as I select all my Date column, I got an error when I execute.

SQL Code:
  1. --Ma fonction--
  2. DECLARE @Day integer    --
  3. DECLARE @Month integer  --The date from dd/mm/yyyy format
  4. DECLARE @Year integer   --
  5. DECLARE @Now date   --The date of today
  6.  
  7. SET @Day = (SELECT SUBSTRING(date,1,2) as extractstring FROM Donnees_MET)
  8. SET @Month = (SELECT SUBSTRING(date,4,2) as extractstring FROM Donnees_MET)
  9. SET @Year = (SELECT SUBSTRING(date,7,4) as extractstring FROM Donnees_MET)
  10. SET @Now = (SELECT CONVERT (date, GETDATE()))
  11.  
  12. SELECT datediff(DAY, @Year-@Month-@Day, @Now)   --Number of days between the date and today

I don't know how I can loop on each result one by one to return the number of day between the date and today. (This is in order to send a notification after 30 days in a vb.net app)

Thank you for your help !