我正在使用一个数据库,其中颜色存储为整数。由于某些未知原因,它们实际上是负整数。
现在,我需要在 CSSbackground-color
属性中使用它们,该属性接受颜色名称、RGB 颜色或十六进制颜色。问题是我不知道如何正确转换它们以获得可接受的字符串值。
我尝试使用转换-65280
,CONVERT(VARBINARY(8), abs(S.Color))
我正在获取0x0000FF00
. 但是,我需要的输出是#00ff00
或rgb(0,255,0)
。我怎样才能做到这一点?
按照此页面中的示例,我无法阻止存储过程返回选择数据集。
执行这个:
SET NOCOUNT OFF;
GO
-- Display the count message.
SELECT 'should be displayed'
GO
-- SET NOCOUNT to ON to no longer display the count message.
SET NOCOUNT ON;
GO
SELECT 'should NOT be displayed'
GO
-- Reset SET NOCOUNT to OFF
SET NOCOUNT OFF;
GO
Run Code Online (Sandbox Code Playgroud)
将返回给我:
这是一个错误吗?有什么不对?我在 SQL Server 13.0.4206 上