I've have this strange problem when adding a column to an existing table.
The existing table looks like :
CREATE TABLE [BinaryAssets].[BinaryAssets](
[BinaryAssetId] [int] IDENTITY(1,1) NOT NULL,
[BinaryAssetStructureId] [int] NOT NULL,
[Name] [nvarchar](max) NOT NULL,
[Created_By] [int] NOT NULL,
[Created_On] [bigint] NOT NULL,
[Modified_By] [int] NOT NULL,
[Modified_On] [bigint] NOT NULL,
[Active] [bit] NOT NULL,
CONSTRAINT [PK_BinaryAsset] PRIMARY KEY NONCLUSTERED
(
[BinaryAssetId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF,
ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
Now, the sql I'm trying to execute looks like :
ALTER TABLE BinaryAssets.BinaryAssets ADD
[Version] INT NOT NULL CONSTRAINT DF_BinaryAssets_Version DEFAULT 1
ALTER TABLE BinaryAssets.BinaryAssets
DROP CONSTRAINT DF_BinaryAssets_Version
When I'm trying to execute I get a sqlexception (see Title).
Now, I don't think my table exceeds 8060, so what's the problem here. Strange thing is that when I change for instance the Name from nvarchar(max) to nvarchar(100), then execute my new sql and then change back the 100 to MAX, it does work... logic seems far away here.
Can anybody tell me what I'm doing wrong here?