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

Community Tip - If community subscription notifications are filling up your inbox you can set up a daily digest and get all your notifications in a single email. X

Funny Bug? within MSSQL Select

bot1q
11-Garnet

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
11-Garnet
(To:bot1q)

No ideas?

eliotlandrum
12-Amethyst
(To:bot1q)

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

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

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
12-Amethyst
(To:bot1q)

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

That is data independent..

 

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

eliotlandrum
12-Amethyst
(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.

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

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

Directly in MSSQL query it works Well.

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

Top Tags