BULK INSERT ERROR

  • Dear Friends,

    i am new in this forum and i hope that i will get the solution to this error.

    actually, i want to import bulk data into the server table but literally failing below of the error mentioned below, i have tried both the ways using .txt and .csv files but still fails.

    Cannot bulk load because the file "‪C:\Users\Shaik\Desktop\Import.csv" could not be opened. Operating system error code 123(The filename, directory name, or volume label syntax is incorrect.).

    BULK INSERT PhoneBook
    FROM '‪C:\Users\Shaik\Desktop\Import.csv'
    WITH

    (
    FIELDTERMINATOR = ',',
    ROWTERMINATOR = '\n'
    )
    GO

    i dont know how to solve it, Please have a look a try to give me your responses.

    Thanks

  • shaikwaseem888 - Saturday, December 30, 2017 3:24 PM

    Dear Friends,

    i am new in this forum and i hope that i will get the solution to this error.

    actually, i want to import bulk data into the server table but literally failing below of the error mentioned below, i have tried both the ways using .txt and .csv files but still fails.

    Cannot bulk load because the file "‪C:\Users\Shaik\Desktop\Import.csv" could not be opened. Operating system error code 123(The filename, directory name, or volume label syntax is incorrect.).

    BULK INSERT PhoneBook
    FROM '‪C:\Users\Shaik\Desktop\Import.csv'
    WITH

    (
    FIELDTERMINATOR = ',',
    ROWTERMINATOR = '\n'
    )
    GO

    i dont know how to solve it, Please have a look a try to give me your responses.

    Thanks

    Unless the server is on your desktop (or lap top) where the "‪C:\Users\Shaik\Desktop\Import.csv"  file lives, the server won't be able to see the file.  Even if it does live on the same box as the file, it may still not be able to see the file because it's (apparently) in your user directory and the server may not have privs to access that folder.  Even if the server can see the file, it won't be able to open it if another application (other than NotePad) has it open (for example, you have the file open in Excel).

    You can solve this issue by granting the SQL Server logins privs the machine/drive/folder where the file lives and we can help with that, but we first need to know where all the pieces live..
    Since it IS BULK INSERT, we may have to do a little song and dance to get things to work depending on what your privs on the server are.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • This was removed by the editor as SPAM

  • It's probably not a syntax issue. It's a permissions issue. If it were a syntax issue, the code would stop and you'd get an error message that the T-SQL "statement failed on line number X..."

Viewing 4 posts - 1 through 3 (of 3 total)

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