Viewing 15 posts - 10,786 through 10,800 (of 15,376 total)
I can not only replicate this I can explain why it is happening. It is a bit strange but is further proof that implicit conversions should be avoided. When selecting...
September 7, 2012 at 1:43 pm
Andrew-495157 (9/7/2012)
There is a consistency within SQL issue here which I don't understand
Why did the conversion NEVER fail with the value 'AB' is in the column?
This value has been there...
September 7, 2012 at 1:06 pm
Luis Cazares (9/7/2012)
SELECTCAST( GETDATE() AS DATE),
DATEADD( DD,DATEDIFF(DD, 0, GETDATE()),0)
If you just need dates with no time, you should store them that way and even with...
September 7, 2012 at 11:16 am
Andrew-495157 (9/7/2012)
BUT - the issue is not conversion per se. I don't need any more info on coercion, casting, conversion etc!
The issue now is - why the code...
September 7, 2012 at 11:12 am
You do this with some pretty simple date math. Just use the beginning of the day when comparing.
See this article from Lynn about some common datetime routines. http://www.sqlservercentral.com/blogs/lynnpettis/2009/03/25/some-common-date-routines/%5B/url%5D
September 7, 2012 at 11:03 am
Andrew-495157 (9/7/2012)
When SQL compares column values with a variable value where the values are diferent data types.
There are 2 posibel methods:
1 Coerce each column value as it is read row...
September 7, 2012 at 10:59 am
I think is the one Lynn was thinking of.
http://msdn.microsoft.com/en-us/library/ms190309.aspx
Implicit conversions, which is what you have when datatypes don't match (like int and varchar) will always attempt to use the higher...
September 7, 2012 at 10:53 am
vinay.varaala (9/7/2012)
this is the querywhere Simmons_PanelID=5479 AND convert(Date,Reading_Date,103)='2012-09-05'
Your where clause has rendered this nonSARGable. You don't need to convert your date to a formatted date string for this...
September 7, 2012 at 9:02 am
ChrisM@Work (9/7/2012)
sqlnaive (9/7/2012)
For such kind of reasons we should avoid float and real datatypes ? And rather use decimal and numeric ?
Have a look in BOL under CONVERT to see...
September 7, 2012 at 8:38 am
Hi and welcome to SSC.
This can certainly be done but in order to help you need to first help us. You will need to post ddl (create table scripts),...
September 7, 2012 at 8:09 am
bitbucket-25253 (9/7/2012)
SQL* (9/7/2012)
Hi All,I have posted the question in General discussion, but i did not find any answer so i am posting her:
thanks
Clicking on the above link returned 111...
September 7, 2012 at 7:35 am
And to add to Luis, there is a reason we have a datetime datatype in sql. Please us it and not some horrible integer/string disaster. It will cause you and...
September 7, 2012 at 7:29 am
Richard Warr (9/7/2012)
I looked at the first option and was disappointed that the second one wasn'tCollect $200 for parsing GO.
+1 😀
Good question. Made me stop and think before my first...
September 7, 2012 at 7:26 am
Here is my take on what you need to do. You should read the article at the first link in my signature, the one about best practices. Keep in mind...
September 7, 2012 at 7:12 am
Lynn Pettis (9/6/2012)
I guess we are supposed to be miracle workers here and know just what went wrong given minimal information.
I saw that post and got very quiet as I...
September 6, 2012 at 3:08 pm
Viewing 15 posts - 10,786 through 10,800 (of 15,376 total)