Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Insert into table with identity column

Status
Not open for further replies.

wallaceoc80

Programmer
Jul 7, 2004
182
GB
If you have a table with (say) 3 columns, the first of which is an identity colum with an auto increment of 1, and you want to insert a new row into the table.

Do you have to list out all the columns like this:

Code:
insert into tablename (column2, column3)
values ('a', 'b');

or can you leave out the part where I specify the column names?

Thanks for the help,

Wallace
 
If you have a lot of columns the fastest and most accurate way to get them into the query is to drag them from the object browser in query analyzer. If you open a tablename so that you see the colunm list and then drag the word colum,ns over it will pull over all the columns. THen just delete the identity column sform the list (and add carraige returns as they will all be on one line) and you are done. Note that this will not work unless you see the list of the column names.

Questions about posting. See faq183-874
Click here to learn Ways to help with Tsunami Relief
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top