Reputation: 35
ALTER TABLE VASTHRA_TALLY_BRIDGE.DBO.[VF_TALLY_MIGRATION_VOUCHER_DETAILS_GST_19_20]
WITH NOCHECK ADD CONSTRAINT
VASTHRA_TALLY_BRIDGE.DBO.[VF_TALLY_MIGRATION_VOUCHER_DETAILS_GST_19_20]
PRIMARY KEY CLUSTERED
(
voucher_Number,
voucher_date,
Debit Account Head,
Credit Account Head,
ITEM_NAME,
RATE
) ON [PRIMARY] END
Msg 102, Level 15, State 1, Line 1 Incorrect syntax near '.'.
Upvotes: 0
Views: 63
Reputation: 9299
Constraint name does not need nor DB neither schema specification here.
Columns with spaces must be enquoted.
ALTER TABLE VASTHRA_TALLY_BRIDGE.DBO.[VF_TALLY_MIGRATION_VOUCHER_DETAILS_GST_19_20] WITH NOCHECK ADD CONSTRAINT
[VF_TALLY_MIGRATION_VOUCHER_DETAILS_GST_19_20] PRIMARY KEY CLUSTERED
( voucher_Number,voucher_date,
[Debit Account Head],[Credit Account Head],ITEM_NAME,RATE)
ON [PRIMARY]
END
keyword is illegal here since no BEGIN
specified.
Upvotes: 6
Reputation: 15140
You are naming your constraint VASTHRA_TALLY_BRIDGE.DBO.[VF_TALLY_MIGRATION_VOUCHER_DETAILS_GST_19_20]
. An object, so a constraint as well, is not allowed to have dots in its name. So, you should give it a different name, for example PK_VF_TALLY_MIGRATION_VOUCHER_DETAILS_GST_19_20
.
Upvotes: 2