I have the following code to import .csv file into my table in excel
It's being inserted into a table. dbo.ImportedPromoPricing.
Table and the .csv file have 3 fields price, code and selling price.
Once import is completed I want to use the data in my dbo.ImportedPromoPricing to update another table dbo.MasterPricing. Records need to be compared and updated or appended if needed. in case of update only price will be updated. this is the beginning of my code
USE [Reporting]
GO
/****** Object: StoredProcedure [dbo].[ImportPromoPricing] Script Date: 03/03/2014 14:04:01 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER procedure [dbo].[ImportPromoPricing] as
begin
truncate table dbo.ImportedPromoPricing
Bulk Insert dbo.ImportedPromoPricing
from 'D:\Reporting\DB\Sales\PromoPriceImport\PromoPrice Import.csv'
with
(FIELDTERMINATOR =',',
ROWTERMINATOR = '\n',
FIRSTROW = 2
)
It's being inserted into a table. dbo.ImportedPromoPricing.
Table and the .csv file have 3 fields price, code and selling price.
Once import is completed I want to use the data in my dbo.ImportedPromoPricing to update another table dbo.MasterPricing. Records need to be compared and updated or appended if needed. in case of update only price will be updated. this is the beginning of my code
USE [Reporting]
GO
/****** Object: StoredProcedure [dbo].[ImportPromoPricing] Script Date: 03/03/2014 14:04:01 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER procedure [dbo].[ImportPromoPricing] as
begin
truncate table dbo.ImportedPromoPricing
Bulk Insert dbo.ImportedPromoPricing
from 'D:\Reporting\DB\Sales\PromoPriceImport\PromoPrice Import.csv'
with
(FIELDTERMINATOR =',',
ROWTERMINATOR = '\n',
FIRSTROW = 2
)