Trying to output to a file

When I run the below I receive an error
select * from professionals queryout 'q:\prof.txt'
Msg 102, Level 15, State 1, Line 1
Incorrect syntax near 'q:\prof.txt'.

If you have xp_cmdshell enabled you are ready to export your files:
EXEC xp_cmdshell 'bcp "select * from professionals" queryout "q:\prof.txt" -T -c -t,'
More details:
http://www.mssqltips.com/sqlservertip/1633/simple-way-to-export-sql-server-data-to-text-files/
If this post answers your query, please click "Mark As Answer" or "Vote as Helpful".

Similar Messages

  • Regarding Excel output of XML file

    When i am trying to open the output of XML file. I am getting the below dialogue boxes before report getting openend. Can any one help to resolve this issue.
    Dailogue box 1
    Open XML
    Please select how you would like to open this file:
    As a XML table
    As a read-onlyworkbook
    Use the XML Source task pane
    Dialogue box 2
    Microsoft office excel
    The Specified XML Source does not refer to a schema. Excel will create a schemabased on the XML source data.

    plz see
    How To View / Open Concurrent Requests With The Excel Application [ID 377424.1]
    How to Control the Name and the Application that Opens the Concurrent Request Output File on the Client? [ID 316752.1]
    How to Setup The Report Output to Different Viewer Types in Oracle Applications [ID 184375.1]
    http://sairamgoudmalla.blogspot.com/2009/04/concurrent-program-output-in-ms-excel.html

  • Problems when trying to load a flat file

    I am trying to preview a flat file which I am able to preview on an existing BW system but not on a replacement system (which is a 3.5 system).  The structures are identical.  The message that I get is below:  The infoobject definition for 0CALMONTH is the same in both systems i.e.
    Input: 6
    Conversion routine: PERI6
    Output length: 7
    Can someone assist? Thanks
    Error in conversion exit
    CONVERSION_EXIT_PERI6_INPUT
    Detailed message:
    Error in conversion exit CONVERSION_EXIT_PERI6_INPUT
    Message no. RSAR137
    Diagnosis
    An error occurred in record                                                   1 during execution ofconversion exit CONVERSION_EXIT_PERI6_INPUT for field CALMONTH.
    Procedure
    Check that the record where the error occurred has the correct format, and correct it accordingly.

    Hi Niten,
    Goto the transfer rules -> Data str/tranger structure tab -> and check whether the 0CALMONTH has any conversion exit assigned. You can remove that and retry.
    Bye
    Dinesh

  • How to capture output of java files using Runtime.exec

    Hi guys,
    I'm trying to capture output of java files using Runtime.exec but I don't know how. I keep receiving error message "java.lang.NoClassDefFoundError:" but I don't know how to :(
    import java.io.*;
    public class CmdExec {
      public CmdExec() {
      public static void main(String argv[]){
         try {
         String line;
         Runtime rt = Runtime.getRuntime();
         String[] cmd = new String[2];
         cmd[0] = "javac";
         cmd[1] = "I:\\My Documents\\My file\\CSM\\CSM00\\SmartQ\\src\\E.java";
         Process proc = rt.exec(cmd);
         cmd = new String[2];
         cmd[0] = "javac";
         cmd[1] = "I:\\My Documents\\My file\\CSM\\CSM00\\SmartQ\\src\\E";
         proc = rt.exec(cmd);
         //BufferedReader input = new BufferedReader(new InputStreamReader(p.getInputStream()));
         BufferedReader input = new BufferedReader(new InputStreamReader(proc.getErrorStream()));
         while ((line = input.readLine()) != null) {
            System.out.println(line);
         input.close();
        catch (Exception err) {
         err.printStackTrace();
    public class E {
        public static void main(String[] args) {
            System.out.println("hello world!!!!");
    }Please help :)

    Javapedia: Classpath
    How Classes are Found
    Setting the class path (Windows)
    Setting the class path (Solaris/Linux)
    Understanding the Java ClassLoader
    java -cp .;<any other directories or jars> YourClassNameYou get a NoClassDefFoundError message because the JVM (Java Virtual Machine) can't find your class. The way to remedy this is to ensure that your class is included in the classpath. The example assumes that you are in the same directory as the class you're trying to run.
    javac -classpath .;<any additional jar files or directories> YourClassName.javaYou get a "cannot resolve symbol" message because the compiler can't find your class. The way to remedy this is to ensure that your class is included in the classpath. The example assumes that you are in the same directory as the class you're trying to run.

  • Output to DivX file, but as .avi

    My client has requested I output a sequence as a DivX (.avi) file.
    This is for playback to a large screen monitor from a CF card.
    I downloaded the DivX software, so that now within FCP, under export using QT conversion, there is an option DivX
    I downloaded from here:
    http://www.divx.com/en/faq/view/supportFAQen079
    I have successfully output a DivX file.  But how do I make this .avi?  An associate said just change the extension.  Is that all?  I tried this, and the video file still plays, using the DivX player and QT player.  But there must be a more sophisticated way to do this conversion to .avi, isn't there?
    About the sequence settings:
    1920 X 1080
    Square pixel aspect ratio
    The QT video sittings come up automatically as XD CAM EX 1080P25 35 mbps, but the material was shot on a Canon XF100 camera, which is not XD CAM format.
    Can anyone help with a step by step on procedures for this kind of output?
    Thanks so much.   Desparate to finish this project for client deadline...everything was fine till I hit the output specs!

    Thanks for that tip!
    I did find out that at this website
    http://www.divx.com/en/movies/faq
    You can download software that then within FCP creates a new export as QT conversion option, where you can make a new divX file.  I was then told by the company that makes the software:
    The DivX Plus Converter will create .mkv files if the DivX Plus HD output profile is selected. If the HD 1080p, HD 720p, Home Theater, or Mobile profiles are selected, it will create a .divx file, which is based on the AVI format. The .divx extension can then be changed to .avi by simply renaming the file, i.e. from mymovie.divx to mymovie.avi. This does not require additional conversion.
    If you create a DivX-encoded file in a third-party application, this will usually be an .avi file. If you are on Mac, you can export from QuickTime Player Pro to export to DivX. To learn more about this, consult this FAQ. If you are on Windows, using a program such as VirtualDub allows you to select the DivX codec for export into an AVI file.
    Hope this helps anyone out there who is asked to deal with DivX for the first time, as I just was!

  • HELP ON HOW TO STORE OUTPUT IN TEXT FILE

    Hello,
    I am trying to output the results from queties into an output text file does anyone knows how to do that please?
    For example i want to do :
    Select SYSDATE from dual;
    and output the result of it in a text file called output.txt does anyone knows how to do that please?
    THanks a lot and every help is appreciated.
    Regards,
    giannis

    Can i set the path of the output file Yes, you can :
    TEST@db102 SQL> spool /tmp/output.txt
    TEST@db102 SQL> select sysdate from dual;
    SYSDATE
    14-JUN-06
    TEST@db102 SQL> spool off
    TEST@db102 SQL> !ls -ltr /tmp | tail -n 1
    -rw-r--r--   1 ora102 dba       313 Jun 14 01:52 output.txt
    TEST@db102 SQL> !cat /tmp/output.txt
    TEST@db102 SQL> select sysdate from dual;
    SYSDATE
    14-JUN-06
    TEST@db102 SQL> spool off
    TEST@db102 SQL>                                                             

  • DBV output to 1 file

    Hi,
    I'm trying to do a simple script that will put the output of multiple dbv commands to 1 file. I've tried using the spool command followed by the "host dbv" commands, but this does not capture the output to a flat file. Does anyone know how to do this?

    Redirect the error output to your file.
    C:\>dbv file=USERS01.DBF 2> x
    C:\>dbv file=EXAMPLE01.DBF 2>> x
    C:\>type x
    DBVERIFY: Release 10.2.0.1.0 - Production on Tue Oct 31 15:57:33 2006
    Copyright (c) 1982, 2005, Oracle.  All rights reserved.
    DBVERIFY - Verification starting : FILE = USERS01.DBF
    DBVERIFY - Verification complete
    Total Pages Examined         : 640
    Total Pages Processed (Data) : 68
    Total Pages Failing   (Data) : 0
    Total Pages Processed (Index): 98
    Total Pages Failing   (Index): 0
    Total Pages Processed (Other): 186
    Total Pages Processed (Seg)  : 0
    Total Pages Failing   (Seg)  : 0
    Total Pages Empty            : 288
    Total Pages Marked Corrupt   : 0
    Total Pages Influx           : 0
    Highest block SCN            : 4249694604 (1.4249694604)
    DBVERIFY: Release 10.2.0.1.0 - Production on Tue Oct 31 15:57:52 2006
    Copyright (c) 1982, 2005, Oracle.  All rights reserved.
    DBVERIFY - Verification starting : FILE = EXAMPLE01.DBF
    DBVERIFY - Verification complete
    Total Pages Examined         : 12800
    Total Pages Processed (Data) : 4420
    Total Pages Failing   (Data) : 0
    Total Pages Processed (Index): 1351
    Total Pages Failing   (Index): 0
    Total Pages Processed (Other): 2680
    Total Pages Processed (Seg)  : 0
    Total Pages Failing   (Seg)  : 0
    Total Pages Empty            : 4349
    Total Pages Marked Corrupt   : 0
    Total Pages Influx           : 0
    Highest block SCN            : 561918 (0.561918)
    C:\>

  • How to convert Oracle reports previewer output into delimited file.

    How to convert Oracle reports previewer output into delimited file if the report has more than 1000 pages.
    I tried with previewer option File --> Generate to file --> Delimited file, but the report engine is crashing.Not generating .TXT file.
    I observed that this option is not working for more than 400 pages.
    I am using Oracle reports 6i version.
    Plz suggest me to generate .TXT file from Report previewer.

    You can specify a delimiter (a character or string of characters) to separate the data (boilerplate or field objects) in your report output in either of the following ways:
    On the command line using the DELIMITER keyword.
    In the Delimited Output dialog box or DelimitedData Output dialog box (displayed with File > Generate to File > Delimited or File > Generate to File > DelimitedData) in Reports Builder.
    for further information goto this link
    http://download.oracle.com/docs/cd/B14099_17/bi.1012/b13895/orbr_concepts2.htm#sthref760

  • Output verbose to file and console?

    Hello all,
    I'm running my PowerShell script from a batch file, and I'm trying to output the verbose statements to a log file as well as to the console. In the batch file I have:
    powershell.exe -command ".\Script.ps1 -verbose 4> ScriptLOG.txt"
    What I can't figure out is how to incorporate another redirector to have the output also output to the console as well as the LOG file.
    Any ideas?

    I think we need to realize that each of the redirectalble outputs is a single handle opened to a specific target.  When we redirect "standard I/O channel 4" to a file we are reallu  closin handle 4 and opening it to a file. We can only
    output to a single open handle at a time.  THe console is the default handle most of the time.  4 is noramally opend to the console.  All of the other handles are opened to teh console until redirected.  The default output of the pipeline
    is also sent to the console.  THe objects are enumerated and formatted to the console for the operator but they really only exist in memory.
    I normally write custom loggers.
    You can also use "Get-Content file.txt -Wait -Tail 1"
    This will display they output to the file one line at a time.  This allows monitoring the verbose channel.
    ¯\_(ツ)_/¯

  • How to output a postscript file with .ps extension name in jsp?

    Hi,
    I could use a servlet to output a postscript file with .ps file extension name. But I tried to do the same with jsp, for some reason, jsp always outputs a file with .jsp extension name though the content is postscript. Could anyone help me on this? Here is my jsp code:
    <%@page contentType="application/postscript"%>
    <%@page pageEncoding="UTF-8"%>
    <%@page import="java.util.*" %>
    <%@page import="java.io.*" %>
    <jsp:useBean id="corresv" class="oiintranet.CorresVBean" scope="request"/>
    <%
    response.setContentType("application/postscript");
    String corresId = request.getParameter("Id");
    corresv.setCorresId(corresId);
    PrintWriter output = response.getWriter();
    output = corresv.getResult(output);
    output.flush();
    %>
    In the bean corresv:
    public class CorresVBean extends BaseBean {
    private String corresId;
    public void setCorresId(String s) {
    this.corresId = s;
    public PrintWriter getResult(PrintWriter output) {
    //get postscript file content from a socket, one string line each time until reaches "X_END"
    String str;
    while ((str = in.readLine()) != null) {
    if (str.equals("X_END")) break;
    output.println (str);
    output.close();
    }catch(Exception e) {
    e.printStackTrace();
    return output;
    Thank you in advance.
    Geraldine

    Hi
    Every time u want to make a file u need to make its extension. I am talking
    about general scenario like word, excel so even when u make spool file
    so u need to give extension.
    like
    Spool temp.sql
    it will save u r file as sql file.
    hope it will help
    regards

  • Saving JSP report output as a file on the application server

    I am trying to determine if it is possible to save a web based JSP report to the file system in the same way you can with a report generated via the rwservlet command. I am specifying DESTYPE=HTML and DESNAME=/home/mydirectory/abc.htm on the command line, but it seems to be ignored. The directory has 777 permissions on it.
    1. Is it possible to save the JSP output onto the file system just like paper based reports?
    2. Where, if any, is documentation addressing this issue? The reports deployment guide appendix lists all the URL parameters that are available to the various rw commands, but nowhere is discussed what params are relavent to JSP reports.
    3. If it is not possible to do this via the URL, does anyone know if I can somehow fetch out the inner HTML from the generated page at the bottom pf the JSP and then write it to the file system using JAVA? I know how to do it via JavaScript, but the reports are run on UNIX. Is there someway I can access the DOM inside the JSP?
    4. Why hasn't Oracle explained this better?
    Thanks,
    matt

    Thanks for getting back to me. But the documentation link below takes me to running rwservlet requests. This was not what I needed. The good news is my most excellent DBA, Manoj Gandhi, found an old TAR in Metalink that emphatically states that what I am trying to do is not possible. See Note:272401.1
    Well, sort of not possible...
    As it turns out it is possible, but you must schedule the report for immediate execution using the rwservlet's scheduling facility. Again, this came to me via my DBA. The TAR for this piece is Note:295420.1. Ignore the rwservlet urlparameter= part as best I can tell it's gibberish. Below is what I did. Substitute your info for the stuff in UPPER CASE and put it all on one contiguous line of course:
    http://SERVER:PORT/PATH/rwservlet
    ?server=REPORT_SERVER_NAME
    &destype=file
    &desname=A_PATH_AND_FILE_FILE_NAME_WITH_EXTENSION
    &jobtype=rwurl
    &schedule=
    &urlparameter=http://SERVER:PORT/PATH/JSP_NAME?userid=USERID&OTHER_PARAMETERS...
    I am not sure why cmdkey= fails when passed in the urlparameter= but I am working on a solution!

  • Oracle script:How to avoid output in log file?

    Hi,
    I am try to create the xml file using some sql statements in a script.
    I dont want to display the output from these sql statements in log file.
    I tried with SET TERMOUT OFF, even then i am getting the output.

    I am getting the output even after using the SET echo off.
    I have given the following SET options,
         SET heading off
         SET feedback off
         SET verify off
         SET wrap off
         SET pagesize 0
         SET linesize 3000
    SET server off
         SET echo off
    I do not want to display the output in log file when i run the concurrent request.

  • Using Spool to output data to file

    I am trying to write some sql scripts to do spooling of data to files automatically on the 1st day of each month. I use the spool command to output to text file but have problems setting the filename to tag with the date stamp.
    Script 1 : to get current year and month and then call script 2 to output to file
    ==================================================================================
    set linesize 800
    set pagesize 999
    set heading off
    Remark Get current year and month from database
    Remark
    variable v_yyyymm number;
    declare
    begin
    Select to_number(to_char(to_date(to_char(sysdate,'DD/MM/YYYY'))-1,'YYYYMM')) INTO :v_yyyymm From dual;
    end;
    print v_yyyymm
    @script2.sql :v_yyyymm
    exit
    script2.sql : spool to file
    ============================
    spool Monthly\Audit_Trail_&1..txt
    SELECT * FROM AUDIT_TRAIL WHERE TO_NUMBER(TO_CHAR(DATESTAMP,'YYYYMM')) = &1;
    spool off
    Upon execution in Windows environment, it says that unable to create spool file. It seem
    that i can't use a bind variable in the Spool Command. Any alternative ways of achieving that ??? I need the file name to be taged with the date stamp ?

    Yet another example:
    I usually create a ".cmd" file to run a sql script such as the following:
    spool j:\DailyMetrics.sql
    select 'spool j:\Daily_Metrics_'||to_char(sysdate,'mmddyy')||'.txt' from dual;
    select '@j:\DAILY_METRICS;' from dual;
    select 'spool off' from dual;
    spool off
    This, of course, allows me to then run the "j:\DailyMetrics.sql" script which now spools to a file with today's date as part of its filename and calls the reporting script to generate the data, and then spools off.
    Obviously, you can put everything in the ".cmd" file and just schedule it to be run each day.
    Good luck :)

  • Output to .txt file overwriting.

    Hi
    I am trying to output to a .txt file with the below method that's called from a for loop that loops through a String array. Unfortunately it only writes to the first line over and over again so my .txt final ends up with the final element of the array and nothing else. Could anyone please suggest how this could be fixed.
      static void writeArray (String combinedFileNameAndNumber){
        try{
          File destfile = new File(pathName, destFileName);
          FileWriter fileWriter = new FileWriter(destfile);
          BufferedWriter fileOutput = new BufferedWriter(fileWriter);
          fileOutput.write(combinedFileNameAndNumber,0,combinedFileNameAndNumber.length());
          fileOutput.write("\n");
          fileOutput.flush();
          fileWriter.close();
        }catch(IOException e){
          System.out.println("IO Error in write method");
      }Thanks in advance.

    THe line separator is different on different platforms, on unix systems it's "\n" but on windows it's "\r\n". You can use System.getProperty("line.separator") to find the correct separator string.
    But you don't need that because you are using BufferedWriter, there's a method called newLine that does exactly what you want. Just instead of      fileOutput.write("\n");write      fileOutput.newLine();

  • Output to a file?

    Can you send output to a file instead of the dtrace log? If so, how? So what I'd like is something similar to an fprintf statement.
    Thanks
    Claire

    Oh, if it was that easy. Actually I need multiple output files open so changing the one terminal log to a file doesn't help. What I really need is to open a file in the probe to one routine, print to that file in multiple probes of routines, then close the file before the END. Once the file is closed I'd like to spawn a process to analyze the data that I collected in the file.
    I've just started using Dtrace. I have been using OcSystems Aprobe for about 2 years. It's similar in that you can instrument an application, third party software and/or the OS. I have some very complicated probes built with Aprobe and I'm trying to convert some of these probes to Dtrace. I'm finding a lot of limitiations. Not being able to open a file and write to it, and close it during the dtrace probe is just one of the limitations.

Maybe you are looking for

  • Get out values from stored procedure

    Hi folks, I have need of an aid. I have created this stored procedure: CREATE OR REPLACE PROCEDURE ProceduraDiProva ( p_val1 IN NUMBER DEFAULT 1, p_val2 IN NUMBER DEFAULT 1, p_val3 OUT NUMBER, p_val4 OUT NUMBER) AS BEGIN p_val3 := p_val1 + p_val2; p_

  • CS6 Working Fine ... Then Unusable

    I am losing my mind.  I have tried everything with Adobe Premiere.  I have been working on a 30 second file and it keep crashing.  Here's what I've tried: I thought I isolated it to a plugin, so I deleted it.  Still freezes. I disabled all 3rd party

  • "Adobe Encore (encore 5.1 in cs 5.5) has stopped working" when trying to create blue ray

    Newly installed machine with Windows 7 and Premiere Pros CS5.5.  I've googled the error and have reset the preferences and updated the sonic driver.  But when I start and create a blue ray project, as it's trying to create it, it gives the error "Ado

  • How to make PhotoshopAlbumSE stop scanning USB drives

    How to I make Photoshop Album Starter Edition STOP automatically scanning & displaying the images/contents of flash/external drives that get connected? I've looked in Preference and don't seem to find anything that applies. Being able to open PA-SE a

  • Xml query help

    I have the XML below stored in a table in an XML field. I wish to query this record for the <HISTORY_BLOCK> data and get on record for each <row>. ie. I want to do something like Select      extractvalue(detail, '/S12/HISTORY_BLOCK/RESULT’),      ext