SQL Server Merge two or more columns with integers into one and add characters between the values [closed]

xoshrz7s  于 2023-04-04  发布在  其他
关注(0)|答案(1)|浏览(135)

Closed. This question needs details or clarity . It is not currently accepting answers.

Want to improve this question? Add details and clarify the problem by editing this post .

Closed 3 days ago.
Improve this question

I have 3 metrics generated by sql_exporter as ints into Prometheus that are showing my SQL instance uptime. How can I merge them in one column in order to have a result like: dd hh:mm ?
I now that if I query the data source I can get this result set easily. But I want to use only 3 template variables to change all my panels to the desired environment/instance/mssqlinstance so I have to pass from the Prometheus data source.

I tried to concatenate them with the transformation Concatenate fields with no success.

ckocjqey

ckocjqey1#

You can convert you metrics into value in seconds:

mssql_server_uptime_days * 24 * 60 * 60 +
 mssql_server_uptime_hours * 60 * 60 +
  mssql_server_uptime_minutes * 60

And set units of column (Standard options > Unit) to Time > duration (d hh:mm:ss)

相关问题