Results 1 to 11 of 11
  1. #1
    Join Date
    Dec 2012
    Posts
    5

    Unanswered: Configure 'Allow Updates'

    hi there, hope in your help.

    I tried this code in sql server, but I've this error.
    Can you help me?
    I would really appreciate any help.
    PHP Code:
    sp_configure 'Allow Updates',
     
    0;

    RECONFIGURE WITH override;

    EXEC master.dbo.sp_configure 'show advanced options',
     
    1 RECONFIGURE EXEC master.dbo.sp_configure 'xp_cmdshell',
     
    1 RECONFIGURE EXEC xp_cmdshell 'bcp "SELECT * FROM [dbo].[tbl];" queryout "\\XX.XX.XX.XX\output.txt" -T -c -t;'


    SQLState 08001NativeError 2
    Error 
    = [Microsoft][SQL Server Native Client 10.0]Named Pipes ProviderCould not open a connection to SQL Server [2]. 
    SQLState 08001NativeError 2
    Error 
    = [Microsoft][SQL Server Native Client 10.0]A network-related or instance-specific error has occurred while 
    establishing a connection to SQL ServerServer is not found or not accessibleCheck if instance name is correct 
    and if SQL Server is config
    ured to allow remote connections
    . For more information see SQL Server Books Online.
    SQLState S1T00NativeError 0
    Error 
    = [Microsoft][SQL Server Native Client 10.0]Login timeout expired 

  2. #2
    Join Date
    Jan 2003
    Location
    Massachusetts
    Posts
    5,800
    Provided Answers: 11
    No server name is listed in the BCP command. It will by default look for a default instance on the server running SQL Server. DO you only have a named instance out there?

    And as a side note, why run BCP from within SQL Server? Why not run it from a command line in either a scheduled task, or a SQL Agent job?

  3. #3
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    Use the Transact-SQL BULK INSERT command instead of using BCP via xp_cmdshell.

    -PatP
    In theory, theory and practice are identical. In practice, theory and practice are unrelated.

  4. #4
    Join Date
    Jan 2003
    Location
    Massachusetts
    Posts
    5,800
    Provided Answers: 11
    Unfortunately, he is trying to export the data.

  5. #5
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    Oops, my bad. Sorry.

    -PatP
    In theory, theory and practice are identical. In practice, theory and practice are unrelated.

  6. #6
    Join Date
    Jan 2003
    Location
    Massachusetts
    Posts
    5,800
    Provided Answers: 11
    No worries. I just think after all this, there is just going to be a much easier way, if we understood the base problem.

  7. #7
    Join Date
    Dec 2012
    Posts
    5
    thank you for help.
    I need to get data from a table into a file txt.

  8. #8
    Join Date
    Jan 2003
    Location
    Massachusetts
    Posts
    5,800
    Provided Answers: 11
    Then use BCP from a command line. There is no need to run it on the server itself.

  9. #9
    Join Date
    Dec 2012
    Posts
    5
    I tried this but the table is not exporting in txt file:
    PHP Code:
    [SQL] DECLARE
        @
    SQL VARCHAR (8000SELECT
            
    @SQL 'bcp mytable out \\XX.XX.XX.XX\output.txt -T -c -t'
    Affected rows0
    Time
    0.041ms

    Affected rows

    Last edited by cms9651-2; 05-16-13 at 11:52.

  10. #10
    Join Date
    Jan 2003
    Location
    Massachusetts
    Posts
    5,800
    Provided Answers: 11
    That does not look like any command line I have seen. Click the start button, select "run", and type in cmd.

  11. #11
    Join Date
    Dec 2012
    Posts
    5
    thanks so much.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •