Why are you preparing the SQL string to be executed in your client code anyway? Why don't you use a stored procedure here?
Piggy-backing on Habib, this should be interesting:
http://www.karaszi.com/SQLServer/info_datetime.asp
--
Frank Kalis
Microsoft SQL Server MVP
Webmaster: http://www.insidesql.org/blogs
My blog: http://www.insidesql.org/blogs/frankkalis/[/url]