save result of exec sp_excutequery using xpath
问题 Hi i have this example DECLARE @XML1 xml, @XPath nvarchar(200), @EncodedXPath nvarchar(200), @Sql nvarchar(max), @val nvarchar(20) SET @XML1=' <Root> <Device> <Inspection> <Status>OK</Status> </Inspection> </Device> </Root>' SELECT @XML1.query('/Root[1]/Device[1]/Inspection[1]/Status[1]') SELECT @XML1.value('/Root[1]/Device[1]/Inspection[1]/Status[1]','varchar(5)') SET @XPath = '/Root[1]/Device[1]/Inspection[1]/Status[1]' SET @EncodedXPath = REPLACE(@XPath, '''', '''''') SET @Sql = N'SELECT