INSERT INTO temptbl_Stops
SUM(CAST(DATEDIFF(s, StopDate, StartDate) AS NUMERIC(4, 0)) / 60) AS StopTime,
GROUP BY StartDate,
HAVING ( SUM(CAST(DATEDIFF(s, StopDate, StartDate) AS NUMERIC(4, 0)) / 60) IS NOT NULL )
ORDER BY StartDate
Open in new window
Solve your biggest tech problems alongside global tech experts with 1:1 help.
'Assuming that the query is already saved as a stored procedure on your server
Dim con As New System.Data.SqlClient.SqlConnection("ConnectionString to your database")
Dim cmd As New System.Data.SqlClient.SqlCommand("qry_Stops") 'Or another name
cmd.CommandType = CommandType.StoredProcedure
cmd.Connection = con
Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.