SQL time difference between two dates result in hh:mm:ss

declare @StartDate datetime, @EndDate datetime select @StartDate=”10/01/2012 08:40:18.000″,@EndDate=”10/04/2012 09:52:48.000″ select convert(varchar(5),DateDiff(s, @startDate, @EndDate)/3600)+’:’+convert(varchar(5),DateDiff(s, @startDate, @EndDate)%3600/60)+’:’+convert(varchar(5),(DateDiff(s, @startDate, @EndDate)%60)) as [hh:mm:ss] This query will helpful to you.

Add a column if it doesn’t exist to all tables?

You cannot use variables, like @tableName, in DDL. Besides, splinting the name into part and ignoring the schema can only result in bugs. You should just use the ”?” replacement in the SQL batch parameter and rely on the MSforeachtable replacement: EXEC sp_MSforeachtable ‘ if not exists (select * from sys.columns where object_id = object_id(”?”) … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)