久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

<i id='QvIxg'><tr id='QvIxg'><dt id='QvIxg'><q id='QvIxg'><span id='QvIxg'><b id='QvIxg'><form id='QvIxg'><ins id='QvIxg'></ins><ul id='QvIxg'></ul><sub id='QvIxg'></sub></form><legend id='QvIxg'></legend><bdo id='QvIxg'><pre id='QvIxg'><center id='QvIxg'></center></pre></bdo></b><th id='QvIxg'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='QvIxg'><tfoot id='QvIxg'></tfoot><dl id='QvIxg'><fieldset id='QvIxg'></fieldset></dl></div>

    <bdo id='QvIxg'></bdo><ul id='QvIxg'></ul>
<tfoot id='QvIxg'></tfoot>

      <small id='QvIxg'></small><noframes id='QvIxg'>

      <legend id='QvIxg'><style id='QvIxg'><dir id='QvIxg'><q id='QvIxg'></q></dir></style></legend>

    1. 在 SQL Server XML 處理中為 modify() 參數化 XPath

      Parameterizing XPath for modify() in SQL Server XML Processing(在 SQL Server XML 處理中為 modify() 參數化 XPath)

        <bdo id='ZBs0C'></bdo><ul id='ZBs0C'></ul>

        • <tfoot id='ZBs0C'></tfoot>
        • <small id='ZBs0C'></small><noframes id='ZBs0C'>

            <i id='ZBs0C'><tr id='ZBs0C'><dt id='ZBs0C'><q id='ZBs0C'><span id='ZBs0C'><b id='ZBs0C'><form id='ZBs0C'><ins id='ZBs0C'></ins><ul id='ZBs0C'></ul><sub id='ZBs0C'></sub></form><legend id='ZBs0C'></legend><bdo id='ZBs0C'><pre id='ZBs0C'><center id='ZBs0C'></center></pre></bdo></b><th id='ZBs0C'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='ZBs0C'><tfoot id='ZBs0C'></tfoot><dl id='ZBs0C'><fieldset id='ZBs0C'></fieldset></dl></div>

              <legend id='ZBs0C'><style id='ZBs0C'><dir id='ZBs0C'><q id='ZBs0C'></q></dir></style></legend>
                <tbody id='ZBs0C'></tbody>
                本文介紹了在 SQL Server XML 處理中為 modify() 參數化 XPath的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                問題描述

                限時送ChatGPT賬號..

                正如標題所暗示的那樣,我正在嘗試為 SQL Server 中 XML 數據列的 modify() 方法參數化 XPath,但遇到了一些問題.

                Just like the title suggests, I'm trying to parameterize the XPath for a modify() method for an XML data column in SQL Server, but running into some problems.

                到目前為止我有:

                DECLARE @newVal varchar(50)
                DECLARE @xmlQuery varchar(50)
                SELECT @newVal = 'features'
                SELECT @xmlQuery = 'settings/resources/type/text()'
                
                UPDATE  [dbo].[Users]
                SET     [SettingsXml].modify('
                    replace value of (sql:variable("@xmlQuery"))[1]
                    with sql:variable("@newVal")')
                WHERE   UserId = 1
                

                具有以下 XML 結構:

                with the following XML Structure:

                <settings>
                    ...
                    <resources>
                        <type> ... </type>
                        ...
                    </resources>
                    ...
                </settings>
                

                然后產生這個錯誤:

                XQuery [dbo.Users.NewSettingsXml.modify()]:'replace'的目標最多只能是一個節點,找到'xs:string ?'

                現在我意識到修改方法一定不能接受字符串作為路徑,但是有沒有辦法不使用動態 SQL 來實現這一點?

                Now I realize that the modify method must not be capable of accepting a string as a path, but is there a way to accomplish this short of using dynamic SQL?

                哦,順便說一下,我使用的是 64 位 SQL Server 2008 Standard,但我編寫的任何查詢都需要與 2005 Standard 兼容.

                Oh, by the way, I'm using SQL Server 2008 Standard 64-bit, but any queries I write need to be compatible back to 2005 Standard.

                謝謝!

                推薦答案

                如果有人感興趣,我自己使用動態查詢想出了一個相當不錯的解決方案:

                In case anyone was interested, I came up with a pretty decent solution myself using a dynamic query:

                DECLARE @newVal nvarchar(max)
                DECLARE @xmlQuery nvarchar(max)
                DECLARE @id int
                
                SET @newVal = 'foo'
                SET @xmlQuery = '/root/node/leaf/text()'
                SET @id = 1
                
                DECLARE @query nvarchar(max)
                
                SET @query = '
                    UPDATE  [Table]
                    SET     [XmlColumn].modify(''
                        replace value of (' + @xmlQuery + '))[1]
                        with sql:variable("@newVal")'')
                    WHERE Id = @id'
                
                EXEC sp_executesql @query,
                                   N'@newVal nvarchar(max) @id int',
                                   @newVal, @id
                

                使用它,動態查詢中唯一不安全的部分是 xPath,就我而言,它完全由我的代碼控制,因此不應被利用.

                Using this, the only unsafe part of the dynamic query is the xPath, which, in my case, is controlled entirely by my code and so shouldn't be exploitable.

                這篇關于在 SQL Server XML 處理中為 modify() 參數化 XPath的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                相關文檔推薦

                Can I figure out a list of databases and the space used by SQL Server instances without writing SQL queries?(我可以在不編寫 SQL 查詢的情況下找出數據庫列表和 SQL Server 實例使用的空間嗎?) - IT屋-程序員軟件開發
                How to create a login to a SQL Server instance?(如何創建對 SQL Server 實例的登錄?)
                How to know the version and edition of SQL Server through registry search(如何通過注冊表搜索知道SQL Server的版本和版本)
                Why do I get a quot;data type conversion errorquot; with ExecuteNonQuery()?(為什么會出現“數據類型轉換錯誤?使用 ExecuteNonQuery()?)
                How to show an image from a DataGridView to a PictureBox?(如何將 DataGridView 中的圖像顯示到 PictureBox?)
                WinForms application design - moving documents from SQL Server to file storage(WinForms 應用程序設計——將文檔從 SQL Server 移動到文件存儲)
                <i id='jLeBh'><tr id='jLeBh'><dt id='jLeBh'><q id='jLeBh'><span id='jLeBh'><b id='jLeBh'><form id='jLeBh'><ins id='jLeBh'></ins><ul id='jLeBh'></ul><sub id='jLeBh'></sub></form><legend id='jLeBh'></legend><bdo id='jLeBh'><pre id='jLeBh'><center id='jLeBh'></center></pre></bdo></b><th id='jLeBh'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='jLeBh'><tfoot id='jLeBh'></tfoot><dl id='jLeBh'><fieldset id='jLeBh'></fieldset></dl></div>
              • <tfoot id='jLeBh'></tfoot>
                  <legend id='jLeBh'><style id='jLeBh'><dir id='jLeBh'><q id='jLeBh'></q></dir></style></legend>

                  <small id='jLeBh'></small><noframes id='jLeBh'>

                    <tbody id='jLeBh'></tbody>
                    • <bdo id='jLeBh'></bdo><ul id='jLeBh'></ul>
                          主站蜘蛛池模板: 色在线免费| 羞羞的视频免费在线观看 | 免费电影av | 性天堂网 | av在线免费播放 | 国产精品99999 | 国产一区二区三区在线 | 一区二区三区在线播放 | 一级视频在线免费观看 | 日韩欧美国产精品一区 | 国产福利91精品一区二区三区 | 草草视频在线播放 | 国产91视频一区二区 | 一级片在线观看 | 欧美日韩福利 | 欧美精品在线看 | 亚洲性人人天天夜夜摸 | 欧美一区二区三区在线视频 | 欧美成人综合 | 成人在线免费观看 | 浮生影院免费观看中文版 | 亚洲精品成人免费 | 中文字幕男人的天堂 | 亚洲网站在线观看 | av高清| 狠狠色综合久久丁香婷婷 | 欧美专区日韩专区 | 亚洲精品成人在线 | 成人国产在线视频 | 亚洲自拍偷拍av | 国产精品亚洲第一 | 91婷婷韩国欧美一区二区 | 日本a网站 | 国产精品国产成人国产三级 | 九九九视频精品 | 国产一区999 | 亚洲精品专区 | 中文字幕第一页在线 | 亚洲精品www| 亚洲视频免费 | 亚洲国产精品福利 |