【发布时间】:2020-06-01 19:59:21
【问题描述】:
我正在向@xCriteria 传递一个如下所示的 XML 参数:
<?xml version="1.0" encoding="utf-8"?>
<searchParameters xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<includeInactive enabled="True" />
</searchParameters>
我知道 xpath 是://includeInactive/@enabled
并尝试过:
--determine if we include inactive users
DECLARE @isInactive AS bit
-- SELECT @isInactive = @xCriteria.value('(/includeInactive/@enabled', 'bit')
-- SET @isInactive = @xCriteria.query('/includeInactive/@enabled')
-- SELECT @isInactive.value('(/includeInactive/enabled)[1]', 'bit')
-- SELECT @isInactive = @xCriteria.query('/includeInactive/@enabled')
PRINT '@isInactive'
PRINT @isInactive
如何获取布尔值?
【问题讨论】:
-
在 Microsoft SQL Server 中
标签: sql stored-procedures sql-server-2012