7 Replies Latest reply on May 16, 2013 10:13 AM by John Stegeman

    bcp select query

    Oracle_Monkey
      bcp "select a,b ,c from database.schema.SomeTable" queryout  
      "c:\MyData.csv"  -c -t"," -r"\n" -S ServerName -T
      when i am executing the above code i am getting an error
      Error = [Microsoft][SQL Server Native Client 10.0]Named Pipes Provider: Could no
      t open a connection to SQL Server [53].
      SQLState = 08001, NativeError = 53
      Error = [Microsoft][SQL Server Native Client 10.0]A network-related or instance-
      specific error has occurred while establishing a connection to SQL Server. Serve
      r is not found or not accessible. Check if instance name is correct and if SQL S
      erver is configured to allow remote connections. For more information see SQL Se
      rver Books Online.
      SQLState = S1T00, NativeError = 0
      Error = [Microsoft][SQL Server Native Client 10.0]Login timeout expired
      How to solve the problem?

      How can i execute oracle query from cmd and use it in bcp and generate .CSV file

      Edited by: Oracle_Monkey on May 16, 2013 2:28 AM
        • 1. Re: bcp select query
          jeneesh
          Oracle_Monkey wrote:
          How can i execute oracle query from cmd and use it in bcp and generate .CSV file
          This forum is for SQL and PL/SQL issues..

          This should be asked in a BCP forum I feel.. (Dont know what BCP is .. :( )
          • 2. Re: bcp select query
            Paul  Horth
            Oracle_Monkey wrote:
            bcp "select a,b ,c from database.schema.SomeTable" queryout  
            "c:\MyData.csv"  -c -t"," -r"\n" -S ServerName -T
            when i am executing the above code i am getting an error
            Error = [Microsoft][SQL Server Native Client 10.0]Named Pipes Provider: Could no
            t open a connection to SQL Server [53].
            SQLState = 08001, NativeError = 53
            Error = [Microsoft][SQL Server Native Client 10.0]A network-related or instance-
            specific error has occurred while establishing a connection to SQL Server. Serve
            r is not found or not accessible. Check if instance name is correct and if SQL S
            erver is configured to allow remote connections. For more information see SQL Se
            rver Books Online.
            SQLState = S1T00, NativeError = 0
            Error = [Microsoft][SQL Server Native Client 10.0]Login timeout expired
            How to solve the problem?

            How can i execute oracle query from cmd and use it in bcp and generate .CSV file

            Edited by: Oracle_Monkey on May 16, 2013 2:28 AM
            As far as I know, BCP is a Microsoft utility to copy data from SQL Server to a data file.

            Why post such a question to an Oracle PL/SQL forum?
            • 3. Re: bcp select query
              Oracle_Monkey
              Jeenesh i have same old problem .
              I have 2 sql queries and i want to store their data in .csv fiel. data volume is large around 200000 rows
              • 4. Re: bcp select query
                Oracle_Monkey
                As far as I know, BCP is a Microsoft utility to copy data from SQL Server to a data file.

                Why post such a question to an Oracle PL/SQL forum?
                I did not know that .
                Thanks
                • 5. Re: bcp select query
                  John Stegeman
                  I did not know that .
                  :0

                  And didn't the phrase "SQL Server" in the error messages tip you off?

                  The FAQ for this forum has information on creating CSV files. You could also Google for "tom kyte unloader" to find some code as well.
                  • 6. Re: bcp select query
                    Oracle_Monkey
                    >
                    And didn't the phrase "SQL Server" in the error messages tip you off?

                    The FAQ for this forum has information on creating CSV files. You could also Google for "tom kyte unloader" to find some code as well.
                    I did but most of the them require utl. file package access
                    • 7. Re: bcp select query
                      John Stegeman
                      Not the Tom Kyte solutions.

                      There are 3 from him:

                      PL/SQL package - requires UTL_FILE access (but so what, if you need it to do your job, then get access to it)
                      Pro*C program - doesn't require access to UTL_FILE
                      SQL*Plus - doesn't require access to UTL_FILE