gpt4 book ai didi

sql-server - 将本地数据库迁移到 sql azure 数据库时,它会忽略所有表创建脚本中的 DEFAULT (newid())

转载 作者:行者123 更新时间:2023-12-03 04:29:10 24 4
gpt4 key购买 nike

我已使用 SQLAzureMW v5.16 for sql server 2014 将本地数据库迁移到 sql azure 数据库。在迁移之前,它为我提供了可以在我的 SQL Azure 数据库中执行的脚本。它在表创建脚本中包含 newid() ,如下所示:

CREATE TABLE [dbo].[AUDITLOG](
[CUSTOMERID] [decimal](38, 0) NULL,
[RRNVALUE] [varchar](12) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[TRANSACTIONCODE] [varchar](10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[ACTIONID] [varchar](15) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[MODULEID] [varchar](20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[CNIC] [varchar](15) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[ACTIVITYDATE] [varchar](8) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[ACTIVITYTIME] [varchar](6) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[ACTIVITYDETAILS] [varchar](4000) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[RESPONSECODE] [varchar](10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[SESSIONID] [varchar](30) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[BASECUSTOMERID] [decimal](38, 0) NULL,
[SOURCE] [varchar](10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[LOGID] [decimal](38, 0) NULL,
[AGENT] [varchar](4000) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[RESERVEDFIELD1] [varchar](4000) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[RESERVEDFIELD2] [varchar](4000) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[RESERVEDFIELD3] [varchar](4000) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[RESERVEDFIELD4] [varchar](4000) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[USERIP] [varchar](15) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[LOGGINGNATURE] [varchar](100) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[LOGINID] [varchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[ROWID] [uniqueidentifier] NOT NULL DEFAULT (newid())

)

GO
CREATE UNIQUE CLUSTERED INDEX [ROWID$INDEX] ON [dbo].[AUDITLOG]
(
[ROWID] ASC
)WITH (STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF)
GO

成功迁移后,可以看到约束 DEFAULT (newid()) 在所有表创建脚本中均被删除。并产生以下内容:

CREATE TABLE [dbo].[AUDITLOG](
[CUSTOMERID] [decimal](38, 0) NULL,
[RRNVALUE] [varchar](12) NULL,
[TRANSACTIONCODE] [varchar](10) NULL,
[ACTIONID] [varchar](15) NULL,
[MODULEID] [varchar](20) NULL,
[CNIC] [varchar](15) NULL,
[ACTIVITYDATE] [varchar](8) NULL,
[ACTIVITYTIME] [varchar](6) NULL,
[ACTIVITYDETAILS] [varchar](4000) NULL,
[RESPONSECODE] [varchar](10) NULL,
[SESSIONID] [varchar](30) NULL,
[BASECUSTOMERID] [decimal](38, 0) NULL,
[SOURCE] [varchar](10) NULL,
[LOGID] [decimal](38, 0) NULL,
[AGENT] [varchar](4000) NULL,
[RESERVEDFIELD1] [varchar](4000) NULL,
[RESERVEDFIELD2] [varchar](4000) NULL,
[RESERVEDFIELD3] [varchar](4000) NULL,
[RESERVEDFIELD4] [varchar](4000) NULL,
[USERIP] [varchar](15) NULL,
[LOGGINGNATURE] [varchar](100) NULL,
[LOGINID] [varchar](50) NULL,
[ROWID] [uniqueidentifier] NOT NULL

)

开始

将表从本地迁移到 Azure 云时删除 newid() 是否有原因? ..

最佳答案

我认为默认的 newid() 在 sql azure 中不可用,但它在 azure sql 数据仓库中可用

请检查msdn链接

https://msdn.microsoft.com/en-us/library/ms190348.aspx

关于sql-server - 将本地数据库迁移到 sql azure 数据库时,它会忽略所有表创建脚本中的 DEFAULT (newid()),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39244406/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com