July 16, 2004 at 5:26 pm
I am having trouble with the following query:
insert into _SMDBA_._CONFIG_
(CFG_CCDT01, SL_HARDWARE_AGREEMENT_ID)
select date, HWID
from dbo.test
where _SMDBA_._CONFIG_.CONFIG = dbo.test.config
I keep getting an error that the _SMDBA_._CONFIG_ table in the where clause is not a recognized table. I tried an inner join where the two fields are equal then I get a "cannot insert a null value into the CONFIG field" message. I am not trying to insert into the CONFIG field. What am I doing wrong?
thanks,
michele:
July 16, 2004 at 6:34 pm
The null message may be because the CONFIG field is a primary key to the _SMDBA_._CONFIG_ table and thus cannot be null. When you insert into the _SMDBA_._CONFIG_ the value of the primary key must be inlcuded unless it is an autoID field of some sort
Should the statement be an update?
UPDATE _SMDBA_._CONFIG_
SET CFG_CCDT01=date,
SL_HARDWARE_AGREEMENT_ID=HWID
FROM _SMDBA_._CONFIG_,dbo.test
WHERE _SMDBA_._CONFIG_.CONFIG = dbo.test.config
This would update already existing rows int the _SMDBA_._CONFIG_ table.
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply