Ignition sql tag result is different from SQL server side


i do the sql query in the server side,
i can see the result is
‘0x9BBE97A19BBDA4929BBDFE969BBDA7F79BBFFE9A35303030313533363430209BBDF7919BBDA7F79BBFFE9A3136473031303334350A9BBDE4E99BBE9AC49BBDFE969BBDF0819BBFFE9A46343939303130303638209BBDE4E99BBDA9C19BBFFE9A9BBEBDD19BBE84F24E549BBDC4F69BBDC4CB9BBDBCA62020200A9BBDF0DB9BBDBDA69BBFFE9A33312E36329BBDF8F320209BBDCAF09BBEA3CF9BBFFE9A319BBDCEE12041544F3A54585A3138383239360A9BBDF7B19BBDB2B49BBDA4B69BBEA0A00A20202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020’

i can use python decode(‘hex’) make it works

but i found if i use sql tag , the result is not the same

image

why my sql tag is totally different from the result in the sql side?

What’s the actual data type of the column you’re returning?
It looks like the JDBC driver or Ignition is automatically coercing it into a different, string-based encoding.

your guess is right, if i set the query tag is string or text , it is what my picture shows
image
after i check my SQL server side, i found the DataType is binary


but if i set the tag to Binary Data, it shows connect bad.
how to make the query result the same as what i have done in the sql server side?

It looks like returning base64 to me. Can you check what you get when you execute the following code on the returned string in Ignition?

import base64
base64.b64decode(text)
1 Like


it works thanks a lot

1 Like