27-03-24 11:58 PM
Hello,
I want to retrieve a DB table using "Data - OLEDB".
In that case, I want to get date/time type items as string type.
I wrote it like this:
cast(startdatesime as Char) as startdatetime
but it gives me an error.
If I just write "startdatetime" and get it as a date/time type, I can get it successfully without error.
Please let me know how to write this.
Thank you for all your help.
28-03-24 09:32 AM
Try String instead of Char
28-03-24 09:46 AM - edited 28-03-24 09:49 AM
Hello @John__Carter ,
Thank you for your reply.
I tried, but got error "Type String is not a defined system type.".
28-03-24 10:58 AM - edited 28-03-24 11:00 AM
This should give you the desired result:
cast(startdatetime as nvarchar(max)) as startdatetime
03-04-24 01:53 AM
Hello @Asilarow ,
Thank you for your reply.
I took your advice and described it this way:
CONVERT(NVARCHAR(max), startdatetime, 120) as startdatetime
and it worked fine. Thanks.