My code is
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[RLS_LOGS]
WITH (
DISTRIBUTION = ROUND_ROBIN,
CLUSTERED COLUMNSTORE INDEX
)
AS
(
[USER_IDENTITY] [nvarchar](4000) NOT NULL,
[DESCRIPTION] [nvarchar](4000) NOT NULL,
[CREATED_ON] [datetime2](7) NOT NULL DEFAULT (GETDATE())
)
Showing the error while running SQL script on azure synapse (Dedicated server pool)
You have some of the clauses a bit out of order. This should work:
CREATE TABLE [dbo].[RLS_LOGS]
(
[USER_IDENTITY] [nvarchar](4000) NOT NULL,
[DESCRIPTION] [nvarchar](4000) NOT NULL,
[CREATED_ON] [datetime2](7) NOT NULL
)
WITH (
DISTRIBUTION = ROUND_ROBIN,
CLUSTERED COLUMNSTORE INDEX
)
I had to remove the getdate() default because as documented here :
In Azure Synapse Analytics, only constants can be used for a default constraint. An expression cannot be used with a default constraint.
You will just have to ensure each INSERT statement inserts getdate() to that column.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.