0

I'm trying to build a small tool in Powershell to select some data. One of the things I would like to get out is the query_hash, but when I do this with Powershell its not returning the same value as in SQL Management Studio.

In SQL Management Studio it shows like 0xFFCEA347FBFC247D7 but Powershell shows it like this {50, 123, 144, 118...}

Anybody who can tell me what I'm doing wrong?

codewario
  • 19,553
  • 20
  • 90
  • 159
superset
  • 71
  • 1
  • 2
  • 1
    Nothing, in principle. Management Studio formats `BINARY` values as hexstrings, PowerShell shows you a rendition of a `byte[]`. You can use something like `[BitConverter]::ToString($b).Replace("-","")` if you want a hexstring in PowerShell as well, or else directly in the query for consistency (`CONVERT(VARCHAR(MAX), value, 1)`). – Jeroen Mostert Oct 29 '19 at 13:58
  • This worked. Thank you. – superset Oct 29 '19 at 19:03

0 Answers0