Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Passing dates via stored procedure

Author  Topic 

JohnSourcer
Starting Member

9 Posts

Posted - 2010-12-14 : 03:27:03
Hi Guru's,

Stumped here. I pass a date to a SP as '14/12/2010 10:08:44' but when I profile the SP it receives it as '2010-12-14 10:08:44.9100000' it then errors out with:Error converting data type varchar to datetime

:( This has never happened to me before. Any idea's?

Thanks

JohnSourcer
Starting Member

9 Posts

Posted - 2010-12-14 : 04:02:12
Solved by setting data type to datetime2.
Go to Top of Page

jcelko
Esteemed SQL Purist

547 Posts

Posted - 2010-12-14 : 14:16:35
In addition to what John just told you, the ISO-8601 temporal formats are the ONLY ones allowed in the ANSI/ISO Standards for SQL and a ton of other Standards.

You ought to be planning on getting rid of your old "dialect dates" so your code will be maintainable, interface to the rest of the world, etc. as part of your porting to SS-2008.

--CELKO--
Books in Celko Series for Morgan-Kaufmann Publishing
Analytics and OLAP in SQL
Data and Databases: Concepts in Practice
Data, Measurements and Standards in SQL
SQL for Smarties
SQL Programming Style
SQL Puzzles and Answers
Thinking in Sets
Trees and Hierarchies in SQL
Go to Top of Page
   

- Advertisement -