I have to add several columns to the table and then update them in SQL Server 2008. The table definition boils down to this:
CREATE TABLE tbl (id INT PRIMARY KEY,
dvt NVARCHAR(32),
dd NVARCHAR(32));
INSERT INTO tbl (id, dvt, dd)
VALUES(1, '1', NULL);
INSERT INTO tbl (id, dvt, dd)
VALUES(2, '', NULL);
INSERT INTO tbl (id, dvt, dd)
VALUES(3, '2,5', NULL);
INSERT INTO tbl (id, dvt, dd)
VALUES(4, '13, 34, 45, 5', NULL);
INSERT INTO tbl (id, dvt, dd)
VALUES(5, '-1, 8, 10', NULL);
INSERT INTO tbl (id, dvt, dd)
VALUES(6, '-2, -10', NULL);
How do I add data to the table in the same transaction that created the table?
I get an error: "Invalid column name 'd0") makes no sense. It would be better if you rolled back your question to the previous version and posted your solution as an answer.Invalid column name 'd0still relevant? You posted it before modifying the code, and you didn't remove it after the last update.