SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Need script to load into text file from sql server
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

hardikkumar
Starting Member

USA
14 Posts

Posted - 11/15/2013 :  12:40:25  Show Profile  Reply with Quote
Hi I need script to export text file from sql. I cannot use importexoprt and bcp.give me script.

Below are field lmatter,ibilldt,ipaydt

hardik

Lamprey
Flowing Fount of Yak Knowledge

4614 Posts

Posted - 11/15/2013 :  13:01:46  Show Profile  Reply with Quote
You have a text file stored in SQL server and you want to export it? Or do you want to save the results of a query to a text file?
Go to Top of Page

hardikkumar
Starting Member

USA
14 Posts

Posted - 11/15/2013 :  13:54:59  Show Profile  Reply with Quote
I want to save the query result of a query to a text file.

Thanks for reply

hardik
Go to Top of Page

djj55
Constraint Violating Yak Guru

USA
317 Posts

Posted - 11/15/2013 :  14:16:45  Show Profile  Reply with Quote
Is this a query you run with a stored procedure or in SSMS?

djj
Go to Top of Page

hardikkumar
Starting Member

USA
14 Posts

Posted - 11/15/2013 :  14:22:59  Show Profile  Reply with Quote
select b.lmatter , convert(char(10),max(ltradat),101) lbilldt,
( select convert(char(10),max(ltradat),101)
from ledger, ledcode
where lmatter = b.lmatter
and ldocumnt is not null
and lzero != 'R'
and llcode = lccode
and lccollhs = 'Y'
) lpaydt
from ledger b, ledcode
where ldocumnt is null
and lzero != 'R'
and llcode = lccode
and lcfco != 'I'
group by lmatter
order by lmatter



I am running this query and its result should export to text file by script.

hardik
Go to Top of Page

hardikkumar
Starting Member

USA
14 Posts

Posted - 11/15/2013 :  15:05:06  Show Profile  Reply with Quote
I have to put this script on task manager so whenever it run this script it should export all data to txt files.

Please give me some ideas on it.I cant use import export wizard and bcp because I have to run on task manager or if you have any ideas with this option please let me know.

Thanks

hardik
Go to Top of Page

hardikkumar
Starting Member

USA
14 Posts

Posted - 11/15/2013 :  16:13:53  Show Profile  Reply with Quote
need help

hardik
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.06 seconds. Powered By: Snitz Forums 2000