I am trying to write a bulk import routine so that i will be able to import text files or csv files to SQL i have tried this and it's giving me the following error message. P: is the drive where the file is in currently.

USE [XYZABQ]
GO
CREATE TABLE CSVTest
(ID INT,
[Name] VARCHAR(40),
Surname VARCHAR(40),
BirthDate DATETIME (10))
GO
BULK
INSERT CSVTest
FROM 'P:\csvtest.txt'
WITH
(
FIELDTERMINATOR = ',',
ROWTERMINATOR = '\n'
)
GO

Error Message
Msg 4861, Level 16, State 1, Line 2
Cannot bulk load because the file "P:\csvtest.txt" could not be opened. Operating system error code 3(error not found).

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.