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 |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2002-10-07 : 07:44:12
|
| richard writes "i've bee trying to insert this data into an existing table that already has info in it. i just want to add these rows into the table this is the queryinsert into tblinvoicingselect null, --this null 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 <> 0but i get this error messageServer: 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 assuming that the first null is the problem as this equates to the identifier in the table i want to insert into.this unique identifier is a autonumber if that helpsi've tried fiddling with the identity function but i dont really know what i'm doing as i'm only a beginnerany help would be gratefully received" |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2002-10-07 : 07:48:52
|
| name the columns and leave out the identity columnsinsert tbl(col1, col2, ...)select ...==========================================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. |
 |
|
|
|
|
|
|
|