Importing data from a flat file

  • I have just upgraded from SQL 2008 Enterpise to SQL 2008 R2 Enterprise. Prior to the upgrade I had several procedures which imported data from flat files located on another server. These imports have been working properly for over a year. Since the upgrade I am getting access denied errors. The upgrade did not change the domain account used to start the SQL services. Is there a new security setting in SQL 2008 R2 that needs to be set?

    Thanks

    Chuck

  • How are you importing from flat files? What’s the error message?

    I believe advanced options might have reset. Please crosscheck those.

    Setting Server Configuration Options

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

  • I'm using bulk insert. The exact error is:

    Cannot bulk load because the file "<<file.csv>>" could not be opened. Operating system error code 5(Access is denied.).

    The domain user executing the script and the domain user starting the SQL service are both domain administrators and in the sysadmin server roll.

    I don't recall making in configuration perminent changes in prior service. I do make changes to configuation in procedures by turning on what I need, executing script and then turning id off again.

    Are you aware of any default configuration changes that may be in R2 that might cause this issue?

    Thanks

    Chuck

  • Please check the permissions on the file "<<file.csv>>".

  • The permission are the same as they were before the upgrade to R2. Domain users have read execute and domain administrators have full control.

    Chuck

  • I guess these two culprits. Can you please post your Bulk Insert code?

    ad hoc distributed queries Option

    By default, SQL Server does not allow ad hoc distributed queries using OPENROWSET and OPENDATASOURCE. When this option is set to 1, SQL Server allows ad hoc access. When this option is not set or is set to 0, SQL Server does not allow ad hoc access.

    xp_cmdshell Option

    Introduced in SQL Server 2005, the xp_cmdshell option is a server configuration option that enables system administrators to control whether the xp_cmdshell extended stored procedure can be executed on a system. By default, the xp_cmdshell option is disabled on new installations and can be enabled by using the Policy-Based Management or by running the sp_configure system stored procedure

  • Here is the code:

    bulk insert #t2 from '\\efs2\e$\WebFiles\Uploads\boaMother.csv' with(firstrow=5,fieldterminator=',',rowterminator='

    Is bulk insert considered Ad Hoc?

    Chuck

  • Chuck 17099 (12/3/2011)


    Here is the code:

    bulk insert #t2 from '\\efs2\e$\WebFiles\Uploads\boaMother.csv' with(firstrow=5,fieldterminator=',',rowterminator='

    Is bulk insert considered Ad Hoc?

    Chuck

    Nope.

  • My doubt is more on file permissions only.

    Can you login on server (Windows Login) and open '\\efs2\e$\WebFiles\Uploads\boaMother.csv' file in excel or notepad?

  • Yes

  • I didn’t want to ask for it but did you restart services / server after upgrade?

    Is downtime acceptable?

Viewing 11 posts - 1 through 11 (of 11 total)

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