Azure Synapse Dedicated pool Error while adding Default GetDate() value to the column

venkat rao 65 Reputation points
2024-01-05T11:39:11.8233333+00:00

Hi Team

I am using Azure Synapses Dedicated pool ,I am getting error while creating table with default constraint column value GetDate()

Create table ArchiveDB.Customer
(
  CUSTOMERID BIGINT, 
  ACCOUNT_NUMBER INT, 
  CEXPIRY_DATE DATETIME, 
  CSTART_DATE DATETIME,
  CARCHIVE_DATE DATETIME DEFAULT (GetDate()) not null
);

Msg 104338, Level 16, State 1, Line 23

An expression cannot be used with a default constraint. Specify only constants for a default constraint.

Completion time: 2024-01-05T11:37:04.8314443+00:00

Azure Synapse Analytics
Azure Synapse Analytics
An Azure analytics service that brings together data integration, enterprise data warehousing, and big data analytics. Previously known as Azure SQL Data Warehouse.
5,378 questions
SQL Server | Other
{count} votes

Accepted answer
  1. Nandan Hegde 36,151 Reputation points MVP Volunteer Moderator
    2024-01-05T11:44:39.2733333+00:00

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.