Jetbrains Datagrip 2017.1.3,将数据转储到sql inserts文件时强制导出列
我有一个SQL server数据库,其中包含许多表和数据。我需要在docker容器中本地复制它。 我已经成功地导出了模式并复制了它。当我将数据转储到SQL文件时,它不会导出自动生成的字段(例如ID或UUID) 以下是用户表的架构:Jetbrains Datagrip 2017.1.3,将数据转储到sql inserts文件时强制导出列,sql,sql-server,database,datagrip,Sql,Sql Server,Database,Datagrip,我有一个SQL server数据库,其中包含许多表和数据。我需要在docker容器中本地复制它。 我已经成功地导出了模式并复制了它。当我将数据转储到SQL文件时,它不会导出自动生成的字段(例如ID或UUID) 以下是用户表的架构: create table user ( id_user bigint identity constraint PK_user primary key, uuid uniqueidentifier default newsequentialid() n
create table user (
id_user bigint identity constraint PK_user primary key,
uuid uniqueidentifier default newsequentialid() not null,
id_salarie bigint constraint FK_user_salarie references salarie,
date_creation datetime,
login nvarchar(100)
)
当它从这个表中导出和元素时,我得到这种插入:
INSERT INTO user(id_salarie, date_creation, login) VALUES (1, null, "example")
INSERT INTO user(id_user, uuid, id_salarie, date_creation, login) VALUES (1, 1, "manuallyentereduuid" null, "example")
因此,我的大多数插入都会给我外键错误,因为我的新数据库生成的ID与旧数据库中的ID不同。我无法手动更改所有内容,因为数据太多了
相反,我希望有这样的插入:
INSERT INTO user(id_salarie, date_creation, login) VALUES (1, null, "example")
INSERT INTO user(id_user, uuid, id_salarie, date_creation, login) VALUES (1, 1, "manuallyentereduuid" null, "example")
有没有直接使用Datagrid的方法?或者是一种特定的SQL server方式,以这种方式生成insert语句
请不要犹豫,在评论中询问更多细节。似乎Datagrip没有给您提供这种可能性,因此我使用了另一种方法:DBeaver。它是免费的,并且基于Eclipse环境 方法很简单:
- 选择要导出的所有表
- 右键单击->导出表数据
编辑:请参见上面的答案在配置插入提取器时,您需要“跳过生成的列”选项
什么数据库管理系统?MySQL?它是一个Microsoft SQL server 2008数据库。就是这样!非常感谢你的截图,这个选项并不明显。