I am a new sql 2000 user/administrator. I am just learning the programming syntax. I am trying to do and insert function to take rows from one table and add them to another table where certain conditions are met. Each of the two tables have an autonumber key field named zipdef_no. I have tried to set up an innerjoin that references this common condition. Below is the code I have written:
use montrain
insert into dbo.zip_default_agency
(zipdef_no, agency_no, agencytype_id, change_user, change_date)
select zipdef_no, agency_no, agencytype_id = 'P', change_user = 1, change_date = getdate
from dbo.zip_default INNER JOIN
dbo.zip_default.zipdef_no = dbo.zip_default_agency.zipdef_no
where (left(city_name,5) = 'Tulsa')
When I execute the code, I get the following error:
Server: Msg 170, Level 15, State 1, Line 9
Line 9: Incorrect syntax near '='.
I don't understand what the problem may be. Any help is greatly appreciated.
Thanks,
Ron--
use montrain
insert into dbo.zip_default_agency
(zipdef_no, agency_no, agencytype_id, change_user, change_date)
select zipdef_no, agency_no, agencytype_id = 'P', change_user = 1, change_date = getdate
from dbo.zip_default INNER JOIN
dbo.zip_default.zipdef_no = dbo.zip_default_agency.zipdef_no
where (left(city_name,5) = 'Tulsa')
When I execute the code, I get the following error:
Server: Msg 170, Level 15, State 1, Line 9
Line 9: Incorrect syntax near '='.
I don't understand what the problem may be. Any help is greatly appreciated.
Thanks,
Ron--