Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Database & SysAdmin
  3. Database
  4. Bulk Import Error

Bulk Import Error

Scheduled Pinned Locked Moved Database
csharpasp-netdatabasecom
7 Posts 3 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    Vimalsoft Pty Ltd
    wrote on last edited by
    #1

    Good Day All i have a Following Query that does the Bulk insert

    BULK INSERT dbo.TBL_CMPS FROM C:\\UNISA_IMPORT\\Final_Import\\Campuses.csv WITH (FIELDTERMINATOR = ',', ROWTERMINATOR = '\n' );

    i get an Error

    Msg 102, Level 15, State 1, Line 2
    Incorrect syntax near 'C'.

    and when i add the Quoates in the path like this

    BULK INSERT dbo.TBL_CMPS FROM 'C:\\UNISA_IMPORT\\Final_Import\\Campuses.csv' WITH (FIELDTERMINATOR = ',', ROWTERMINATOR = '\n' );

    i get the Following Error

    Msg 4861, Level 16, State 1, Line 1
    Cannot bulk load because the file "C:\\UNISA_IMPORT\\Final_Import\\Campuses.csv" could not be opened. Operating system error code 3(The system cannot find the path specified.).

    Thank you

    Vuyiswa Maseko, Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code. C#/VB.NET/ASP.NET/SQL7/2000/2005/2008 http://www.vuyiswamaseko.com vuyiswa@its.co.za http://www.itsabacus.co.za/itsabacus/

    L J 2 Replies Last reply
    0
    • V Vimalsoft Pty Ltd

      Good Day All i have a Following Query that does the Bulk insert

      BULK INSERT dbo.TBL_CMPS FROM C:\\UNISA_IMPORT\\Final_Import\\Campuses.csv WITH (FIELDTERMINATOR = ',', ROWTERMINATOR = '\n' );

      i get an Error

      Msg 102, Level 15, State 1, Line 2
      Incorrect syntax near 'C'.

      and when i add the Quoates in the path like this

      BULK INSERT dbo.TBL_CMPS FROM 'C:\\UNISA_IMPORT\\Final_Import\\Campuses.csv' WITH (FIELDTERMINATOR = ',', ROWTERMINATOR = '\n' );

      i get the Following Error

      Msg 4861, Level 16, State 1, Line 1
      Cannot bulk load because the file "C:\\UNISA_IMPORT\\Final_Import\\Campuses.csv" could not be opened. Operating system error code 3(The system cannot find the path specified.).

      Thank you

      Vuyiswa Maseko, Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code. C#/VB.NET/ASP.NET/SQL7/2000/2005/2008 http://www.vuyiswamaseko.com vuyiswa@its.co.za http://www.itsabacus.co.za/itsabacus/

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      This might work;

      BULK INSERT dbo.TBL_CMPS FROM 'C:\UNISA_IMPORT\Final_Import\Campuses.csv' WITH (FIELDTERMINATOR = ',', ROWTERMINATOR = '\n' );

      The first one doesn't work because of the quotes, the second one has escape-characters in the path.

      I are Troll :)

      V 1 Reply Last reply
      0
      • V Vimalsoft Pty Ltd

        Good Day All i have a Following Query that does the Bulk insert

        BULK INSERT dbo.TBL_CMPS FROM C:\\UNISA_IMPORT\\Final_Import\\Campuses.csv WITH (FIELDTERMINATOR = ',', ROWTERMINATOR = '\n' );

        i get an Error

        Msg 102, Level 15, State 1, Line 2
        Incorrect syntax near 'C'.

        and when i add the Quoates in the path like this

        BULK INSERT dbo.TBL_CMPS FROM 'C:\\UNISA_IMPORT\\Final_Import\\Campuses.csv' WITH (FIELDTERMINATOR = ',', ROWTERMINATOR = '\n' );

        i get the Following Error

        Msg 4861, Level 16, State 1, Line 1
        Cannot bulk load because the file "C:\\UNISA_IMPORT\\Final_Import\\Campuses.csv" could not be opened. Operating system error code 3(The system cannot find the path specified.).

        Thank you

        Vuyiswa Maseko, Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code. C#/VB.NET/ASP.NET/SQL7/2000/2005/2008 http://www.vuyiswamaseko.com vuyiswa@its.co.za http://www.itsabacus.co.za/itsabacus/

        J Offline
        J Offline
        J4amieC
        wrote on last edited by
        #3

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

        These things don't tend to lie, however they can be misleading. Are you sure the user running this process has access to this file? If so, why are you sure? Are you doubly sure? If so, are you triplly sure the path is correct?

        V 1 Reply Last reply
        0
        • L Lost User

          This might work;

          BULK INSERT dbo.TBL_CMPS FROM 'C:\UNISA_IMPORT\Final_Import\Campuses.csv' WITH (FIELDTERMINATOR = ',', ROWTERMINATOR = '\n' );

          The first one doesn't work because of the quotes, the second one has escape-characters in the path.

          I are Troll :)

          V Offline
          V Offline
          Vimalsoft Pty Ltd
          wrote on last edited by
          #4

          Good Day Eddy The Error is still there

          Msg 4861, Level 16, State 1, Line 1
          Cannot bulk load because the file "C:\UNISA_IMPORT\Final_Import\Campuses.csv" could not be opened. Operating system error code 3(The system cannot find the path specified.).

          ASP, Admin, Everyone , has read and Write access to this File

          Vuyiswa Maseko, Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code. C#/VB.NET/ASP.NET/SQL7/2000/2005/2008 http://www.vuyiswamaseko.com vuyiswa@its.co.za http://www.itsabacus.co.za/itsabacus/

          1 Reply Last reply
          0
          • J J4amieC

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

            These things don't tend to lie, however they can be misleading. Are you sure the user running this process has access to this file? If so, why are you sure? Are you doubly sure? If so, are you triplly sure the path is correct?

            V Offline
            V Offline
            Vimalsoft Pty Ltd
            wrote on last edited by
            #5

            yes , this is Happening in my Development machine and i have local admin Rights, the ASP account has access to this File and Everyone has access to this File. Thanks

            Vuyiswa Maseko, Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code. C#/VB.NET/ASP.NET/SQL7/2000/2005/2008 http://www.vuyiswamaseko.com vuyiswa@its.co.za http://www.itsabacus.co.za/itsabacus/

            V 1 Reply Last reply
            0
            • V Vimalsoft Pty Ltd

              yes , this is Happening in my Development machine and i have local admin Rights, the ASP account has access to this File and Everyone has access to this File. Thanks

              Vuyiswa Maseko, Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code. C#/VB.NET/ASP.NET/SQL7/2000/2005/2008 http://www.vuyiswamaseko.com vuyiswa@its.co.za http://www.itsabacus.co.za/itsabacus/

              V Offline
              V Offline
              Vimalsoft Pty Ltd
              wrote on last edited by
              #6

              The Problem is that the SQL Server is in another Machine and am in my Developement Machine. So the Path is not in the Machine. the Solution is to Add the File to the Server and after that access the File after am done with the Import and Delete the File. Now i have one Question. in my database table i have an Identity Column

              BULK INSERT dbo.TBL_CMPS FROM 'C:\UNISA_IMPORT\Final_Import\Campuses.csv' WITH ( FIELDTERMINATOR = ',', ROWTERMINATOR = '\n' );

              How can i make the second Column as the First one. Because it tries to add records in the identity field and i get the Following Errors

              ulk load data conversion error (type mismatch or invalid character for the specified codepage) for row 2, column 1 (ID).
              Msg 4864, Level 16, State 1, Line 1
              Bulk load data conversion error (type mismatch or invalid character for the specified codepage) for row 3, column 1 (ID).
              Msg 4864, Level 16, State 1, Line 1
              Bulk load data conversion error (type mismatch or invalid character for the specified codepage) for row 4, column 1 (ID).
              Msg 4864, Level 16, State 1, Line 1
              Bulk load data conversion error (type mismatch or invalid character for the specified codepage) for row 5, column 1 (ID).
              Msg 4864, Level 16, State 1, Line 1
              Bu

              Thank you

              Vuyiswa Maseko, Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code. C#/VB.NET/ASP.NET/SQL7/2000/2005/2008 http://www.vuyiswamaseko.com vuyiswa@its.co.za http://www.itsabacus.co.za/itsabacus/

              J 1 Reply Last reply
              0
              • V Vimalsoft Pty Ltd

                The Problem is that the SQL Server is in another Machine and am in my Developement Machine. So the Path is not in the Machine. the Solution is to Add the File to the Server and after that access the File after am done with the Import and Delete the File. Now i have one Question. in my database table i have an Identity Column

                BULK INSERT dbo.TBL_CMPS FROM 'C:\UNISA_IMPORT\Final_Import\Campuses.csv' WITH ( FIELDTERMINATOR = ',', ROWTERMINATOR = '\n' );

                How can i make the second Column as the First one. Because it tries to add records in the identity field and i get the Following Errors

                ulk load data conversion error (type mismatch or invalid character for the specified codepage) for row 2, column 1 (ID).
                Msg 4864, Level 16, State 1, Line 1
                Bulk load data conversion error (type mismatch or invalid character for the specified codepage) for row 3, column 1 (ID).
                Msg 4864, Level 16, State 1, Line 1
                Bulk load data conversion error (type mismatch or invalid character for the specified codepage) for row 4, column 1 (ID).
                Msg 4864, Level 16, State 1, Line 1
                Bulk load data conversion error (type mismatch or invalid character for the specified codepage) for row 5, column 1 (ID).
                Msg 4864, Level 16, State 1, Line 1
                Bu

                Thank you

                Vuyiswa Maseko, Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code. C#/VB.NET/ASP.NET/SQL7/2000/2005/2008 http://www.vuyiswamaseko.com vuyiswa@its.co.za http://www.itsabacus.co.za/itsabacus/

                J Offline
                J Offline
                J4amieC
                wrote on last edited by
                #7

                Vuyiswa Maseko wrote:

                The Problem is that the SQL Server is in another Machine and am in my Developement Machine. So the Path is not in the Machine

                Told you that error doesn't lie! ;P

                Vuyiswa Maseko wrote:

                How can i make the second Column as the First one. Because it tries to add records in the identity field and i get the Following Errors

                Have you tried the documentation on BULK INSERT[^]? The bit you're after is: FORMATFILE = 'format_file_path'

                The docs say:

                Specifies the full path of a format file. A format file describes the data file that contains stored responses created by using the bcp utility on the same table or view. The format file should be used if: * The data file contains greater or fewer columns than the table or view.

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups