cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Your Friends List is a way to easily have access to the community members that you interact with the most! X

Funny Bug? within MSSQL Select

bot1q
12-Amethyst

Funny Bug? within MSSQL Select

Hey guys,

 

can someone explain me that "bug?" which is growing from 8.2 --> current version.

 

SELECT MAX(VALUE_TIME)

FROM MyEpicTableDataAnonym

result = 2019-10.12 .....

 

and 

 

SELECT MAX(VALUE_TIME) AS EPICMAXTIME

FROM MyEpicTableDataAnonym

result = 2019-10.03 ..

 

 

results me in two different answers ...

 

 

 

12 REPLIES 12
bot1q
12-Amethyst
(To:bot1q)

No ideas?

eliotlandrum
14-Alexandrite
(To:bot1q)

I'm afraid you'll need to provide more context to understand what you're asking.

bot1q
12-Amethyst
(To:eliotlandrum)

If i do an SELECT without "AS MyFanceValue" I receive  a different result then when i use "AS" in the select statement

bot1q
12-Amethyst
(To:eliotlandrum)

SELECT MAX(VALUE_TIME)    // THIS IS ANONYM

FROM MyEpicTableDataAnonym

result = 2019-10.12 .....

 

and 

 

SELECT MAX(VALUE_TIME) AS EPICMAXTIME //THIS IS NOT ANONYM

FROM MyEpicTableDataAnonym

result = 2019-10.03 ..

 

 

results me in two different answers on the same data ...

eliotlandrum
14-Alexandrite
(To:bot1q)

Can you show some of the data and the type of field that VALUE_TIME is?

bot1q
12-Amethyst
(To:eliotlandrum)

That is data independent..

 

It is a MS -SQL Database and the type is Datatime 

eliotlandrum
14-Alexandrite
(To:bot1q)

I would like to be able to help you, but I really need more information than you're providing. Screenshots of table configuration and sample data would be extremely helpful. You haven't provided enough information for me to be able to replicate this on my own system. The result you showed is not a SQL datetime format (it has a period after the month, which is not standard and doesn't show a time), so you're modifying the results before sharing them here.

bot1q
12-Amethyst
(To:eliotlandrum)

SELECT  MAX(TIME)
FROM
[X].[Y].DATA

 

Where type of  DATA = datetypeoffset(7) // Database is MSSQL

 

Example of data: 2018-11-07 00:10:00.0000000 +01:00

Constantine
17-Peridot
(To:bot1q)

Hello @bot1q,

 

Wondering whether it's a ThingWorx issue, or MS SQL... Does it work correctly when you execute the same in another SQL client, e.g. sqlcmd?

 

/ Constantine

bot1q
12-Amethyst
(To:Constantine)

Directly in MSSQL query it works Well.

Constantine
17-Peridot
(To:bot1q)

Could also be a JDBC driver bug, make sure you use the latest version.

slangley
23-Emerald II
(To:bot1q)

Hi @bot1q.

 

Please let us know if you found a solution for your issue.  If one of the previous posts helped to solve it, please mark the appropriate one as the Accepted Solution.  Otherwise, please post the solution you found and mark that as the Accepted Solution for the benefit of others with the same issue.

 

Regards.

 

--Sharon

Announcements


Top Tags