Exporting the results of a query into excel
Hi,
Here's my code for exporting a cfm page into a spreadsheet:
<cfsetting enablecfoutputonly="Yes">
<cfcontent type="application/msexcel">
<cfheader name="Content - Disposition" value="filename=myReport.xls">
<cfquery name="getInfo" datasource="#dsn#">
SELECT id, fname, lname, orgname, email, phone, topic, synopsis, pdf, expertise, fiscal_year, date_added
FROM table
</cfquery>
<table border="1" cellspacing="1">
<tr>
<td>EFRI 2011 Submissions (Total Submissions: <cfoutput>#getInfo.recordcount#</cfoutput>)</td>
</tr>
<tr>
<td>Record Number:</td><td>Last Name</td><td>First Name</td><td>E-mail</td>
<td>Phone</td>
<td>Organization</td>
<td>Expertise</td>
</tr>
<cfoutput query="getInfo">
<tr>
<td>#currentRow#. #lname#</td>
<td>#fname#</td>
<td>#email#</td>
<td>#phone#</td>
<td>#orgname#</td>
<td>#expertise#</td>
</tr>
</cfoutput>
</table>
and here's the error that I'm getting. What is wrong with the code?
500
Corrupt form data: no leading boundary: != -----------------------------7d96c1140276
java.io.IOException: Corrupt form data: no leading boundary: != -----------------------------7d96c1140276
at com.oreilly.servlet.multipart.MultipartParser.<init>(MultipartParser.java:174)
at com.oreilly.servlet.multipart.MultipartParser.<init>(MultipartParser.java:93)
at coldfusion.filter.FormScope.fillMultipart(FormScope.java:136)
at coldfusion.filter.FusionContext.SymTab_initForRequest(FusionContext.java:428)
at coldfusion.filter.GlobalsFilter.invoke(GlobalsFilter.java:33)
at coldfusion.filter.DatasourceFilter.invoke(DatasourceFilter.java:22)
at coldfusion.filter.RequestThrottleFilter.invoke(RequestThrottleFilter.java:126)
at coldfusion.CfmServlet.service(CfmServlet.java:175)
at coldfusion.bootstrap.BootstrapServlet.service(BootstrapServlet.java:89)
at jrun.servlet.FilterChain.doFilter(FilterChain.java:86)
at coldfusion.monitor.event.MonitoringServletFilter.doFilter(MonitoringServletFilter.java:42)
at coldfusion.bootstrap.BootstrapFilter.doFilter(BootstrapFilter.java:46)
at jrun.servlet.FilterChain.doFilter(FilterChain.java:94)
at jrun.servlet.FilterChain.service(FilterChain.java:101)
at jrun.servlet.ServletInvoker.invoke(ServletInvoker.java:106)
at jrun.servlet.JRunInvokerChain.invokeNext(JRunInvokerChain.java:42)
at jrun.servlet.JRunRequestDispatcher.invoke(JRunRequestDispatcher.java:284)
at jrun.servlet.ServletEngineService.dispatch(ServletEngineService.java:543)
at jrun.servlet.jrpp.JRunProxyService.invokeRunnable(JRunProxyService.java:203)
at jrunx.scheduler.ThreadPool$ThreadThrottle.invokeRunnable(ThreadPool.java:428)
at jrunx.scheduler.WorkerThread.run(WorkerThread.java:66)
try this
<cfsetting showdebugoutput="false">
<cfcontent type="application/msexcel">
<cfheader name="Content-Disposition" value="attachment; filename=myReport.xls">
Similar Messages
-
Procedure to save the output of a query into excel file or flat file
Procedure to save the output of a query into excel file or flat file
I want to store the output of my query into a file and then export it from sql server management studio to a desired location using stored procedure.
I have run the query --
DECLARE @cmd VARCHAR(255)
SET @cmd = 'bcp "select * from dbo.test1" queryout "D:\testing2.xlsx;" -U "user-PC\user" -P "" -c '
Exec xp_cmdshell @cmd
error message--
SQLState = 28000, NativeError = 18456
Error = [Microsoft][SQL Server Native Client 10.0][SQL Server]Login failed for user 'user-PC\user'.
NULL
Goel.AmanHello,
-T:
Specifies that the bcp utility connects to SQL Server with a trusted connection using integrated security. The security credentials of the network user,
login_id, and password are not required. If
–T is not specified, you need to specify
–U and –P to successfully log in.
-U:
Specifies the login ID used to connect to SQL Server.
Note: When the bcp utility is connecting to SQL Server with a trusted connection using integrated security, use the
-T option (trusted connection) instead of the
user name and password combination
I would suggest you take a look at the following article:
bcp Utility: http://technet.microsoft.com/en-us/library/ms162802.aspx
A similar thread regarding this issue:
http://social.msdn.microsoft.com/Forums/sqlserver/en-US/b450937f-0ef5-427a-ae3b-115335c0d83c/bcp-connection-error-sqlstate-28000-nativeerror-18456?forum=sqldataaccess
Regards,
Elvis Long
TechNet Community Support -
Extracting the result of a query into a internal table
Hi,
Does anyone knows or have an idea how to extract the result of a query into a internal table, is there a function module or BAPI?
Thanks in advance,
CKSo then normally I would use a statment like:
IFunctionTemplate ftemplate = repository.getFunctionTemplate("<b>BAPI_SALESORDER_GETLIST</b>");
to call a particluar function, but I tried using
IFunctionTemplate ftemplate = repository.getFunctionTemplate("<b>BAPI_MDDATAPROVIDERBW_GETCATALOGS</b>");
and it did not seem to work. I also tried -
IFunctionTemplate ftemplate = repository.getFunctionTemplate("<b>MDDataProviderBW.GetCatalogs</b>");
How do I format the function?
Thanks
Paul -
How can I export the results of a query?
After executing a select statement I can see the results in a grid but how can I export the results (the data)?
How can I export the results of a join of two or more tables?Right click in the results grid and select the Export menu option
-
How to spool the result of an query into a file in sql 2000
Hi All,
I have an SQL query which iterates through number of times for checking on some conditions and will return results each time. I wants to save the results into an different xml file each time. I tried using below query:
exec xp_cmdshell 'bcp "use Mimsadaptorlogs; select top 10 * from log order by logdate" queryout "D:\cdr_cg.xml" -T -c -t,' ---> Its not working as expected.
I got the Below output:
NULL
Starting copy...
SQLState = 01000, NativeError = 5701
Warning = [Microsoft][ODBC SQL Server Driver][SQL Server]Changed database context to 'MIMSAdaptorlogs'.
NULL
10 rows copied.
Network packet size (bytes): 4096
Clock Time (ms.): total 62
NULL
Could you anuone please suggest me on this.......
Thanks and Regards, BalaYou will need to write a client program to do this. SQL Server is not intended for writing files. People still do it by calling BCP through xp_cmdshell, but this is a dubious practice. Better is to write a CLR stored procedure for the task. However, you
are on SQL 2000, and the CLR support was added in SQL 2005. Furthermore, there is no XML type in SQL 2000, and the only way to generate XML is with the FOR XML clause. But this output is not well understood by BCP. Then I try: [code} bcp "SELECT * FROM Northwind..Customers
FOR XML RAW" queryout slask.bcp -c -T [/code] on SQL 2000, I get [code] 11 rows copied. [/code] which is complete hogwash, because there are 91 rows in that table, and the output should be a single XML document, and the output looks like this: [code] <row
CustomerID="ALFKI"... Bouchers" City="Marseil... tomerID="DUMON" Company... 0.32.21.21" Fax="40.32.... los Hern ndez" ContactT... n Steel" ContactTitle="... e" ContactTitle="Market... ="Salzburg" PostalCode=... " Phone="(21) 555-3412"... ty="Charleroi" PostalCo...
<row CustomerID="WARTH"... [/code] I have truncated the output on the right side, but the left side is authentic. It really is that bad.
Erland Sommarskog, SQL Server MVP, [email protected] -
Trying to Export the data from a webform into excel and unable do
when i try to export the dataform from the Planning web into excel, iam unable to export it iam able to export the member name but not the data values associated to it.
When i try to do the same by using the Mozilla, it works perfectly, iam unable to do it IE 6.
waiting for the Valuable Suggestions on this issue.
Regards.pls advise me on this issue.
-
How to Export The result of querry to Excel?
Hi ,
Can you tell me how can i export the result of a query is having to an excel or to any file in JDeveloper?
It is having 70 thousand records.Raphael is right, excl can£t load more then 65000 rows and from my experience using the excl export listener is too slow.
You can however use e.g. POI and generate a native exel file. Still the 65000 row limit is valid.
Timo -
Using Powershell Script Run simple query in MS Access 2007 and export the results of query to Excel
Hi Experts,
I have a Access 2007 DB file and 2 Big tables inside that (bigger than the size that can be easily handled by MS Excel 2007).
My requirement is automate using powershell scripts the below things.
1. Create a SQL query in Access DB and save that in access DB
2. Run the saved query and export the result in excel sheet where I can create the charts and Pivots. Thanks in advance
PrajeshDo you have to use the Access query, couldn't you just recreate the query in Powershell? Here's a link with good info that references an existing script for querying an Access database:
http://blogs.technet.com/b/heyscriptingguy/archive/2009/08/13/hey-scripting-guy-can-i-query-a-microsoft-access-database-with-a-windows-powershell-script.aspx
Once you have your dataset you can pipe it to
Export-Csv -NoType c:\pathtofile\output.csv -
How to export the result to excel or txt as the SQL result format.
Hello,
I want to know how to export the result of the Oracle select result to a txt or a excel file.What is the command.
I knew the command of spool,but the format of it export is not the same to the result of Oracle result area.
Thank you very much.Hello Yucky,
what do you mean by
the format of it export is not the same to the result of Oracle result areaDo you mean the output of a tool other than SQL*PLUS?
To enhance the formatting of a spool file you can set
SET MARKUP HTML ON
SPOOL ONthis will add html markup to format the output as a html table which you can open in a browser or in excel.
Regards
Marcus -
How to export the result from executing sql statement to excel file ?
HI all,
Great with Oracle SQL Developer, but I have have a trouble as follwing :
I want to export the result from executing sql statement to excel file . I do easily like that in TOAD ,
anyone can help me to do that ? Thanks so much
SigmasvnHello Sue,
I just tried to export to excel with the esdev extension and got java.lang.NumberFormatException. I found the workaround at Re: Windows Multi-language env, - how do I set English for application lang?
open the file sqldeveloper\jdev\bin\sqldeveloper.conf and add the following two lines:
AddVMOption -Duser.language=en
AddVMOption -Duser.country=USyet now my date formats in excel are 'american-style' instead of german. For example 01-DEC-01 so excel does not recognize it as date and therefore I can not simply change the format.
When export to excel will be native to 1.1 perhaps someone can have a look at this 'feature'
Regards
Marcus -
How to execute a procedure depending on the result of a query?
Hello, I'm new in ODI.
I want to execute a procedure depending on the result of a query Oracle table.
We have a Oracle Table whit a column that contains two possibles values.
I want read the table, row by row, and depending on this value, execute a Procedure or execute another.
How can i do?what you need to do is
1. create a variable which "new_var2" which has the count of the number of rows you want to process. must be data type numeric.
2. copy "new_var2" to the package screen.
3. duplicate the "new_var2" on the package screen and evaluate the variable and test for "> 0" zero, call it "new_var2_E"
3. create a new odi variable "new_var1" with a refresh of "select field1 fom (select field1,rownum as rownumber from tablex) where rownumber = #new_var2" in the relevant schema and technology.
4. copy "new_var1" into your package (some where in the flow)
5. right click the "new_var1" variable in you package screen and you should get the option duplicate step (click on that)
6. select the the duplicate "new_var1" on the package screen and correct the the name to something meaning full to you "new_var1_E", also change the "type" to "evaluate variable" then you should see a "value" box. enter one of the values you want to test in the box (remember do not put in quotes ' )
7. now back on the package screen join the "new_var1" to the "new_var1_E" with an OK line
8 you now join "new_var2" to "new_var2_E" with OK
9 you join "new_var2_E" to "new_var1"
10. you then join the "new_var1_E" with an OK or a KO line to the relevant procedure.
12. you need to duplicate "new_var2" in the package screen one more time this time and call it "new_var2_D" set the type to evaluate and then select the increment of -1
13. the relevant procedure to "new_var2_D" with an OK
14. join the "new_var2_D" to the "new_var2_E" with an OK
15. this should close off the loop now the exit point is "new_var2_E" with a KO line to the next part of your process....
Basically you should end up with a loop on new_var2 decementing, and it is used to get a specific next record row from your table.
Hope this helps, sorry it is a little long winded..
Edited by: DavidGD on Feb 8, 2009 3:29 PM -
How can we export the data from OAF Page to Excel instead of .csv or .txt
Hello,
How can we export the data from OAF Page to Excel instead of .csv or .txt
When i click on the export button it is exporting to txt file, But i need to export the data into Excel by default
Please help me
Thanks in advance
Thanks,
Raju
We have changed the below profile option to get the data in excel by default
Profile Name Export MIME type
Profile Code FND_EXPORT_MIME_TYPE+
Existing Value: text/tab-separated-values+
Change as: Excel
Thank you,
Raju
Edited by: 1006649 on May 21, 2013 10:55 AMWe have changed the below profile option to get the data in excel by default
Profile Name Export MIME type
Profile Code FND_EXPORT_MIME_TYPE+
Existing Value: text/tab-separated-values+
Change as: Excel
Thank you,
Raju -
How to export the Screens of dialog programming into notepad
Hi Guys,
Here I am having a requirement to copy the screens of dialog program into another SAP system.
So I have to export the screen along with coding into NOTEPAD.
I am able to copy the coding part, <b>but how to copy the screen into notepad</b>
Give me the appropriate answers.
I will award the points to the answersHi Chakra.
please take carte that a screen consists of layout, fields and flow logic. Get all components using this form routine (taken from excellent useful SAP report RPR_ABAP_SOURCE_SCAN):
Form GET_DYNPRO_FLOW_LOGIC
Get flow logic of the dynpro
form get_dynpro_flow_logic.
data: dhead like d020s,
dfield like d021s occurs 0,
dflow like d022s occurs 0,
dmatch like d023s occurs 0,
begin of dynp_id,
prog like d020s-prog,
dnum like d020s-dnum,
end of dynp_id.
dynp_id-prog = dyn-prog.
dynp_id-dnum = dyn-dnum.
import dynpro dhead dfield dflow dmatch id dynp_id.
rtab[] = dflow[].
endform. " GET_DYNPRO_FLOW_LOGIC
Regards,
Clemens -
I need return the result of a query on a stored procedure
I need return the result of a query on a stored procedure, I mean when I execute a stored procedure it returns a result set as a select query.
Best regards...If you want some pl/sql code that can be used in a query as it were a table you may be interested in table functions:
SQL> create or replace type
2 t_emp is object (
3 name varchar2(30),
4 hire_date date,
5 salary number);
6 /
Tipo creato.
SQL> create or replace type
2 t_emptab is table of t_emp;
3 /
Tipo creato.
SQL> create or replace function tab_fun(p_dept in number)
2 return t_emptab is
3 e t_emptab;
4 begin
5 select t_emp(ename,hiredate,sal)
6 bulk collect into e
7 from emp
8 where deptno=p_dept;
9
10 return dip;
11 end;
12 /
Funzione creata.
SQL> select *
2 from table(tab_fun(20));
NAME HIRE_DATE SALARY
SMITH 17-DIC-80 800
JONES 02-APR-81 2975
SCOTT 09-DIC-82 3000
ADAMS 12-GEN-83 1100
FORD 03-DIC-81 3000A procedure cannot be used in a select statement.
Max
http://oracleitalia.wordpress.com -
How do you use BOBJ SDK to retrieve the results of a query in XML
I am trying to programatically get the results of a query given the query id
My old code used BusinessObjects Enterprise Web Services API to Retrieve a document's contents
DocumentInformation biDocInfo;
RetrieveData retBOData = RetrieveData.Factory.newInstance();
Action[] actions = new Action[1];
retBOData.setRetrieveView(xmlView);
biDocInfo = rEngine.getDocumentInformation(queryId, null, actions, null, retBOData);
(XMLView) biDocInfo.getView();
Is there an equivalent way to retrieve the results of the query using SAP BusinessObjects BI 3.x Developer SDK Library ?
Thanks for any informationHello.
Are you wanting to use the BusinessObjects Enterprise SDK along with the Report Engine SDK as opposed to using the Web Services SDK that you were using previously?
Also, what part of a webi document are you trying to get the XML format of?
- Whole document
- Single report within a document
- Report page of a report
- Report part within a report
- All data providers
- Single data provider
If you are trying to use Business Objects Enterprise along with the Report Engine SDK, there are numerous samples for the various parts of the webi document that I mentioned above available at the following link:
http://wiki.sdn.sap.com/wiki/display/BOBJ/JavaReportEngineSDKSamples
I hope that this information helps.
Regards.
- Robert
Maybe you are looking for
-
Unable to generate Sales Report of Business Partner by State-XL Reporter
We are not able to generate Sales Report of Business Partner by State using XL Reporter. The issue is that we can not access the Bill to State for BPs, or for that matter the Ship-to State. We can access Bill T street, block, city, country u2013 ev
-
I have 2T imac running lion Can I re-partition and use one half as a back up disk?
Bought a new mac in November and it is refused to start up yesterday. Spoke with Apple and they said I should make sure I do regular back ups in case I l ose my hard drive?!?! I did a clean install of the Operating software but was advised to erase
-
I updated my system to run iTunes 10.5.2 and Mac OS X 10.5.8. That was the highest versions it would go.my phone won't connect to this version of iTunes. I tried downloading iTunes 10.7 but it won't run on my version of OS X. I tried updating OS X an
-
I am trying to match the following pattern: TIMEPAST=151:19:15.00 I have tried the following: Pattern pattern5 = Pattern.compile("(TIMEPAST)=(\\d*:\\d*:\\d*.\\d*)"); This has not worked as well as other patterns I have tried. Any suggestions greatly
-
How do I uninstall iWork?
How do I uninstall iWork?