Author |
Topic |
oracle_corrgi
Yak Posting Veteran
98 Posts |
Posted - 2007-01-08 : 07:43:55
|
hii need to run a big query say 50line query which gives me 5 output 2943 Records, Jan 5 2007 1:23AM 197 Records, Feb 28 2006 1:00PM No DataNo Data1 Records, Jan 6 2007 8:01PM i need to export the query out to a c:\data\test.txt file is it possible to use dcp,isql,osqlC:\>bcp "SELECT GETDATE()" queryout testfinal.txt -c -t "," -Uxyz -Pabc -SserverabC:\>isql -Sserverab -Uxyz -Pabc -d northwind -q"select getdate()" -o.\erappa.txthow can i do this i dont want to use DTS or query analyzeri need to this by command prompt(windows)thanxs coorgi |
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2007-01-08 : 08:47:59
|
So what's the problem? Is it working the way you posted here.Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
|
|
oracle_corrgi
Yak Posting Veteran
98 Posts |
Posted - 2007-01-08 : 22:03:28
|
its not working i cannot run a bigger query using this option isql ,osql ,bcpcoorgi |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2007-01-08 : 22:25:47
|
convert your query into a stored procedure and execute it via bcp KH |
|
|
Kristen
Test
22859 Posts |
Posted - 2007-01-08 : 22:29:07
|
"i cannot run a bigger query using this option ... osql"I've run massive SQL Scripts via OSQL without any limitations that I can think of.But khtan's answer is probably the best.Kristen |
|
|
oracle_corrgi
Yak Posting Veteran
98 Posts |
Posted - 2007-01-09 : 02:03:03
|
hii have limitation on this iam working or monitoring on remote production database i cannot create sp on the database and i dont want to do that can run this query without creating any object .i want to run from local command prompt by given the reqiured infoc:>isqlw -S BOSPRODOL401\C -d MBI401 -U abc -P axxy -i C:\Public\macros_test\ZBA_Agent.sql -o C:\Public\macros_test\editest.txtthe sample query is ...........select getdate() as "Query Time" select count(*) as "ZBA Agent" from dbo.vw_email_complete_queue(nolock) where insert_dte > '01/01/2005' and email_type_cde in (4,5)select getdate() as "Missing Transactions" SELECT daily_proc_status_cde,* FROM setl_day_totalsWHERE setl_dte =dbo.udf_FormatShortDate(GETDATE())can i use bcp , isql ,osql and others after this i need to shedule this throughcoorgi |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2007-01-09 : 02:36:47
|
What is the error you are getting? Are you running query on proper database?Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
|
|
oracle_corrgi
Yak Posting Veteran
98 Posts |
Posted - 2007-01-09 : 02:48:47
|
i am not getting any error EDI QUERY TIME ------------------------------------------------------ 2007-01-08 21:33:26.077(1 row(s) affected)EDI Query #1 ------------ No Data(1 row(s) affected)EDI Query #2 ------------ No Data(1 row(s) affected)0Nigtly Process -------------- No Data(1 row(s) affected)i need to get only the query out put 7620 Records, Jan 1 2007 1:18AM No data620 Records, Jan 1 2007 1:18AM No data1 Records, Jan 1 2007 1:13AM is it possible to run .sql and get the query out putcoorgi |
|
|
oracle_corrgi
Yak Posting Veteran
98 Posts |
Posted - 2007-01-09 : 05:03:50
|
is there any onecoorgi |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2007-01-10 : 01:07:45
|
You will have to make efforts to format data the way you want. To remove column headings, use -h-1 option in OSQL. To remove (1 row(s) affected) message, you will need to add SET NOCOUNT ON to your script file.Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
|
|
oracle_corrgi
Yak Posting Veteran
98 Posts |
Posted - 2007-01-11 : 02:39:32
|
hithanxs i need some modifycation at all the work i finally got the data like this Auto Deposit Query #1 --------------------- 1986 Records, Jan 10 2007 1:27AM Auto Deposit Query #2 --------------------- No Data Auto Deposit Query #3 --------------------- 60 Records, Dec 20 2004 9:39AM EDI Query #1 ------------ No Data EDI Query #2 ------------ 1 Records, Jan 11 2007 12:02AM tpa_id file_name edi_req_status_cde edi_proc_status_cde edi_req_key proc_start_dte proc_end_dte req_dte ------ ----------------------------------------------------------------------- ----------------------------------------------------------------------- ----------------------------------------------------------------------- ------------------------------------------ ------------------ ------------------- -------------------- -------------------- -------------------- -------------------- i need to get data like this 1986 Records, Jan 10 2007 1:27AM No Data60 Records, Dec 20 2004 9:39AM No Data1 Records, Jan 11 2007 12:02AM i dont need extra data why is this ???thanxscoorgi |
|
|
oracle_corrgi
Yak Posting Veteran
98 Posts |
Posted - 2007-01-11 : 03:56:57
|
is any one therecoorgi |
|
|
|