bulk Insert Error

  • Hi I am trying to execute .tbl file to bulk insert in the server ServerA. The .tbl file was saved in Server ServerB. So I used the query and path as follows.

    I tried in two different ways.

    BULK INSERT tablename

    FROM '\\servernameB\F$\Upload Data\David\test.tbl'

    WITH

    (

    --DATAFILETYPE = 'widechar',

    FIELDTERMINATOR = '^',

    ROWTERMINATOR = ''

    )

    BULK INSERT tablename

    FROM '\\servernameB\Upload Data\David\test.tbl'

    WITH

    (

    --DATAFILETYPE = 'widechar',

    FIELDTERMINATOR = '^',

    ROWTERMINATOR = ''

    )

    I gave the full control/permissions to the folder in serverB but still I am getting the below error.

    Cannot bulk load because the file \\servernameB\Upload Data\David\test.tbl could not be opened. Operating system error code 3(The system cannot find the path specified.).

    Please Please help me in this. We using serverA first time and getting this issue.Also I got stuck with this from past 3 days and not able to do any stuff.

  • It's possible that whatever process you are using to execute this BULK INSERT is running with a security context that doesn't have access to that particular share and/or folder. It is a different thing to run this kind of query from SSMS than to run it from SSIS, as with the latter, you can run a package a number of ways, and those different ways may all run with a different security context. For example, if this runs as part of an SQL Agent job, the the SQL Agent service account will need access to the specified share, whereas if you run this via SSMS, it's your logon credentials that wil be used.

    Steve (aka sgmunson) 🙂 🙂 🙂
    Rent Servers for Income (picks and shovels strategy)

  • How do we get the sql server agent service account...I mean in which way we can it

  • Which account to use was decided when SQL Server was installed, and the information was used to supply the installation procedure with the account name and/or password. Your DBA should know this information. In many corporate environments, there's a single domain account used for this purpose. If this is your own personal instance, you may want to Google search for how to find the SQL Server Agent Service account name. I don't know where that information resides, but I'd be very surprised if you had to go looking in the registry to find it.

    Steve (aka sgmunson) 🙂 🙂 🙂
    Rent Servers for Income (picks and shovels strategy)

  • Looks like it sorta is in the registry, but if WMI is in place, the following WMI query will shake it loose:

    wmic service where "name Like '%SQL%'" get Name , StartName

    Found the query on Stack Overflow at the following site:

    http://stackoverflow.com/questions/7324407/get-service-account-details-of-the-sql-agent-service

    Enjoy...

    Steve (aka sgmunson) 🙂 🙂 🙂
    Rent Servers for Income (picks and shovels strategy)

  • Hi All,

    First, I am assuming that you are using at least the standard or higher version of SQL Server.

    I think the Express version does not have the agent.

    The SQL Server agent - account - can be found under the configuration manager.

    http://msdn.microsoft.com/en-us/library/ms174212.aspx

    You should never use services.msc since a certificate is created when settings are changed.

    Usually a domain account is supplied and is part of the local admins group on the machine.

    However, other setups might be dictated by your company.

    http://msdn.microsoft.com/en-us/library/ms191543.aspx

    The Matrix at the end shows what accounts are possible to use and limititations.

    If your account used by the agent allows logins into the server, ask your DBA to MSTSC into the server and try running the BULK INSERT. If this does not work, your account does not have the rights.

    If this does work, then your SQL Server Agent is not configured correctly.

    Like always, more detail and screen shots help us get to the root of your problem.

    Good luck

    John Miner
    Crafty DBA
    www.craftydba.com

  • Actually I do not have the permission to the server remotely. Because it's a database server I won't get access to the folders in the server to store .tbl files.

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

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