我正在尝试将一个过程转换为在 SQL Azure 中使用。我首先收到一条错误消息,OPENXML
说 SQL Azure 不支持它,然后我发现它可以替换为nodes
.
但我不确定如何转换WITH (Id BIGINT '.')
零件。我知道WITH
创建一个子查询,但'.'
这里在做什么?
CREATE Procedure [dbo].[DocsR]
@ids xml -- <Ids><Id>1</Id><Id>2</Id></Ids>
AS
BEGIN
SET NOCOUNT ON;
DECLARE @IdsXml xml
exec sp_xml_preparedocument @IdsXml OUTPUT, @Ids
SELECT
DoctId,
DocNm
FROM
Docs
WHERE
--DocId IN (SELECT Id FROM OPENXML(@IdsXml, '/Ids/Id', 2) WITH (Id BIGINT '.'))
DocId IN (SELECT Id FROM @IdsXml.nodes('/Ids/Id') WITH (Id BIGINT '.'))
END
GO
错误:
Incorrect syntax near the keyword 'with'. If this statement is a common
table expression, an xmlnamespaces clause or a change tracking context clause,
the previous statement must be terminated with a semicolon.