加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > MsSql教程 > 正文

如何将生产环境的字段类型从INT修改为BIGINT

发布时间:2020-12-12 09:07:00 所属栏目:MsSql教程 来源:网络整理
导读:Online alter column does not reduce the restrictions on when a column can be altered. References by index/stats,etc. might cause the alter to fail . 意思就是也不是很好。 ( BusinessEntityID BIGINT NOT NULL,PersonType NCHAR( span style="colo

Online alter column does not reduce the restrictions on when a column can be altered. References by index/stats,etc. might cause the alter to fail. 意思就是也不是很好。

(

BusinessEntityID BIGINT NOT NULL,PersonType NCHAR(<span style="color: #800080">2<span style="color: #000000">) NOT NULL,NameStyle dbo.NameStyle NOT NULL,Title NVARCHAR(<span style="color: #800080">8<span style="color: #000000">) NULL,FirstName dbo.Name NOT NULL,MiddleName dbo.Name NULL,LastName dbo.Name NOT NULL,Suffix NVARCHAR(<span style="color: #800080">10<span style="color: #000000">) NULL,EmailPromotion INT NOT NULL,AdditionalContactInfo XML(CONTENT Person.AdditionalContactInfoSchemaCollection) NULL,Demographics XML(CONTENT Person.IndividualSurveySchemaCollection) NULL,rowguid UNIQUEIDENTIFIER ROWGUIDCOL NOT NULL,ModifiedDate DATETIME NOT NULL,CONSTRAINT PK_Person_BusinessEntityIDNEW

PRIMARY KEY CLUSTERED (BusinessEntityID ASC)

WITH (PAD_INDEX = OFF,STATISTICS_NORECOMPUTE = OFF,IGNORE_DUP_KEY =<span style="color: #000000"> OFF,ALLOW_ROW_LOCKS = ON,ALLOW_PAGE_LOCKS =<span style="color: #000000"> ON

) ON [PRIMARY]

) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY];

GO

6000创建下一个SSIS包。增量插入。我每天都这样做,以保持数据传输时间的减少。下面提供了用于Person表的SSIS包中使用的查询。

SELECT [BusinessEntityID],[PersonType],[NameStyle],[Title],[FirstName],[MiddleName],[LastName],[Suffix],[EmailPromotion],[AdditionalContactInfo],[Demographics],[rowguid],[ModifiedDate]

FROM [AdventureWorks2014].[Person].[Person]

WHERE BusinessEntityID > <span style="color: #800080">6000

trReadOnly_Person .INSTEAD <span style="color: #0000ff">OF <span style="color: #0000ff">INSERT<span style="color: #000000">,<span style="color: #0000ff">UPDATE<span style="color: #000000">,<span style="color: #0000ff">DELETE

<span style="color: #0000ff">AS

<span style="color: #0000ff">BEGIN

<span style="color: #0000ff">RAISERROR( <span style="color: #ff0000">'<span style="color: #ff0000">Person table is read only.<span style="color: #ff0000">',<span style="color: #800000; font-weight: bold">16,<span style="color: #800000; font-weight: bold">1<span style="color: #000000"> )

<span style="color: #0000ff">ROLLBACK <span style="color: #0000ff">TRANSACTION

<span style="color: #0000ff">END

<span style="color: #0000ff">GO

<span style="color: #008080">--<span style="color: #008080">DROP TRIGGER trReadOnly_Person

  1. IDENTITY INSERT ,传输数据。

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读