insert into....select problem
Hello all...
First off, I'm new to sql server.
I'm trying to make a stored procedure that queries records from one table and needs to insert them into another. But if there is a matching record already there, append that new information. Then write new records in the table. I receive an error message complaining about the & sign.
My code is below:
----------------------------
INSERT INTO [Customer_Export] ( PREVIOUS_ID, [BKN00-KTOKD], [BKNA1-NAME1], [BKN00-VKORG_P],
[BKN00-VTWEG_P], [BKN00-SPART_P], [BKNVP-PARVW], [BKNVP-KTONR], [BKNVP-DEFPA] ) &_
SELECT dbo.[T_Customer Master Data_Partner].PREVIOUS_ID,
dbo.[T_Customer Master Data_Partner].[BKN00-KTOKD],
dbo.[T_Customer Master Data_Partner].[BKNA1-NAME1],
dbo.[T_Customer Master Data_Partner].[BKN00-VKORG_P],
dbo.[T_Customer Master Data_Partner].[BKN00-VTWEG_P],
dbo.[T_Customer Master Data_Partner].[BKN00-SPART_P],
dbo.[T_Customer Master Data_Partner].[BKNVP-PARVW],
dbo.[T_Customer Master Data_Partner].[BKNVP-KTONR],
dbo.[T_Customer Master Data_Partner].[BKNVP-DEFPA] &_
FROM dbo.[T_Customer Master Data_Header] INNER JOIN dbo.[T_Customer Master Data_Partner]
ON (dbo.[T_Customer Master Data_Header].[BKN00-KTOKD] = dbo.[T_Customer Master Data_Partner].[BKN00-KTOKD])
AND (dbo.[T_Customer Master Data_Header].PREVIOUS_ID = dbo.[T_Customer Master Data_Partner].PREVIOUS_ID)
---------------------------------------------------------------
This is my error message:
Msg 102, Level 15, State 1, Procedure Export_Customer_Z001_Partner, Line 33
Incorrect syntax near '&'.
-------------------------------------------------------------
Thanks!
|