ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Hello, I would like to setup a perl script that connects to a microsoft sql database server executes a query then outputs to a specified file on the machine that runs the perl without the column header. I would like it to overwrite the file each time it is run.
example file contents starting with first line
cow
dog
mouse
horse
boar
looks like you need to learn a lot. Why do you want to connect at all (is this some kind of homework)? Where is this database running?
There are a lot of different ways to connect to a database and retrieve some data, but without details hard to say anything.
this is probably a way: https://www.easysoft.com/developer/l..._dbd_odbc.html
@NevemTeve I was able to output cmdline query to a file. I removed the header using -h -1 option , and placed set no count on in the beginning of the query to remove the (rows affected).
As others have observed, you do not have to "write a Perl script" in order to do something so trivial, especially if it is a "one-off one-time" requirement. There are plenty of both command-line and GUI tools which can run a query and send the query output to a file (in a variety of formats, with or without headers).
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.