久久久久久久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>
                          主站蜘蛛池模板: 久久9热 | 亚洲美乳中文字幕 | 成人在线精品 | 日韩一级一区 | 91一区二区 | 国产一级免费视频 | 四虎成人av | 福利网站在线观看 | 国产日韩久久 | 国产区一区| 在线午夜 | 中文字幕日韩欧美一区二区三区 | 另类视频区 | 自拍视频国产 | 91高清视频 | 成人免费观看视频 | 国产在线观看一区二区三区 | 久久一区精品 | 成人一级视频在线观看 | 五月免费视频 | 在线观看成人免费视频 | 欧美久久一区二区三区 | 亚洲精品视频在线 | 超碰日韩 | 免费亚洲视频 | 一级毛片在线播放 | 国产一区免费 | 羞羞的视频免费看 | 日本精品视频 | 一区二区免费看 | 久久综合九色综合欧美狠狠 | 99色在线视频 | 欧美日韩精品一区二区三区视频 | 色站综合 | 一级a性色生活片久久毛片 午夜精品在线观看 | 狠狠操狠狠干 | 成人一区二区三区在线 | 美女黄色在线观看 | 国产精品一区二区三 | 国产欧美一区二区在线观看 | 欧美在线视频一区 |