Import Text file into SQL....?

  • Hi Team,

    HAPPY NEW YEAR.

    --

    I have a table with below structure.

    Create table temp_ttt

    (

    col1 varchar(100),

    col2 Decimal(9,2),

    col3 Decimal(9,2)

    )

    i want to insert data from text file to above table.

    text file contains.

    2004/04/28,10

    UBC001458,90.94,2367.38

    DWL006291,0,5369.12

    0042672095,0,3050

    0045502095,0,2300

    2105863602,0,1082.39

    2105863603,0,292.62

    0012552106,0,4140

    LUT000028,5.36,1.04

    THY005087,1018.51,3082.57

    GPB010655,12428.1,15471.8

    am using below query,

    BULK INSERT temp_ttt

    FROM 'C:\Documents\book11.txt'

    WITH

    (

    FIELDTERMINATOR = '|',

    ROWTERMINATOR = ','

    )

    Error msg :

    Msg 4861, Level 16, State 1, Line 1

    Cannot bulk load because the file "C:\Documents\book11.txt" could not be opened.

    Operating system error code 3(The system cannot find the path specified.).

    Please help....

  • Does the file exist in that location on the server?

  • Yes.

    file exists in the same path / location.

  • On the server or on your local machine?

  • Ooops,

    I have that file in my local machine......

    how to read the same file from local machine.

  • Use the import export data wizard

  • Ensure that SQL server service A/c has permission to access that file, logins should have access to that folder.

    Thanks!

Viewing 7 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic. Login to reply