Autogenerating SQL command to create CSV

Hello, I created an apllication in ASP, where userer define with buttons and listBoxes data, which he needs to download. For example, application will generate string
SELECT ID117, COS(ID95), SIN(ID229) FROM PROBE WHERE TIME> 1528330200 AND TIME < 1528340200
How can I please generate file in CSV format? ( What I should add to query string? Or should I generate more strings and execute them gradually? )
str1 = SPOOL C:\inetpub\www..\x.csv
str2 = heading off ...
After he submit the query, link for this file should appear on page.
Thank you!

Ondrej T. wrote:
Hello, I created an apllication in ASP, where userer define with buttons and listBoxes data, which he needs to download. For example, application will generate string
SELECT ID117, COS(ID95), SIN(ID229) FROM PROBE WHERE TIME> 1528330200 AND TIME < 1528340200
How can I please generate file in CSV format? ( What I should add to query string? Or should I generate more strings and execute them gradually? )
str1 = SPOOL C:\inetpub\www..\x.csv
str2 = heading off ...
After he submit the query, link for this file should appear on page.
Thank you!As I see, you are talking about an ASP application, and you want to produce CSV file that can be downloaded.
Spool and heading are SQLPlus commands, you can't use them like sql or plsql commands. You can create this CSV file if you use PLSQL commands (http://asktom.oracle.com/pls/apex/f?p=100:11:0::NO::P11_QUESTION_ID:88212348059)
On the other hand, I think this should be done by ASP: http://bytes.com/topic/asp-classic/answers/51119-generate-csv-comma-delimited
Best Regards,
Gokhan Atil
Edited by: BluShadow on 05-May-2011 09:29
Request for post to be marked correct/helpful removed. Please do not ask for points to be awarded.

