Definately not if you're going to convert it back to a DateTime afterwards.It basically shows either a lack of knowledge, or complete disregard, for what is actually happening 'under the hood'. am i looking in the right direction? Ben Nadel Dec 21, 2006 at 7:22 AM 12,306 Comments Hrub,Sorry, I do not know anything about custom data types at this time
In .NET applications, you can usually format dates in data bound controls using the GUI interface, and you can also format things using the ToString() method of a true datetime value and specify all kinds of simple yet flexible formatting strings. Isn't it much easier to simply right-click on something and then enter a simple "mmm dd, yyyy" format string instead of building and parsing this manually using CONVERT and SUBSTRING parsing in T-SQL? Isn't it more flexible to do all formatting at your presentation layer so that you can just return data from your database and not worry about how it looks? Then 5 different clients can query the same stored procedure and each output those dates any way they want -- without changing any database code
I do not use Access) but I assumed that it would more generally be true for any ODBC data source and I am finding that what you have listed only applies *partially*. Even in Access, the dynamic columns that are generated with a PIVOT operator are very difficult to work with, since you cannot bind reports or forms to those column names that are changing
sql server - Conversion of a varchar data type to a datetime data type resulted in an out-of-range value - Database Administrators Stack Exchange
To compare those literals with the datetime column, SQL Server attempts to convert the strings to datetime types, according to the rules of data type precedence. I do not understand why the data is being converted from varchar to datetime when 'Created' is set to datetime: Do I need to tell the server that 'Created' is datetime? If not, why am I getting this varchar message? Edit: The value in the database was YYYY-MM-DD
Thanks! Log In or Register to post comments Anonymous User (not verified) on Dec 19, 2004 how to retrive the current value in the database Log In or Register to post comments Bru CARLONI (not verified) on Feb 21, 2002 How can i convert a sql datetime into a date, using MSQUERY, for Excel 97? Log In or Register to post comments kenneth (not verified) on Apr 18, 2001 Hi there ! I am using SQL 6.5 , my problem is , I am passing two dates into a stored procedure
Fill in your details below or click an icon to log in: Email (required) (Address never made public) Name (required) Website You are commenting using your WordPress.com account
Fill in your details below or click an icon to log in: Email (required) (Address never made public) Name (required) Website You are commenting using your WordPress.com account
Nonetheless, I usually use Method 1 (CONVERT function) because it is compatible with different versions of SQL SERVER and also the performance is better than other two. Fill in your details below or click an icon to log in: Email (required) (Address never made public) Name (required) Website You are commenting using your WordPress.com account
Sql Server string to date conversion - Stack Overflow
By "arbitrarily", I mean "a form that the person who wrote it, though perhaps not you or I or someone on the other side of the planet, would consider to be intuitive and completely obvious." Frankly, I'm not sure there is any such algorithm. The FORMAT() function and can also accept locales as an optional argument - it is based on .Net's format, so most if not all of the token formats you'd expect to see will be there
I don't understand the syntax error reported; but there is an outside chance of there being a version dependency - it is always crucial to report version numbers and platforms just in case. Often, I'd point out that Informix has a type for storing such values - DATETIME HOUR TO MINUTE - but I concede it occupies 3 bytes on disk instead of just 2, so it isn't as compact as a SMALLINT notation
No comments:
Post a Comment