We have just a regular identity column present. The requirement is to add another column which needs to have the value of 'A' + DATE of when it was inserted + IDSomething like this:[code="sql"]CREATE TABLE #Temp(ID INT IDENTITY(1,1), Name VARCHAR(50), CalculatedColumn VARCHAR(30))ALTER TABLE #TempADD CONSTRAINT DF_CC DEFAULT 'A' + CONVERT(VARCHAR(10), GETDATE(), 112) + CONVERT(VARCHAR(10), ID, 0)FOR CalculatedColumn[/code]Can't use another column in a default apparently. It will also not let me to do this with a persisted computed column since I'm using Varchar. Is there any other way to do this besides making the processes that insert into this table do the logic?
↧