Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
sagey
Starting Member
4 Posts |
Posted - 2002-10-03 : 11:55:00
|
| i'm trying to insert info into an existing table that already has info in it. i just want to add this info into it.when i run this query...insert into tblinvoicingselect null, --this is the problem i think lcompanyid, brandedrenewals.ssubscribername, getdate(), 'Branded Renewals ' + brandedrenewals.renewalmonth,brandedrenewals.smanucode, brandedrenewals.orderno, brandedrenewals.orderno,null, brandedrenewals.servicetype, sshortdesc, seancode, null, 'brandedrenewal', null, brandedrenewals.jobcost, null, null, null,null,nullfrom brandedrenewalsinner join BrandedRenewalSummary on brandedrenewals.smanucode = BrandedRenewalSummary.smanucodewhere brandedrenewals.status <> 0i get this errorServer: Msg 8101, Level 16, State 1, Line 1An explicit value for the identity column in table 'tblinvoicing' can only be specified when a column list is used and IDENTITY_INSERT is ON.i'm asuming that the problem is the first null value because this equates to the unique identifier auto number in the destination tablei've fiddled around with the identity property but i'm not really sure if this is the thing to be doing as i'm a beginner.any help would be most gratefully receivedcheers |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2002-10-03 : 12:14:59
|
| Name the columnsinsert tbl (col1, col2, col3)select ...And miss out the identity column and it will be set automatically.The insert will also work if you change the order of columns in the table now.==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
|
|
|
|
|