Hi,I've just encountered a problem that only occurs on our live server and not the dev server (both SQL Server 2008).It seems that running T-SQL that converts a varchar to a datetime executes differently depending upon the user you've currently logged in as.Logged in using the account created in SQL I get the following error:The conversion of a varchar data type to a datetime data type resulted in an out-of-range value.But if logged in using a Windows account the sql executes without issue:Command(s) completed successfully.The following t-sql was used to test the issue:DECLARE @TimespanTo datetimeSET @TimespanTo = CAST('2009 jul 31 23:00:00.000' AS DATETIME)DECLARE @TimestampTo datetime;SET @TimestampTo = CAST( CAST(DATEPART(year, @TimespanTo) AS varchar(4)) + '-' + CAST(DATEPART(month, @TimespanTo) AS varchar(2)) + '-' + CAST(DATEPART(day, @TimespanTo) AS varchar(2)) + ' 00:00:00' AS datetime);Anyone have any idea what is happening with the SQL account and how to resolve the issue?Cheers,Gavinwww.gavinharriss.com