0

I have atlered table by adding Datetime column. This column is not null and also default value from GETDATE().

ALTER TABLE myTable ADD myDateColun DATETIME NOT NULL DEFAULT (GETDATE())

I'm trying to update, I'm unable to update or insert values table

update  myTable set myDateColun = GETDATE() where id = someNumber

Its throwing me SQL error

Column name or number of supplied values does not match table definition.

Note: This table has trigger defined on insert and delete scenario for data, which updates synonym table linked to this table in other database.

Any ideas what can be reason for SQL errors in above scenario?

1 Answer 1

3

My guess is that your trigger has a "insert into ... select * from myTable" kind of structure, and now it's broken because there's one more column in the table. Change your trigger so that it lists the columns instead of using *.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.