• <tfoot id='SIvYX'></tfoot>

    • <bdo id='SIvYX'></bdo><ul id='SIvYX'></ul>
    1. <legend id='SIvYX'><style id='SIvYX'><dir id='SIvYX'><q id='SIvYX'></q></dir></style></legend>

      1. <i id='SIvYX'><tr id='SIvYX'><dt id='SIvYX'><q id='SIvYX'><span id='SIvYX'><b id='SIvYX'><form id='SIvYX'><ins id='SIvYX'></ins><ul id='SIvYX'></ul><sub id='SIvYX'></sub></form><legend id='SIvYX'></legend><bdo id='SIvYX'><pre id='SIvYX'><center id='SIvYX'></center></pre></bdo></b><th id='SIvYX'></th></span></q></dt></tr></i><div id='SIvYX'><tfoot id='SIvYX'></tfoot><dl id='SIvYX'><fieldset id='SIvYX'></fieldset></dl></div>

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

        SQL Server - 将数据库列从 varchar 更新为 nvarchar(如果还不是 nvarchar)的脚本

        时间:2023-06-24
        <tfoot id='Ned6V'></tfoot>
            <tbody id='Ned6V'></tbody>
        1. <i id='Ned6V'><tr id='Ned6V'><dt id='Ned6V'><q id='Ned6V'><span id='Ned6V'><b id='Ned6V'><form id='Ned6V'><ins id='Ned6V'></ins><ul id='Ned6V'></ul><sub id='Ned6V'></sub></form><legend id='Ned6V'></legend><bdo id='Ned6V'><pre id='Ned6V'><center id='Ned6V'></center></pre></bdo></b><th id='Ned6V'></th></span></q></dt></tr></i><div id='Ned6V'><tfoot id='Ned6V'></tfoot><dl id='Ned6V'><fieldset id='Ned6V'></fieldset></dl></div>

              • <bdo id='Ned6V'></bdo><ul id='Ned6V'></ul>

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

                • <legend id='Ned6V'><style id='Ned6V'><dir id='Ned6V'><q id='Ned6V'></q></dir></style></legend>
                • 本文介绍了SQL Server - 将数据库列从 varchar 更新为 nvarchar(如果还不是 nvarchar)的脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我必须使用脚本将现有数据库结构从 varchar 更新为 nvarchar.由于每次运行配置应用程序时都会运行此脚本,因此我宁愿确定列是否已更改为 nvarchar,而不是对表执行更改.我必须支持的数据库是 SQL Server 2000、2005 和 2008.

                  I am in a situation where I must update an existing database structure from varchar to nvarchar using a script. Since this script is run everytime a configuration application is run, I would rather determine if a column has already been changed to nvarchar and not perform an alter on the table. The databases which I must support are SQL Server 2000, 2005 and 2008.

                  推荐答案

                  以下查询应该可以满足您的需求:

                  The following query should get you what you need:

                  IF EXISTS 
                    (SELECT *
                     FROM sysobjects syo
                     JOIN syscolumns syc ON
                       syc.id = syo.id
                     JOIN systypes syt ON
                       syt.xtype = syc.xtype
                     WHERE 
                       syt.name = 'nvarchar' AND
                       syo.name = 'MY TABLE NAME' AND
                       syc.name = 'MY COLUMN NAME')
                  BEGIN
                     ALTER ...
                  END
                  

                  这篇关于SQL Server - 将数据库列从 varchar 更新为 nvarchar(如果还不是 nvarchar)的脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:我可以在 SQL Server 的添加列语句中创建命名默认约束吗? 下一篇:在 Oracle 中的关键字后更改表

                  相关文章

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

                    1. <i id='sWy6Z'><tr id='sWy6Z'><dt id='sWy6Z'><q id='sWy6Z'><span id='sWy6Z'><b id='sWy6Z'><form id='sWy6Z'><ins id='sWy6Z'></ins><ul id='sWy6Z'></ul><sub id='sWy6Z'></sub></form><legend id='sWy6Z'></legend><bdo id='sWy6Z'><pre id='sWy6Z'><center id='sWy6Z'></center></pre></bdo></b><th id='sWy6Z'></th></span></q></dt></tr></i><div id='sWy6Z'><tfoot id='sWy6Z'></tfoot><dl id='sWy6Z'><fieldset id='sWy6Z'></fieldset></dl></div>

                      • <bdo id='sWy6Z'></bdo><ul id='sWy6Z'></ul>

                      <legend id='sWy6Z'><style id='sWy6Z'><dir id='sWy6Z'><q id='sWy6Z'></q></dir></style></legend>
                    2. <tfoot id='sWy6Z'></tfoot>