Quantcast
Channel: Conversion failed when converting date and/or time from character string
Browsing all 16 articles
Browse latest View live

Conversion failed when converting date and/or time from character string

It can't. It works on select but not inserting to datetime field. Thanks for catching that. I had to do two insert statements, one is for datetime and one for other datatype.

View Article



Conversion failed when converting date and/or time from character string

How can you insert sql_variant data type value to your datetime column? You query fools you without an error by using sql_variant type due to the same type.But it does not work to insert the value to...

View Article

Conversion failed when converting date and/or time from character string

Hi danyeungw,Could you please tell us if your question has been resolved. If so, in order to close the thread, please kindly mark helpful replies as answers. By doing so, it will benefit all community...

View Article

Conversion failed when converting date and/or time from character string

I figured it out. Both have to be cast as sql_variant.select v.name, v.value,      case             whenisdate(v.value)= 1and...

View Article

Conversion failed when converting date and/or time from character string

Hi  danyeungw,Yes, if possible, could you please inform me more detailed information (such as your data type and  data sample)? The I will help you more correctly.Best Regards, Zoe ZhiMSDN Community...

View Article


Conversion failed when converting date and/or time from character string

when v.value is not null and rtrim(ltrim(v.value)) <> '' and isdate(v.value) = 1, it needs to be convert to datetime, not varchar(20). The data is insert into a table that has datetime data...

View Article

Image may be NSFW.
Clik here to view.

Conversion failed when converting date and/or time from character string

Use try_cast:... then try_cast(v.value as datetime)else  try_cast(v.value as datetime) endJust don't mess a datetime value as a string in the first place if you can. Any invalid datetime string will...

View Article

Conversion failed when converting date and/or time from character string

when v.value is not null and rtrim(ltrim(v.value)) <> '' and isdate(v.value) = 1, it needs to be convert to datetime, not varchar(20). The data is insert into a table that has datetime data...

View Article


Image may be NSFW.
Clik here to view.

Conversion failed when converting date and/or time from character string

Good day danyeungw,1. In your query you use CAST to convert the data type from string to DATETIME but you do not tell the server what is the style (the format) of the string. The server tries  to...

View Article


Conversion failed when converting date and/or time from character string

Try this: casewhen v.value is not null and rtrim(ltrim(v.value)) <> '' and isdate(v.value) = 1  then try_Convert(varchar(20),v.value ,100)else v.value end

View Article

Conversion failed when converting date and/or time from character string

I tried the following but still get the same error.case when v.value is not null and rtrim(ltrim(v.value)) <> '' and isdate(v.value) = 1 then try_cast(v.value as datetime) else v.value end

View Article

Conversion failed when converting date and/or time from character string

else should not be cast as datetime. It should be v.value. It caused the error.Thanks.

View Article

Conversion failed when converting date and/or time from character string

Use try_cast:... then try_cast(v.value as datetime)else  try_cast(v.value as datetime) endJust don't mess a datetime value as a string in the first place if you can. Any invalid datetime string will...

View Article


Conversion failed when converting date and/or time from character string

Sorry,it should be when isdate(v.value)=1and v.value isnotnulland rtrim(ltrim(v.value))<>''then cast(v.value as datetime)

View Article

Conversion failed when converting date and/or time from character string

The implicit conversion for column v.value to date/time. Post your table structure and get a better answer.  You may use try_cast function as well but you need a data type for your cast.Your CASE...

View Article


Conversion failed when converting date and/or time from character string

The following query returns an error "Conversion failed when converting date and/or time from character string". However, if I changed "else v.value" to "else null" or remove the else, it worked fine....

View Article
Browsing all 16 articles
Browse latest View live




Latest Images