jschaddock
Programmer
Hello everyone,
I have a problem trying to alter a column in a SQL table.
The table is called fees and has a column called ID in it that is numeric datatype. What I am trying to do is to alter this column to be an identity column with increments of one. I know that by running the code
ALTER TABLE Fees DROP COLUMN ID
ALTER TABLE Fees ADD ID numeric(18,0) Identity(1,1) NOT NULL
the column will be dropped and then recreated as an identity column but I am told by my boss that we're not allowed to drop the original column.
So instead,I've been trying to run the code
ALTER TABLE Fees ALTER COLUMN ID numeric(18,0) Identity(1,1) NOT NULL
but I keep getting syntax errors.
Could someone please tell me how I can alter this column to be an identity column without having to drop and recreate it?
Thanks
I have a problem trying to alter a column in a SQL table.
The table is called fees and has a column called ID in it that is numeric datatype. What I am trying to do is to alter this column to be an identity column with increments of one. I know that by running the code
ALTER TABLE Fees DROP COLUMN ID
ALTER TABLE Fees ADD ID numeric(18,0) Identity(1,1) NOT NULL
the column will be dropped and then recreated as an identity column but I am told by my boss that we're not allowed to drop the original column.
So instead,I've been trying to run the code
ALTER TABLE Fees ALTER COLUMN ID numeric(18,0) Identity(1,1) NOT NULL
but I keep getting syntax errors.
Could someone please tell me how I can alter this column to be an identity column without having to drop and recreate it?
Thanks