Similar Messages

  • How to create db using sql commands?

    Had logged in to default database with the default login nmae and password. Under this default database, am i able to create another database in it? If so, what is the sql command to create/delete the new db?

    Chapter 2
    http://download-east.oracle.com/docs/cd/B10501_01/server.920/a96521.pdf
    Joel P�rez

  • SQL Command table linking issues

    I have created a simple SQL command in CR 2008 to save the creation of a view on the DB (SQL Server 2005).  I then link it to another table from the same DB.  Once this was done I began experiencing extremely long run times versus the link with the original view.  The SQL command set was copied directly from the view in MS Visual Sudio.  The joins in CR are left outers and inner that worked fine with the original view.  We ended up running a trace of the SQL Server and found the SQL was producing 21,000 record reads everytime the primary table read a record.  It was not following the inner join at all.  I did a Show SQL in CR and found that the CR generated SQL looked very strange and not like the typical construction when the view was being used instead of the table  What am I doing wrong?  Below is a copy of the Show SQL for this particular issue.  It seems to be the second command set in italics that causes the issue.  That is from the SQL command I created in CR.
    Thanks,
    Brian
    PROD - FIN
    SELECT "MAN_JOBS"."JOB_NUMBER", "MAN_JOBS"."ACTUAL_START_DATE", "MAN_JOBS"."ACTUAL_START_DATE_2", "MAN_JOBS"."STD_PROCESS_SPEC", "MAN_JOBS"."COMPANY_CODE"
    FROM   "fin_prod"."dbo"."MAN_JOBS" "MAN_JOBS"
    EXTERNAL JOIN MAN_JOBS.STD_PROCESS_SPEC={?PROD - FIN: C_IC_PRODUCT_CHARACTERISTICS.PART_CODE} AND MAN_JOBS.COMPANY_CODE={?PROD - FIN: C_IC_PRODUCT_CHARACTERISTICS.COMPANY_CODE} AND MAN_JOBS.COMPANY_CODE={?PROD - FIN: KX_IC_MOVEMENTS_PRODCTN_IN_OUTS.COMPANY_CODE} AND MAN_JOBS.JOB_NUMBER={?PROD - FIN: KX_IC_MOVEMENTS_PRODCTN_IN_OUTS.DOCUMENT_NUMBER} AND MAN_JOBS.STD_PROCESS_SPEC={?PROD - FIN: KX_PRODUCT_MASTER_EXT.PART_CODE}
    PROD - FIN
    SELECT *
    FROM dbo.IC_PRODUCT_CHARACTERISTICS
    WHERE (CHARACTERISTIC_CODE = 'TEXT')
    EXTERNAL JOIN C_IC_PRODUCT_CHARACTERISTICS.PART_CODE={?PROD - FIN: MAN_JOBS.STD_PROCESS_SPEC} AND C_IC_PRODUCT_CHARACTERISTICS.COMPANY_CODE={?PROD - FIN: MAN_JOBS.COMPANY_CODE}
    PROD - FIN
    SELECT "KX_IC_MOVEMENTS_PRODCTN_IN_OUTS"."IC_MOVE_QUANTITY", "KX_IC_MOVEMENTS_PRODCTN_IN_OUTS"."TRANSACTION_TYPE", "KX_IC_MOVEMENTS_PRODCTN_IN_OUTS"."IC_LOT_NUMBER", "KX_IC_MOVEMENTS_PRODCTN_IN_OUTS"."WAREHOUSE", "KX_IC_MOVEMENTS_PRODCTN_IN_OUTS"."PERIOD_TXT", "KX_IC_MOVEMENTS_PRODCTN_IN_OUTS"."YEAR_TXT", "KX_IC_MOVEMENTS_PRODCTN_IN_OUTS"."DOCUMENT_NUMBER", "KX_IC_MOVEMENTS_PRODCTN_IN_OUTS"."PART_CODE", "KX_IC_MOVEMENTS_PRODCTN_IN_OUTS"."COMPANY_CODE"
    FROM   "fin_prod"."dbo"."KX_IC_MOVEMENTS_PRODCTN_IN_OUTS" "KX_IC_MOVEMENTS_PRODCTN_IN_OUTS"
    WHERE  "KX_IC_MOVEMENTS_PRODCTN_IN_OUTS"."COMPANY_CODE"={?PROD - FIN: MAN_JOBS.COMPANY_CODE} AND "KX_IC_MOVEMENTS_PRODCTN_IN_OUTS"."DOCUMENT_NUMBER"={?PROD - FIN: MAN_JOBS.JOB_NUMBER}
    EXTERNAL JOIN KX_IC_MOVEMENTS_PRODCTN_IN_OUTS.PART_CODE={?PROD - FIN: PRODUCT_MASTER.PART_CODE} AND KX_IC_MOVEMENTS_PRODCTN_IN_OUTS.COMPANY_CODE={?PROD - FIN: PRODUCT_MASTER.COMPANY_CODE}
    PROD - FIN
    SELECT "PRODUCT_MASTER"."PRODUCT_CLASS", "PRODUCT_MASTER"."COMPANY_CODE", "PRODUCT_MASTER"."PART_CODE"
    FROM   "fin_prod"."dbo"."PRODUCT_MASTER" "PRODUCT_MASTER"
    WHERE  "PRODUCT_MASTER"."PART_CODE"={?PROD - FIN: KX_IC_MOVEMENTS_PRODCTN_IN_OUTS.PART_CODE} AND "PRODUCT_MASTER"."COMPANY_CODE"={?PROD - FIN: KX_IC_MOVEMENTS_PRODCTN_IN_OUTS.COMPANY_CODE}
    PROD - FIN
    SELECT "KX_PRODUCT_MASTER_EXT"."PRODUCT_CLASS", "KX_PRODUCT_MASTER_EXT"."PART_CODE"
    FROM   "fin_prod"."dbo"."KX_PRODUCT_MASTER_EXT" "KX_PRODUCT_MASTER_EXT"
    WHERE  "KX_PRODUCT_MASTER_EXT"."PART_CODE"={?PROD - FIN: MAN_JOBS.STD_PROCESS_SPEC}

    As an update, I created a view in MS VIsual Studio and copied the SQL command set into a Crystal SQL command and made changes in the report to use the new CR SQL command.  It ran in seconds instead of hours.  There is something wrong with the way CR is building the SQL command when a CR SQL command is linked to a normal DB table.  HELP!  I started using the CR SQL command with only another 1 or 2 tables and it was slower but bearable.  This one uses more table and more data and dies.  Here is what the SQL command set looks like that I built in MS VS and used to create the CR SQL command.  This is from the Show SQL in CR.
    SELECT        dbo.MAN_JOBS.ACTUAL_START_DATE, dbo.MAN_JOBS.ACTUAL_START_DATE_2, dbo.MAN_JOBS.JOB_NUMBER,
                             dbo.KX_IC_MOVEMENTS_PRODCTN_IN_OUTS.DOCUMENT_NUMBER, dbo.KX_IC_MOVEMENTS_PRODCTN_IN_OUTS.IC_LOT_NUMBER,
                             dbo.KX_IC_MOVEMENTS_PRODCTN_IN_OUTS.IC_MOVE_QUANTITY, dbo.KX_IC_MOVEMENTS_PRODCTN_IN_OUTS.PART_CODE,
                             dbo.KX_IC_MOVEMENTS_PRODCTN_IN_OUTS.PERIOD_TXT, dbo.KX_IC_MOVEMENTS_PRODCTN_IN_OUTS.YEAR_TXT,
                             dbo.KX_IC_MOVEMENTS_PRODCTN_IN_OUTS.TRANSACTION_TYPE, dbo.KX_IC_MOVEMENTS_PRODCTN_IN_OUTS.WAREHOUSE,
                             dbo.PRODUCT_MASTER.PRODUCT_CLASS, dbo.KX_PRODUCT_MASTER_EXT.PART_CODE AS KX_PART_CODE,
                             dbo.KX_PRODUCT_MASTER_EXT.PRODUCT_CLASS AS KX_PRODUCT_CLASS, dbo.IC_PRODUCT_CHARACTERISTICS.CHARACTERISTIC_CODE,
                             dbo.IC_PRODUCT_CHARACTERISTICS.IC_DEF_CHAR_TEXT
    FROM            dbo.MAN_JOBS INNER JOIN
                             dbo.IC_PRODUCT_CHARACTERISTICS ON dbo.MAN_JOBS.COMPANY_CODE = dbo.IC_PRODUCT_CHARACTERISTICS.COMPANY_CODE AND
                             dbo.MAN_JOBS.STD_PROCESS_SPEC = dbo.IC_PRODUCT_CHARACTERISTICS.PART_CODE LEFT OUTER JOIN
                             dbo.KX_PRODUCT_MASTER_EXT ON dbo.MAN_JOBS.STD_PROCESS_SPEC = dbo.KX_PRODUCT_MASTER_EXT.PART_CODE AND
                             dbo.MAN_JOBS.COMPANY_CODE = dbo.KX_PRODUCT_MASTER_EXT.COMPANY_CODE LEFT OUTER JOIN
                             dbo.KX_IC_MOVEMENTS_PRODCTN_IN_OUTS ON dbo.MAN_JOBS.COMPANY_CODE = dbo.KX_IC_MOVEMENTS_PRODCTN_IN_OUTS.COMPANY_CODE AND
                             dbo.MAN_JOBS.JOB_NUMBER = dbo.KX_IC_MOVEMENTS_PRODCTN_IN_OUTS.DOCUMENT_NUMBER LEFT OUTER JOIN
                             dbo.PRODUCT_MASTER ON dbo.KX_IC_MOVEMENTS_PRODCTN_IN_OUTS.COMPANY_CODE = dbo.PRODUCT_MASTER.COMPANY_CODE AND
                             dbo.KX_IC_MOVEMENTS_PRODCTN_IN_OUTS.PART_CODE = dbo.PRODUCT_MASTER.PART_CODE
    WHERE        (dbo.IC_PRODUCT_CHARACTERISTICS.CHARACTERISTIC_CODE = N'TEXT')

  • Sql commands

    I was wondering if any could give me templates or advice about these three things i have to write sql commands for
    Create SQL queries to do the following :
    1) List the names of all the staff in the electronic analysis department.
    2) List all the Part-time staff working for the company.
    3) Find which department has the largest annual budget and what it is.
    Any help would be gratefully recieved

    We could guess at things like this.
    Create SQL queries to do the following :
    1) List the names of all the staff in the electronic analysis department.SELECT staff_names
    FROM staff
    WHERE department = 'electronic analysis';
    2) List all the Part-time staff working for the
    company.SELECT *
    FROM staff
    WHERE part_time = 'Y';
    3) Find which department has the largest annual
    budget and what it is.SELECT *
    FROM department
    WHERE annual_budget = (SELECT MAX(annual_budget) FROM department);
    But of course we don't know the table structures so it could vary drastically.
    The thing with homework questions is that you can get someone else to do them for you, but if you don't really understand how it's working then you WILL be found out.

  • Csv to sql commands

    hi ,
    I am using the below file to convert my csv file to sql commands. I am currently trying to update the contents of the stationary csv. So i replace the existing stationary csv with the new stationary csv, then run the make-sql.sh which creates an oracle compatable sql script all.sql....now my problem is that this all.sql is not getting updated right. i.e. when i compare the csv file and the all.sql there are fields that hold different data...pls let me know what cld be causing this....
    make-sql.sh
    #!/bin/sh
    GX_ROOTDIR=/apps/iasdev06/ias6/ias
    JAVA_HOME=/apps/iasdev06/ias6/ias/usr/java
    RMI_IIOP_HOME=${GX_ROOTDIR}/orbtools
    PATH=${JAVA_HOME}/bin:$PATH
    CLASSPATH=$GX_ROOTDIR/classes/java/ktjdk11.jar:$GX_ROOTDIR/classes/java/kadmin.jar:$JAVA_HOME/lib/tools.jar
    CLASSPATH=$GX_ROOTDIR/classes/java/ldapjdk.jar:$GX_ROOTDIR/classes/java/SWING.JAR:$GX_ROOTDIR/ias/APPS:$GX_ROOTDIR/APPS:$JAVA_HOME/jre/lib/rt.jar:$CLASSPATH
    CLASSPATH=$GX_ROOTDIR/classes/java/jdbc20.jar:$GX_ROOTDIR/classes/java/javax.jar:$GX_ROOTDIR/classes/java/kfcjdk11.jar:$GX_ROOTDIR/classes/java:$JAVA_HOME/lib/classes.zip:$CLASSPATH
    CLASSPATH=$GX_ROOTDIR/classes/java/servlet.jar:$CLASSPATH
    PKG=com.dupont.refrigerants.distributorlocator
    cd ../..
    SOURCE=`pwd`
    GENERATE_SQL=$JAVA_HOME/bin/java\ -classpath\ ${SOURCE}/build/lib/classes:${CLASSPATH}\ -Djava.compiler=NONE\ ${PKG}.DistributorDBABeanImpl\$GenerateInsertFromCSV
    cat < ${SOURCE}/buildscripts/datasource/prolog.sql > all.sql
    ${GENERATE_SQL} ${SOURCE}/buildscripts/datasource/stationary.csv 1 US | sort | uniq >> all.sql
    ${GENERATE_SQL} ${SOURCE}/buildscripts/datasource/canada.csv 1 CA | sort | uniq >> all.sql
    ${GENERATE_SQL} ${SOURCE}/buildscripts/datasource/mobile.csv 2 US | sort | uniq >> all.sql

    Hi,
    What you are doing here is, generating some data with prolog.sql and then, your main logic to csv to sql is in the Java program GenerateInsertFromCSV.java .
    So, you need to find out the logic of that code. The shell script is not doing anything apart from calling the Java code.
    Have a deep look into the same.
    Regards

  • Problem creating a SQL command object and adding it to a Crystal report

    Hi,
    I'm trying to add the following SQL command object with the following sql for MYSQL 5.1
    SELECT lic.id, lic.productionname, comp.companyname, lic.paymentreceiveddate, lic.licenseissuedate,
    IFNULL((SELECT sum(licsong.feequoted) from licensesong licsong where licsong.licenseid = lic.id), 0) as totalfeequoted,
    IFNULL((SELECT sum(licsong.feetax) from licensesong licsong where licsong.licenseid = lic.id), 0) as totalfeetax,
    IFNULL((SELECT sum(licsong.feequoted + licsong.feetax) from licensesong licsong where licsong.licenseid = lic.id), 0) as totalfee,
    IFNULL((SELECT sum(pay.fullamount) from payment pay where pay.licenseid = lic.id),0) as totalpaid
    FROM license lic
    INNER JOIN company comp on lic.licensecompanyid= comp.id;
    This sql runs fine in the Query Browser of mysql and returns what I want.
    When I try to add this SQL command to a new Crystal Report, (by right clicking in the sql editor and selecting Crystal Reports - Add to new Crystal Report), it locks up my Eclipses and it ends up not responding. If I just do a simple SELECT * FROM license it works fine.
    The Eclipse I'm using is from the CR4E download page with the crystal plugin already installed.
    Any help with this would be greatful, as I am not having much joy with this CR4E 2.0 with MySQL and may have to scrap it and go back creating reports in Apache POI.
    Any help greatly received.
    Kind regards

    Hi,
    Try to select a particular columns instead of doing SELECT * FROM license.
    Thanks,
    Saravanakumar

  • How to create backup using sql commands

    can i create a backup using sql/sqlplus commands

    I would actually advice you to use RMAN, instead of backup using sql commands, but if you want or have a requirment to do so..
    First off all you should ensire that your databasse is in archilog mode.. (ALL PRODUCTION DATABASES should be in archivelog mode)
    you can do it using sql*plus
    archive log list
    Then if you would like to make a cold backup (the only one posible in noarchivelog mode)
    ypu have to
    shutdown immediate
    copy all database files (you don't need to copy redo logs) to another device
    startup - to startup database
    Actually I will suggest that your read User manager Recovery guide from oracle documentation
    tahiti.oracle.com
    Best Regards
    Krystian Zieja / mob

  • How do i get a output in CSV of a SQL query executed via SQL Command prompt

    Hi All,
    I have a question with reference to SQL command prompt. I have a sql query which runs properly and gives proper execution in SQL Management console in GUI.
    This report is used to pull the free disk space report of our servers
    As i want to schedule it as a report so i want to script it to run via SQL command prompt. I made the script and it works fine if i enter it in SQL command prompt. When i try to extract the output to a CSV File it fails. Below is the details of the command
    i am using to query to pull the data. Can anyone help me in getting the output of this query in SQL command prompt.
    sqlcmd -W -s , -S Servers FQDN
    use operationsmanager
    Go
    Query:"select Path, InstanceName, SampleValue 
    from PerformanceDataAllView pdv with (NOLOCK)
    inner join PerformanceCounterView pcv on pdv.performancesourceinternalid = pcv.performancesourceinternalid
    inner join BaseManagedEntity bme on pcv.ManagedEntityId = bme.BaseManagedEntityId
    where SampleValue < '20' and CounterName='% Free Space' and TimeSampled > '2014-08-06 11:00:00.00'
    order by countername, timesampled" -s "," -o "C:\DataSqlCmd.csv"
    Go
    When i enter the command without the quotes when the query is starting and ending and also without the output command (-s "," -o "C:\DataSqlCmd.csv") it is working and shows the output in the command prompt. Below is the screen shot for
    your reference.
    Due to security reasons i have to erase the server names:
    But when i add the line to extract the output ( -s "," -o "C:\DataSqlCmd.csv") It gives me this error:
    The exact command would be:
    sqlcmd -W -s , -S CINMLVSCOM01.e2klab.ge.com
    use operationsmanager
    Go
    "select Path, InstanceName, SampleValue 
    from PerformanceDataAllView pdv with (NOLOCK)
    inner join PerformanceCounterView pcv on pdv.performancesourceinternalid = pcv.performancesourceinternalid
    inner join BaseManagedEntity bme on pcv.ManagedEntityId = bme.BaseManagedEntityId
    where SampleValue < '20' and CounterName='% Free Space' and TimeSampled > '2014-08-06 11:00:00.00'
    order by countername, timesampled" -s "," -o "C:\DataSqlCmd.csv" -h-1
    Go
    saying the syntax is not correct or some thing as per the below screenshot.
    Can any one please help. Below is just the query whi i use to get the output in SQL management studio.
    Can any one make a command for the below quer so i can directly execute and test for getting the output.
    select Path, InstanceName, SampleValue 
    from PerformanceDataAllView pdv with (NOLOCK)
    inner join PerformanceCounterView pcv on pdv.performancesourceinternalid = pcv.performancesourceinternalid
    inner join BaseManagedEntity bme on pcv.ManagedEntityId = bme.BaseManagedEntityId
    where SampleValue < '20' and CounterName='% Free Space' and TimeSampled > '2014-08-06 11:00:00.00'
    order by countername, timesampled
    Gautam.75801

    Can you try the below query?
    select Path, InstanceName, SampleValue
    from PerformanceDataAllView pdv with (NOLOCK)
    inner join PerformanceCounterView pcv on pdv.performancesourceinternalid = pcv.performancesourceinternalid
    inner join BaseManagedEntity bme on pcv.ManagedEntityId = bme.BaseManagedEntityId
    where SampleValue < 20 and CounterName like '% Free Space' and TimeSampled > '2014-08-06 11:00:00.00'
    order by countername, timesampled
    -- replace the below query part in the below SQLCMD C:\>SQLCMD -S SERVERNAME -E -d operationsmanager -Q "select * from sys.databases ds with (nolock) where name='master'" -s "," -o "F:\PowerSQL\MyData.csv" -h -1
    SQLCMD -S SERVERNAME -E -d OperationsManager -Q "select Path, InstanceName, SampleValue
    from PerformanceDataAllView pdv with (NOLOCK)
    inner join PerformanceCounterView pcv on pdv.performancesourceinternalid = pcv.performancesourceinternalid
    inner join BaseManagedEntity bme on pcv.ManagedEntityId = bme.BaseManagedEntityId
    where SampleValue < '20' and CounterName='% Free Space' and TimeSampled > '2014-08-06 11:00:00.00'
    order by countername, timesampled" -s "," -o "c:\MyData.csv" -h -1
    Refer for the other ways 
    http://dba.stackexchange.com/questions/23566/writing-select-result-to-a-csv-file
    --Prashanth

  • Beginners tip: create new schema without SQL command

    Hey, i know this sounds so beginner's, but can i create a new Schema in which I can create tabels and tables.. without using SQL commands, I mean from the GUI of Oracle 9i?

    When I try to create any table under the new Schema (User) i keep on getting the
    message: No Privellage on USERS namespace...this is why us old lags on so down on GUIs. Because they generate the SQL for you you will acquire no understanding of how the database really works. Honestly you would be better off reading the concepts guide and writing some raw SQL for yourself.
    Cheers, APC

  • Mixing SQL Command parameters and UI created parameters

    Post Author: shecter
    CA Forum: Data Connectivity and SQL
    I'm using Crystal Reports XI.  I've created a report with an SQL Command - no other tables or views. I want to allow my users to be able to choose data from a dynamic parameter and have the SQL read that and spit out the results. I was able to add a parameter to the SQL using the Parameter column in the Command window. This allows my user to type in a parameter. However, when I run the report after creating a parameter using the UI (i.e. Field Explorer/Parameters/right clicking and selecting "new" and then adding the parameter to a field using the selection wizard), i first get a screen that shows me the parameter that I created in the SQL Command window, then I get a screen that shows me the UI created parameters. How can I make it show only one screen with all the parameters?  -Marc 

    Post Author: jenxia
    CA Forum: General
    SQL Command is :
    SELECT UNIQUE ContactID,  incomingAddress,applicationid,
    MediaStatus, MediaDirection, EndDateTime, StartDateTime
    FROM MMCAContactMediaViewwhere EndDateTime>= {?1-reportstarttime}  and  EndDateTime <= {?2-reportendtime}
    Order by ContactID
    Select formula using dynamic prompts as
    {Command.contactid} = {?ContactID} and{Command.applicationid} = {?ApplicationID} and{Command.incomingaddress} = {?IncomingAddress}

  • Working With Two External Files With T-SQL Commands

    Hi friends,
    In a VSTO Excel AddIn of mine I have come across a need to use T-SQL commands before bringing the dataset on the activesheet, derived from two tables in the shape of external CSV files. However,
    since using SQL Express in this regard requires connection to a server. With Visual Studio as well as SSMS installed on my laptop I'm able to use the said facility but I am unable to distribute such an addin to other team members not having any of the studios
    installed nor access to any server.
    Is there any way to use the similar features on the users' side?
    In other words, how to develop a macro, for example, in which I could consider two CSV files as two different tables as in a database, and carryout some T-SQL functions/commands on the same like:
    UNION of first three columns from both the tables;
    Creating a temporary table with the DISTINCT sets of the said three columns; and
    Then carryout LEFT JOINS between the new table and the earlier two tables;
    to derive a simple comparative dataset?
    Looking forward for you experts' valuable advices in this regard.
    Thanx in advance.
    Thanx in advance, Best Regards, Faraz A Qureshi

    Hi FARAZ,
    As with Excel files, you can also use Odbc driver to connect to CSV files. As long as the user's machine installs the ODBC driver, you can OdbcConnection to connect to the CSV files.
    The sample code to manimulate CSV files with ODBC driver(C#):
    string connectionString = @"Driver={Microsoft Text Driver (*.txt; *.csv)}; Dbq=C:\; Extensions=asc,csv,tab,txt;";
    using (OdbcConnection conn = new OdbcConnection(connectionString))
    conn.Open();
    string sql = "SELECT u.UserName,u.Age,c.Phone,c.Address FROM user.csv u left join contact.csv c on u.Id=c.UserId";
    using (OdbcCommand cmd = new OdbcCommand(sql, conn))
    But if you want to publish the Add-in to the user's machine, you still need to install the .Net Framework and the VSTO runtime to support the Add-in.
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Possible to change the datasource from a business-view to a Sql Command ?

    Hello,
    When a business view contains a lot of elements it takes a while just to open the report.
    We'd like to keep the BV as the dictionnary, but,
    once the report design completed,
    we'd like to disconnect the business view and replace it by the Sql command which can be seen in the menu option 'show SQL query'.
    Is it possible via the RAS sdk ?
    Did somebody experience this ?
    How to proceed ?
    Thanks a lot
    Alain

    Hi Ted,
    I'm thinking opening a Case for this problem of opening reports based on a big BV.
    We can't really reduce the BV, since it is the dictionnary and we need the whole thing...
    I'm wondering why it is impossible to change the Datasource if the tables and fields underneath are identical.
    Is it impossible to change the fields' mapping ?
    The other solution, as you suggest, is to create a report from scratch, create a new Datasource with the Sql command format, and rebuild the report... I agree it looks like a big job...
    Do you know if it is possible to export the report in XML for instance, change the XML, and then re-import ?
    Thanks for your Help.
    Alain

  • Delete table in SQL command

    Hello,
    As part of my report I populate a table then reference it in several following subreports.
    The issue I'm having is that I need to clear all the data from my table after using it to allow the report to run again (and not get multiple results)
    To do this I have tried to add a sub report at the very end (and start) of my report with the SQL command truncate table <tablename> or delete <tablename> or delete <tablename> where 1 = 1.
    When I try truncate I get an error saying that I don't have permission (despite granting it but hey...) which is why I switched to delete, this runs fine but the table doesn't get deleted...
    Any thoughts as to why this isn't working/how I can clear my table? I have thought of setting up a separate scheduled job to delete the table contents however I do also need to run the report several times with different parameters so this isn't an ideal solution.
    I have tried adding a select after my delete statement as I thought if it had something to display on the report it would have to look at it but this didn't make any difference.
    Any help will be much appreciated!
    Thanks
    Chris

    Thanks for that!
    I have had a go at this and I can see how it will work although I have limited access on the Crystal userid I have so will need to have the SP created as part of our nightly refresh script I think.
    Is there no way of getting crystal to run my delete statement otherwise?
    Thanks again
    Chris

  • How can I search multiple columns in a SQL command of Union tables

    Hi:
    We have a database with tables that are nearly identical that we use for production and production history.
    I have created an SQL command in Crystal 2008 to joins several of the tables and then added a "UNION" to connect the History and Prod tables.
    I need to search multiple (3 total) columns for 5 different data types, to return the records being investigated. I tried this using an "OR" statement in the where clause and have had inconsistant results.
    The first two or statement function perfectly the third works as long as the value being passed is numeric and the last two fail consistantly with invalid column name errors. It appears that crystal is getting confused and passing the wrong data type especially if I do a new search using a different option for the "?SearchParam"
    Can some one offer some insite on how I can search these fields to return the record data needed
    -- {?SearchParam} is the search parameter passed by Crystal that is a number 1 thru 5
    -- {?Search_Val} is a parameter that is passed by Crystal that is a string of what to search for 1 = Numeric CMP ord #("TBSLI21"."LI21_OR_NO"), 2 = Numeric CI ord # ( "TBSLI33"."LI33_CI_OR_NO"),
    --   3 =String  Ext Sys ord string ("TBSLI33"."LI33_EXT_SYS_SL_OR_NO"), 4 = String CMP Grp string ("TBSLI21"."LI21_OP_GRP_NO"), 5 = composit string PP ord string ("TBSOP13"."OP13_CLR_DAY" & "TBSOP13"."OP13_PP_GRP_SEQ_NO" & "TBSOP13"."OP13_CELL_ID")
    SELECT "TBSLI21"."LI21_OR_NO",
    "TBSLI21"."LI21_SH_DT_SCDL",
    "TBSLI21"."LI21_TS_EN_ORIG",
    "TBSLI21"."LI21_TS_SHIP",
    "TBSLI21"."LI21_SYS_ORD_CD",
    "TBSLI21"."LI21_SHIP_ID",
    "TBSLI21"."LI21_WRKST_ID",
    "TBSLI21"."LI21_LI_NO",
    "TBSLI33"."LI33_CI_OR_NO",
    "TBSLI33"."LI33_EXT_SYS_SL_OR_NO",
    "TBSLI21"."LI21_OP_GRP_NO",
    "TBSLI21"."LI21_LI_STAT",
    "TBSOP13"."OP13_OP_GRP_STAT",
    "TBSLI31"."LI31_LI_EV_DTL_TX",
    "TBSLI31"."LI31_DT_EN",
    "TBSLI31"."LI31_TM_EN",
    "TBSLI31"."LI31_LI_EV",
    "TBSLI21"."LI21_OP_WSH_FLNM",
    "TBSLI21"."LI21_PR_ITF_CD",
    "TBSLI21"."MFG_PLANT_CD",
    "MFG_PLANT_LI"."MFG_PLANT_CD" as PrefPlant,
    "TBSOP13"."OP13_OP_GRP_DSP_CD",
    "TBSLI21"."LI21_LI_DSP_CD",
    "TBSOP13"."OP13_CLR_DAY",
    "TBSOP13"."OP13_PP_GRP_SEQ_NO",
    "TBSOP13"."OP13_CELL_ID",
    "MFG_PLANT_LI"."PRFR_MFG_PLANT_FLG",
    "TBSLI21"."LI21_OP_GRP_PS_NO1",
    "TBSLI21"."LI21_POMS_MERGE_NO",
    "TBSLI31"."LI31_OP_ID",
    "TBSLI21"."LI21_LI_POR_FG",
    "TBSLI21"."LI21_BIN_ID",
    "TBSLI21"."LI21_TS_MRSHL",
    "TBSLI33"."LI33_CI_LI_NO",
    "TBSLI33"."LI33_SH_ADDR_1",
    "TBSLI33"."LI33_SH_ADDR_2",
    "TBSLI33"."LI33_SH_ADDR_3",
    "TBSLI33"."LI33_SH_ADDR_4",
    "TBSLI33"."LI33_SH_CITY_NM",
    "TBSLI33"."LI33_SH_ST_NM",
    "TBSLI33"."LI33_SH_ZIP_CD",
    "TBSLI33"."LI33_CU_NM",
    "TBSLI33"."LI33_CU_BUS_NM"
    FROM   ((("CMPREPORTING"."dbo"."TBSLI33" "TBSLI33" FULL OUTER JOIN "CMPREPORTING"."dbo"."TBSLI21" "TBSLI21" ON ("TBSLI33"."LI33_BS_OR_NO"="TBSLI21"."LI21_OR_NO") AND ("TBSLI33"."LI33_BS_LI_NO"="TBSLI21"."LI21_LI_NO")) LEFT OUTER JOIN "CMPREPORTING"."dbo"."TBSOP13" "TBSOP13" ON "TBSLI21"."LI21_OP_GRP_NO"="TBSOP13"."OP13_OP_GRP_NO") LEFT OUTER JOIN "CMPREPORTING"."dbo"."TBSLI31" "TBSLI31" ON ("TBSLI21"."LI21_OR_NO"="TBSLI31"."LI31_OR_NO") AND ("TBSLI21"."LI21_LI_NO"="TBSLI31"."LI31_LI_NO")) LEFT OUTER JOIN "CMPREPORTING"."dbo"."MFG_PLANT_LI" "MFG_PLANT_LI" ON ("TBSLI21"."LI21_OR_NO"="MFG_PLANT_LI"."OR_NO") AND ("TBSLI21"."LI21_LI_NO"="MFG_PLANT_LI"."LI_NO")
    WHERE   {?aSearchParam} = 1 and "MFG_PLANT_LI"."PRFR_MFG_PLANT_FLG"='Y' AND "TBSLI21"."LI21_OR_NO"=Cast( {?Search_Val} as Int)
    or {?aSearchParam} = 2 and "MFG_PLANT_LI"."PRFR_MFG_PLANT_FLG"='Y' AND "TBSLI33"."LI33_CI_OR_NO"=Cast( {?Search_Val} as numeric(12,0))
    or {?aSearchParam} = 3 and "MFG_PLANT_LI"."PRFR_MFG_PLANT_FLG"='Y' AND Convert( VarChar(20),"TBSLI33"."LI33_EXT_SYS_SL_OR_NO")= Convert( VarChar(20), {?Search_Val})
    or {?aSearchParam} = 4 and "MFG_PLANT_LI"."PRFR_MFG_PLANT_FLG"='Y' AND Convert( VarChar(8),"TBSLI21"."LI21_OP_GRP_NO") = Convert( VarChar(8), {?GroupNo})
    or {?aSearchParam} = 5 and "MFG_PLANT_LI"."PRFR_MFG_PLANT_FLG"='Y' AND Convert( VarChar(8), ("TBSOP13"."OP13_CLR_DAY" & "TBSOP13"."OP13_PP_GRP_SEQ_NO" & "TBSOP13"."OP13_CELL_ID")) = Convert( VarChar(8), {?GroupNo})
    Union
    SELECT "TBSLI21_HIST"."LI21_OR_NO",
    "TBSLI21_HIST"."LI21_SH_DT_SCDL",
    "TBSLI21_HIST"."LI21_TS_EN_ORIG",
    "TBSLI21_HIST"."LI21_TS_SHIP",
    "TBSLI21_HIST"."LI21_SYS_ORD_CD",
    "TBSLI21_HIST"."LI21_SHIP_ID",
    "TBSLI21_HIST"."LI21_WRKST_ID",
    "TBSLI21_HIST"."LI21_LI_NO",
    "TBSLI33_HIST"."LI33_CI_OR_NO",
    "TBSLI33_HIST"."LI33_EXT_SYS_SL_OR_NO",
    "TBSLI21_HIST"."LI21_OP_GRP_NO",
    "TBSLI21_HIST"."LI21_LI_STAT",
    "TBSOP13_HIST"."OP13_OP_GRP_STAT",
    "TBSLI31_HIST"."LI31_LI_EV_DTL_TX",
    "TBSLI31_HIST"."LI31_DT_EN",
    "TBSLI31_HIST"."LI31_TM_EN",
    "TBSLI31_HIST"."LI31_LI_EV",
    "TBSLI21_HIST"."LI21_OP_WSH_FLNM",
    "TBSLI21_HIST"."LI21_PR_ITF_CD",
    "TBSLI21_HIST"."MFG_PLANT_CD",
    "MFG_PLANT_LI_HIST"."MFG_PLANT_CD",
    "TBSOP13_HIST"."OP13_OP_GRP_DSP_CD",
    "TBSLI21_HIST"."LI21_LI_DSP_CD",
    "TBSOP13_HIST"."OP13_CLR_DAY",
    "TBSOP13_HIST"."OP13_PP_GRP_SEQ_NO",
    "TBSOP13_HIST"."OP13_CELL_ID",
    "MFG_PLANT_LI_HIST"."PRFR_MFG_PLANT_FLG",
    "TBSLI21_HIST"."LI21_OP_GRP_PS_NO1",
    "TBSLI21_HIST"."LI21_POMS_MERGE_NO",
    "TBSLI31_HIST"."LI31_OP_ID",
    "TBSLI21_HIST"."LI21_LI_POR_FG",
    "TBSLI21_HIST"."LI21_BIN_ID",
    "TBSLI21_HIST"."LI21_TS_MRSHL",
    "TBSLI33_HIST"."LI33_CI_LI_NO",
    "TBSLI33_HIST"."LI33_SH_ADDR_1",
    "TBSLI33_HIST"."LI33_SH_ADDR_2",
    "TBSLI33_HIST"."LI33_SH_ADDR_3",
    "TBSLI33_HIST"."LI33_SH_ADDR_4",
    "TBSLI33_HIST"."LI33_SH_CITY_NM",
    "TBSLI33_HIST"."LI33_SH_ST_NM",
    "TBSLI33_HIST"."LI33_SH_ZIP_CD",
    "TBSLI33_HIST"."LI33_CU_NM",
    "TBSLI33_HIST"."LI33_CU_BUS_NM"
    FROM   ((("CMPREPORTING"."dbo"."TBSLI33_HIST" "TBSLI33_HIST" FULL OUTER JOIN "CMPREPORTING"."dbo"."TBSLI21_HIST" "TBSLI21_HIST" ON ("TBSLI33_HIST"."LI33_BS_OR_NO"="TBSLI21_HIST"."LI21_OR_NO") AND ("TBSLI33_HIST"."LI33_BS_LI_NO"="TBSLI21_HIST"."LI21_LI_NO")) LEFT OUTER JOIN "CMPREPORTING"."dbo"."TBSOP13_HIST" "TBSOP13_HIST" ON "TBSLI21_HIST"."LI21_OP_GRP_NO"="TBSOP13_HIST"."OP13_OP_GRP_NO") LEFT OUTER JOIN "CMPREPORTING"."dbo"."TBSLI31_HIST" "TBSLI31_HIST" ON ("TBSLI21_HIST"."LI21_OR_NO"="TBSLI31_HIST"."LI31_OR_NO") AND ("TBSLI21_HIST"."LI21_LI_NO"="TBSLI31_HIST"."LI31_LI_NO")) LEFT OUTER JOIN "CMPREPORTING"."dbo"."MFG_PLANT_LI_HIST" "MFG_PLANT_LI_HIST" ON ("TBSLI21_HIST"."LI21_OR_NO"="MFG_PLANT_LI_HIST"."OR_NO") AND ("TBSLI21_HIST"."LI21_LI_NO"="MFG_PLANT_LI_HIST"."LI_NO")
    WHERE  {?aSearchParam} = 1 and "MFG_PLANT_LI_HIST"."PRFR_MFG_PLANT_FLG"='Y' AND "TBSLI21_HIST"."LI21_OR_NO"= Cast( {?Search_Val} as Int)
    or {?aSearchParam} = 2 and  "MFG_PLANT_LI_HIST"."PRFR_MFG_PLANT_FLG"='Y' AND "TBSLI33_HIST"."LI33_CI_OR_NO"= Cast( {?Search_Val} as numeric(12,0))
    or {?aSearchParam} = 3 and  "MFG_PLANT_LI_HIST"."PRFR_MFG_PLANT_FLG"='Y' AND Convert( VarChar(20), "TBSLI33_HIST"."LI33_EXT_SYS_SL_OR_NO")= Convert( VarChar(20),{?Search_Val})
    or  {?aSearchParam} = 4 and "MFG_PLANT_LI_HIST"."PRFR_MFG_PLANT_FLG"='Y' AND Convert( VarChar(8),"TBSLI21_HIST"."LI21_OP_GRP_NO")= Convert( VarChar(8), {?GroupNo} )
    or {?aSearchParam} = 5 and  "MFG_PLANT_LI_HIST"."PRFR_MFG_PLANT_FLG"='Y' AND Convert( VarChar(8), ("TBSOP13_HIST"."OP13_CLR_DAY" & "TBSOP13_HIST"."OP13_PP_GRP_SEQ_NO" & "TBSOP13_HIST"."OP13_CELL_ID")) = Convert( VarChar(8), {?GroupNo})

    This is actually a fairly easy fix - because of the way the "OR" works in SQL, you need to surround each "set" of statements in the or with parentheses.  So, it would look something like this:
    Where
    ({?aSearchParam} = 1 and "MFG_PLANT_LI"."PRFR_MFG_PLANT_FLG"='Y' AND "TBSLI21"."LI21_OR_NO"=Cast( {?Search_Val} as Int))
    or
    ({?aSearchParam} = 2 and "MFG_PLANT_LI"."PRFR_MFG_PLANT_FLG"='Y' AND "TBSLI33"."LI33_CI_OR_NO"=Cast( {?Search_Val} as numeric(12,0)))
    or
    ({?aSearchParam} = 3 and "MFG_PLANT_LI"."PRFR_MFG_PLANT_FLG"='Y' AND Convert( VarChar(20),"TBSLI33"."LI33_EXT_SYS_SL_OR_NO")= Convert( VarChar(20), {?Search_Val}))
    or
    ({?aSearchParam} = 4 and "MFG_PLANT_LI"."PRFR_MFG_PLANT_FLG"='Y' AND Convert( VarChar(8),"TBSLI21"."LI21_OP_GRP_NO") = Convert( VarChar(8), {?GroupNo}))
    or
    ({?aSearchParam} = 5 and "MFG_PLANT_LI"."PRFR_MFG_PLANT_FLG"='Y' AND Convert( VarChar(8), ("TBSOP13"."OP13_CLR_DAY" & "TBSOP13"."OP13_PP_GRP_SEQ_NO" & "TBSOP13"."OP13_CELL_ID")) = Convert( VarChar(8), {?GroupNo}))
    -Dell

  • How to execute stored procedure in the SQL Commands page

    i'm oracle express edition newbie :) i have this stored procedure. it not belong to a package.
    create or replace procedure "LIST_MEMBERS"
    ("MEMBER_CUR" OUT SYS_REFCURSOR)
    is
    begin
    OPEN MEMBER_CUR FOR
    SELECT * FROM members;
    end;
    now, in the SQL Commands page, how to run the stored procedure and return the records. i do this:
    begin
    execute list_members();
    end;
    but i'm getting some errors. just need some immediate help :) thanks!!!

    Example of using a ref cursor:
    SQL> ed
    Wrote file afiedt.buf
      1  create or replace procedure open_cur(c IN OUT SYS_REFCURSOR) is
      2  begin
      3    open c for 'select rownum rn from dual connect by rownum <= 10';
      4* end;
    SQL> /
    Procedure created.
    SQL> ed
    Wrote file afiedt.buf
      1  declare
      2    c     SYS_REFCURSOR;
      3    v_val NUMBER;
      4  begin
      5    open_cur(c);
      6    loop
      7      fetch c INTO v_val;
      8      exit WHEN c%NOTFOUND;
      9      dbms_output.put_line(v_val);
    10    end loop;
    11    close c;
    12* end;
    SQL> /
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    PL/SQL procedure successfully completed.
    SQL>

Maybe you are looking for

  • Shopping Cart creation with reference to Backend Contract

    Dear Experts, We are working in SRM 7.0 Classic Scenario. We have Backend Contract with document type PCTR which is available as Source of Suppliy when creating Shopping cart. I can use this contracts as source of supply but the issue is when the Sho

  • Distinct Count of Non-null Values

    I have a table that has one column for providerID and then a providerID in each of several columns if the provider is under a particular type of contract.  I need a distict count of each provider under each type of contract for every county in the US

  • My iphone4 photos show up as .rtfd files

    When I upload photos from my iphone to my mac the files show up as .rtfd not jpeg. This happens regardless of where I save the file; desktop or iphoto. I'm sure I am doing something wrong here as this just doesn't seem logical. Any guidance would be

  • SQLPlus Help

    Hello: When I tried the following: SQLPlus sys/<password>@<dbname>, I get the following error: ERROR: ORA-28009: connection to sys should be as sysdba or sysoper Can somebody tell me what the syntax is to log in with the account SYS? Thanks.

  • Limit to Vector Smart Objects?

    Is there a practical limit to the number of Vector Smart Object that can be effectively used in a photoshop document?