vBulletin Search Engine Optimization
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| I'm a bit new to all types of sql and can't seem to find the answer to this question. I want to insert a row where several columns have the same initial value. Is there a way to do this without repeating the value multiple times on the insert command? E.g., instead of INSERT INTO Table1 (Column1, Column2, Column3.) VALUES (Value, Value, Value .) something like this: insert into table1 (column1, column2, column3...) values (3xValue...) Thanks Jeff -- Posted via a free Usenet account from http://www.teranews.com |
| |||
| Jeff wrote: > I want to insert a row where several columns have the same initial > value. Is there a way to do this without repeating the value multiple > times on the insert command? E.g., instead of > > INSERT INTO Table1 (Column1, Column2, Column3.) > VALUES (Value, Value, Value .) > > something like this: > insert into table1 (column1, column2, column3...) > values (3xValue...) No, there is no syntax in SQL for what you describe. The only other solution I can think of right now is to declare that value as the DEFAULT for the columns in question, and then do not give a value for them in the insert statement. Regards, Bill K. |
| ||||
| Bill Karwin wrote: > Jeff wrote: >> I want to insert a row where several columns have the same initial >> value. Is there a way to do this without repeating the value multiple >> times on the insert command? E.g., instead of >> >> INSERT INTO Table1 (Column1, Column2, Column3.) >> VALUES (Value, Value, Value .) >> >> something like this: >> insert into table1 (column1, column2, column3...) >> values (3xValue...) > > No, there is no syntax in SQL for what you describe. > > The only other solution I can think of right now is to declare that > value as the DEFAULT for the columns in question, and then do not give a > value for them in the insert statement. > > Regards, > Bill K. Defaults get my vote. Anything else would make me wonder about the design of the database. |