[SQL Server Native Client 10.0]Unable to open BCP host data-file

  • Hi All,

    I have a bcp command that works in 2008 standard edition but not in sql 2012 developer edition.

    I'm using the SA account in both cases to a local sql server.

    It's time to ask the experts for some help. Any thoughts peeps?

    Results are attached.

    set nocount on

    SELECT SERVERPROPERTY('productversion'), SERVERPROPERTY ('productlevel'), SERVERPROPERTY ('edition')

    go

    select @@version

    go

    select @@MICROSOFTVERSION

    go

    exec sp_configure 'xp_cmdshell'

    GO

    RECONFIGURE

    GO

    DECLARE @OutputFile NVARCHAR(100) , @FilePath NVARCHAR(100) , @bcpCommand NVARCHAR(1000)

    SET @bcpCommand = 'bcp "select name,convert(char(20), sysdatetime(),120) from [master].[sys].[servers] where server_id = 0" queryout '

    SET @bcpCommand = @bcpCommand + ' c:\temp.txt -T -c && type c:\temp.txt >> c:\results.txt'

    exec master..xp_cmdshell @bcpCommand

    exec master..xp_cmdshell 'del c:\temp.txt'

  • PS the query itself works fine on 2012 developer

    select name,convert(char(20), sysdatetime(),120) from [master].[sys].[servers] where server_id = 0

    PC028132015-08-07 18:00:20

  • The working sql 2008 standard edition env is a VM not attached to a domain.

    The 2012 developer edition is a local install on by client machine. Even if I use my domain logon for windows auth the bcp script still fails.

    My domain login is a member of sysadmin.

    Sorry if the answer seems obvious, I'm just after some definitive advice.

    Ta S.B

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

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