• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

INSERT INTO - more reliable?

SoftwareEng

Senior member
Hey guys,

In SQL Server there are 2 ways to do an INSERT: by listing column names, or by ommiting them:

INSERT INTO Table1 (Column1, Column2, Column3?)
VALUES (Value1, Value2, Value3?)

vs

INSERT INTO Table1
VALUES (value1, value2, value3?)

Which one is better? I am more concerned with readability, reliability, and ease of maintenance than performance.

Thank you!
 
Including the column name is more portable since if you change the table layout your code doesnt break.

 
Agreed with bsobel. It's also more comprehensible and maintainable.
 
I agree as well.

1) It reduces the chance of a mistake
2) It increases readability
3) It is much easier to make changes to
4) Changing the table doesn't break the insert.
 
Back
Top