The alter table does not add, what reason be?
CodePudding user response:
Tested, no problem,If you really have a problem, please post the complete, can reproduce your error of SQL,
USE tempdb for
GO
IF OBJECT_ID (' t ') IS NOT NULL
DROP TABLE t
GO
CREATE TABLE (t
Id INT,
N NVARCHAR (10)
)
GO
The SELECT COLUMN_NAME, ORDINAL_POSITION FROM information_schema. The columns WHERE TABLE_NAME='t'
/*
COLUMN_NAME ORDINAL_POSITION
Id 1
N (2
*/
GO
The ALTER TABLE t ADD n2 INT
GO
The SELECT COLUMN_NAME, ORDINAL_POSITION FROM information_schema. The columns WHERE TABLE_NAME='t'
/*
COLUMN_NAME ORDINAL_POSITION
Id 1
N (2
N2 3
*/