Skip to content
This repository has been archived by the owner on Sep 30, 2024. It is now read-only.

Pull command doesnt consider identity values #46

Closed
1 of 2 tasks
Jaxelr opened this issue Sep 29, 2018 · 0 comments
Closed
1 of 2 tasks

Pull command doesnt consider identity values #46

Jaxelr opened this issue Sep 29, 2018 · 0 comments
Labels

Comments

@Jaxelr
Copy link
Contributor

Jaxelr commented Sep 29, 2018

Type

What kind of issue is this?

  • Bug report.
  • Feature request.

Current Behavior

Given the following query:

CREATE TABLE [dbo].[User](
	[UserId] [int] IDENTITY(1,1) NOT NULL,
	[UserName] [varchar](24) NOT NULL,
PRIMARY KEY CLUSTERED  ( [UserId] ASC )) ON [PRIMARY]
GO

insert into [dbo].[User] (UserName) values ('Jaxel')

When i run an ssc pull combined with the data configuration for the sample table above, the command does not add the SET IDENTITY_INSERT ON option for tables that includes identity. Current result

truncate table dbo.User
insert into dbo.User (UserId, UserName) values (1, 'Jaxel')

Expected behavior

I expect the data query to include the SET IDENTITY_INSERT dbo.User ON; clause to be included prior to the insert, and turned off (SET IDENTITY_INSERT dbo.User OFF; ) post insertion.

Like so:

SET IDENTITY_INSERT [dbo].[User] ON;

insert into [dbo].[User] (UserId, UserName) values (1, 'Jaxel')

SET IDENTITY_INSERT [dbo].[User] OFF;

Steps to Reproduce

Execute the following command on SQL Server:

CREATE TABLE [dbo].[User](
	[UserId] [int] IDENTITY(1,1) NOT NULL,
	[UserName] [varchar](24) NOT NULL,
PRIMARY KEY CLUSTERED  ( [UserId] ASC )) ON [PRIMARY]
GO

insert into [dbo].[User] (UserName) values ('Jaxel')

Add the data clause to the ssc.json file:

{
  "connections": [
    {
      "name": "local",
      "server": "localhost",
      "database": "master",
      "port": 1433,
      "user": "sa",
      "password": ""
    }
  ],
  "data" : ["dbo.User"]
}

Other Information

DB: SQL Server 2017
Platform: Win 10

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants