Pages

Saturday, January 31, 2009

This is a very beginner level advice for writing insert query. Instead of using in this way
insert into table1 values ('data1', 'data2')

always mention the field name for which you are inserting values

insert into table1 (field1, field2) values ('data1', 'data2')

This way it is ensured that whatever changes you may do on your table, if the columns exists you insert with the old queries.

Within last few days I was stuck with my this mistake and it took a whole night to change all the queries of my application according to the new schema though just a new column has been added..

No comments:

Post a Comment