kg6lfz
asked on
how to resize column length with primary ket
I have a column (inv_no) with a primary key. I want to make its size little bigger. The following script didn't work. I get an error.
Msg 3728, Level 16, State1, Line 1
'inv_no' is not a constraint.
What I was not sure was constraint_name. I used column name. Is this the problem? Any suggestions? My SQL is 2014. Thank you in advance.
ALTER TABLE f_invoice
DROP CONSTRAINT inv_no
ALTER TABLE f_invoice
ALTER COLUMN inv_no NVARCHAR (16)
ALTER TABLE
ADD CONSTRAINT inv_no PRIMARY KEY (inv_no)
Msg 3728, Level 16, State1, Line 1
'inv_no' is not a constraint.
What I was not sure was constraint_name. I used column name. Is this the problem? Any suggestions? My SQL is 2014. Thank you in advance.
ALTER TABLE f_invoice
DROP CONSTRAINT inv_no
ALTER TABLE f_invoice
ALTER COLUMN inv_no NVARCHAR (16)
ALTER TABLE
ADD CONSTRAINT inv_no PRIMARY KEY (inv_no)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I used
SELECT * FROM INFORMATION_SCHEMA.TABLE_C ONSTRAINTS
to find my constraint name. That was a part of my problem.
SELECT * FROM INFORMATION_SCHEMA.TABLE_C
to find my constraint name. That was a part of my problem.
right click design and change and save it