修改表后SQL Server数据导入

发布于 2024-12-22 15:11:50 字数 175 浏览 4 评论 0原文

我有一个数据库备份,已将其导入到 SQL Server 中,并通过添加一些列进行了一些更改。没有删除任何现有的列,而是添加了一些额外的列。

现在我希望再次导入相同的数据库,以便我拥有在我添加列时在旧数据库中输入的所有最新数据。

实现这一目标的正确、有效和高效的方法是什么?

感谢您的建议。

I have a database backup which I imported into SQL Server and made few changes by adding some columns. Did not remove any of the existing columns but added some extra.

Now I wish to import the same database once again so I have all the latest data which was being entered in old one while I was working on adding columns.

What would be the proper, effective and efficient way to achieve this?

Thanks for suggestions.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

夏了南城 2024-12-29 15:11:50

在同一服务器上还原备份,然后运行以下命令:

INSERT INTO Production.dbo.table1 ( column1, column2, integercol, stringCol )
SELECT  column1, column2, 16, 'add text value'
FROM    Backup.dbo.table1

您可以相应地添加 where 子句和特定列。

选择上的列数必须与插入相匹配。

Restore the Backup on the same server, then run this:

INSERT INTO Production.dbo.table1 ( column1, column2, integercol, stringCol )
SELECT  column1, column2, 16, 'add text value'
FROM    Backup.dbo.table1

You can add a where clause and specific columns accordingly.

The column count on the select has to match the insert.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文