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.

SQL Server: Isolation level leaks across pooled connections

The connection pool calls sp_resetconnection before recycling a connection. Resetting the transaction isolation level is not in the list of things that sp_resetconnection does. That would explain why “serializable” leaks across pooled connections. I guess you could start each query by making sure it’s at the right isolation level: if not exists ( select * … Read more

Bulk Insert Partially Quoted CSV File in SQL Server

Unfortunately SQL Server interprets the quoted comma as a delimiter. This applies to both BCP and bulk insert . From http://msdn.microsoft.com/en-us/library/ms191485%28v=sql.100%29.aspx If a terminator character occurs within the data, it is interpreted as a terminator, not as data, and the data after that character is interpreted as belonging to the next field or record. Therefore, … Read more

EF4 – The selected stored procedure returns no columns

EF doesn’t support importing stored procedures which build result set from: Dynamic queries Temporary tables The reason is that to import the procedure EF must execute it. Such operation can be dangerous because it can trigger some changes in the database. Because of that EF uses special SQL command before it executes the stored procedure: … Read more