Hello,
I created a table in an MS SQL database with below script:
CREATE TABLE [dbo].[VersionHistory](
[SID] [int] IDENTITY(1,1) NOT FOR REPLICATION NOT NULL,
[VersionNumberString] [nvarchar](max) NOT NULL,
[UpdatedOn] [datetime] NOT NULL,
CONSTRAINT [PK_VersionHistory] PRIMARY KEY CLUSTERED
(
[SID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
Then I executed the command:
liquibase diff-changelog --diff-types=tables,functions,views,columns,indexes,foreignkeys,primarykeys,uniqueconstraints,data,storedprocedures,sequences
and created a changeLog File with the above table:
-- liquibase formatted sql
-- changeset giorgos:1661869491404-1
CREATE TABLE VersionHistory (SID INT GENERATED BY DEFAULT AS IDENTITY NOT NULL, VersionNumberString NVARCHAR(MAX) NOT NULL, UpdatedOn TIMESTAMP NOT NULL, CONSTRAINT PK_VersionHistory PRIMARY KEY (SID));
But when I tried to execute the liquibase update command I got the following error:
Unexpected error running Liquibase: Incorrect syntax near the keyword 'BY'. [Failed SQL: (156) CREATE TABLE VersionHistory (SID INT GENERATED BY DEFAULT AS IDENTITY NOT NULL, VersionNumberString NVARCHAR(MAX) NOT NULL, UpdatedOn TIMESTAMP NOT NULL, CONSTRAINT PK_VersionHistory PRIMARY KEY (SID))]
Even if I execute the above script to sql enterprise management studio I’m getting the same error “Incorrect syntax near the keyword ‘BY’”.
Could anyone help me with this issue please?
Thanks in advance,
George