473,406 Members | 2,371 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Txt File Print in SQL

ddtpmyra
333 100+
I wanted to have a job schedule inside MS SQL 2008 server that will print the txt file exported. Can this be done? What will be a syntax, sorry I don't know where to start to.
Jan 12 '12 #1
7 2387
ck9663
2,878 Expert 2GB
Create an app that will handle the printing, create the job to export, call the printing app inside the job....

Happy Coding!!!


~~ CK
Jan 13 '12 #2
Rabbit
12,516 Expert Mod 8TB
SSIS allows you to use .Net programming. So conceivably, you could write a function to print the file. And call run the package when you want to do so.
Jan 13 '12 #3
ddtpmyra
333 100+
I already exported my query result to a text file. My problem is how to make the auto printing. Can you give me sample to read? I never use ssis.

Ty
Jan 13 '12 #4
Rabbit
12,516 Expert Mod 8TB
I don't know the code, I've never had to do that. I'm just saying it's conceivable you can do so because I know you can print a file using .Net if you so wished. I'm sure there's plenty of sample code showing how to print a file in .Net.
Jan 13 '12 #5
ddtpmyra
333 100+
Thank you Rabbit.
To make it work I created a procedure that will extract the data into text file and I created this scheduled batch file to print the file.

Now, my next problem is how to tell inside my sql extract to file procedure to print it in new page for each record. See my code below. I use the combination of CHAR(13) + CHAR(10)
to go to the next line. What about page break or new page? Is there an ascii code that will tell to go to the next page?

Expand|Select|Wrap|Line Numbers
  1. DECLARE @NewLineChar AS CHAR(2) = CHAR(13) + CHAR(10)
  2.  
  3. SELECT   
  4. 'DATE:'+getdate()+  @NewLineChar
  5. +'Customer Name:'+last_name+', '+first_name + NewLineChar
  6. +'Customer Record Number:'+rec_nbr +  @NewLineChar
  7. FROM     Tbl_customer 
  8.  
Feb 10 '12 #6
Rabbit
12,516 Expert Mod 8TB
There is no ASCII code for a page break. You could try creating a new file for each record instead.
Feb 11 '12 #7
ddtpmyra
333 100+
Thank you Rabbit I appreciate your inputs.
Feb 18 '12 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Ruben | last post by:
Hello. I am trying to read a small text file using the readline statement. I can only read the first 2 records from the file. It stops at the blank lines or at lines with only spaces. I have a...
3
by: JOSHUA JACKS | last post by:
I accidentally removed the "Print" option from the default "File" menu (don't ask). When I replaced it, the replacement prints automatically without calling up the print dialog. I can still get...
3
by: Bryan Shaw | last post by:
I do not want my users to be able to copy and paiste anything on these web pages, which will be on an internal web site. Is there a way to prevent the printing of a web page? Is there a way to...
1
by: DavidA | last post by:
I have a very simple form and perl script that is to upload a jpg file. I am not familiar with the perl language but copied the code from a text book. It works fine with all browsers except IE....
3
by: undshan | last post by:
I am writing a code that needs to open a file, create an output file, run through my function, prints the results to the output file, and closes them within a loop. Here is my code: #include...
0
by: linuxos | last post by:
I'm newbie in C# . I need some help: 1. i want to save the contents (lines, circles, other) of a panel to a bmp/jpg file in C#. 2. i want to print the contents of that panel i'm drawing on that...
2
by: gbrendemuehl | last post by:
I have an application (Access 2003) that 'prints' reports to PDF files. I would like to add the ability to print those PDF files on a printer. I have found and tested 'open file dialog' code, but...
4
by: nitupatra | last post by:
I have perl script which will make a zip file and create a HTML form with asubmit button to send the zip file client. When user click the download button the zip file will be downloaded. But the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.