Results 1 to 9 of 9
  1. #1
    Join Date
    Aug 2012
    Posts
    30

    Unanswered: Named Pipes Provider: Could not open a connection to SQL Server [2]

    Hi guys, I need your help.

    I've this query for export the resultset in txt file:

    Code:
    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 [MYdb].[dbo].[TB40] WHERE LEFT (ZZ, 2) IN (''Is'', '''MS', ''OS'', ''SM'') AND YEAR (MAX([theDate])) >= YEAR (GETDATE());" queryout "c:\output\123.txt" -T -c -t;'
    but the error is :
    Code:
    SQLState = 08001, NativeError = 2
    Error = [Microsoft][SQL Server Native Client 10.0]Named Pipes Provider: Could not open a connection to SQL Server [2]. 
    SQLState = 08001, NativeError = 2
    Error = [Microsoft][SQL Server Native Client 10.0]A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check 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 = S1T00, NativeError = 0
    Error = [Microsoft][SQL Server Native Client 10.0]Login timeout expired
    can you help me?
    thank you in advance

  2. #2
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    I'm not able to figure out what you want to accomplish.

    Based on similar bits of text in your example, I suspect that this is related to your MySQL questions... MySQL and Microsoft SQL Server aren't compatible enough to accept all of the syntax for the other product, each has its own strengths and weaknesses.

    Please describe what you want to do, and I'll try to help you figure out how to do that (in either MySQL or Microsoft SQL Server, or both).

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

  3. #3
    Join Date
    Aug 2012
    Posts
    30
    thank you for help, the question is of Microsoft SQL Server.
    I need export output query in SQL Server in txt output file.

  4. #4
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    xp_cmdshell can do that, but there are much better and less risky ways to achieve the same goal.

    Do you want to create the text file manually using SSMS (SQL Server Management Studio), as a scheduled task, or on demand (via a PowerShell or batch file)?

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

  5. #5
    Join Date
    Aug 2012
    Posts
    30
    Quote Originally Posted by Pat Phelan View Post
    xp_cmdshell can do that, but there are much better and less risky ways to achieve the same goal.

    Do you want to create the text file manually using SSMS (SQL Server Management Studio), as a scheduled task, or on demand (via a PowerShell or batch file)?

    -PatP
    As a scheduled task, thanks.

  6. #6
    Join Date
    Nov 2004
    Location
    on the wrong server
    Posts
    8,835
    Provided Answers: 6
    “If one brings so much courage to this world the world has to kill them or break them, so of course it kills them. The world breaks every one and afterward many are strong at the broken places. But those that will not break it kills. It kills the very good and the very gentle and the very brave impartially. If you are none of these you can be sure it will kill you too but there will be no special hurry.” Earnest Hemingway, A Farewell To Arms.

  7. #7
    Join Date
    Nov 2004
    Location
    on the wrong server
    Posts
    8,835
    Provided Answers: 6
    then the scheduled task runs the batch file.
    “If one brings so much courage to this world the world has to kill them or break them, so of course it kills them. The world breaks every one and afterward many are strong at the broken places. But those that will not break it kills. It kills the very good and the very gentle and the very brave impartially. If you are none of these you can be sure it will kill you too but there will be no special hurry.” Earnest Hemingway, A Farewell To Arms.

  8. #8
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    Quote Originally Posted by cms9651 View Post
    As a scheduled task, thanks.
    Find the table in the SSMS Navigation pane (normally the leftmost window in SSMS).
    1. Connect to the database server.
    2. Expand the Databases container
    3. Expand the database that contains the table
    4. Expand the tables container
    5. Locate the table of interest
    Right Click on the table name, and find the Export menuitem (it is probably under a sub-menu).

    Make sure to save the export package as an SSIS package when you reach the final panel, but otherwise follow the screen prompts to create an export package.

    Check to ensure that the package does in fact create the export that you need. If not, repeat the process making changes as needed. If the output is good, create a SQL Agent job to run the SSIS package, and you are done!

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

  9. #9
    Join Date
    Aug 2012
    Posts
    30
    Quote Originally Posted by Pat Phelan View Post
    Find the table in the SSMS Navigation pane (normally the leftmost window in SSMS).
    1. Connect to the database server.
    2. Expand the Databases container
    3. Expand the database that contains the table
    4. Expand the tables container
    5. Locate the table of interest
    Right Click on the table name, and find the Export menuitem (it is probably under a sub-menu).

    Make sure to save the export package as an SSIS package when you reach the final panel, but otherwise follow the screen prompts to create an export package.

    Check to ensure that the package does in fact create the export that you need. If not, repeat the process making changes as needed. If the output is good, create a SQL Agent job to run the SSIS package, and you are done!

    -PatP
    Okey, thank you.

Posting Permissions

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