ISQL Output File

I am using ISQL to run a query and create an output file. When it does this it prints column headings and underneath those, prints a dashed line. Is there anyway to eliminate the column headings and dashed line so that is it just the data that is contained in the output file?
rkanoAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

JHausmannCommented:
Click on the query options button (or select set options... from the query menu). Then select the format tab. De-select print headers by clicking on the checkbox.
0
rkanoAuthor Commented:
Won't de-selecting 'print headers' clear that option for all queries? In other words, there are a couple of queries that I would like to have column headings, so could I set this option on that query only?
0
formulaCommented:
There is no "set print headers" command to do this for a specific query.  I suppose Microsoft forgot this one.

A solution however to your dilema is to create a stored procedure which calls the isql command line utility using  the "xp_cmdshell" stored procedure to output your file.  That way you can take advantage of the options available to the isql command line utility, including one to turn off headers.  Hope this helps!!
0
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

rkanoAuthor Commented:
Excellent! That worked, however, now I have one other problem related to this. Now that I generate an output file using ISQL, it forces a space in the first column of the output file. FOr example, a line from the output file looks like this:

 1222990001234D

instead of this

1222990001234D

Forcing a space in that first column is causing the import of this data into other systems not to work. Any ideas?
0
formulaCommented:
Keep in mind that I'm not sure the solution you chose based upon your message(formula or Jhausmann). Either way though, I haven't seen this behavior before, so I'm speculating on it's possible solution:
1) Must be a character field, so try ltrim(field) in your query.
2) If you used isql command line util, make sure you used the /h-1 option without a space between h and -.
0
rkanoAuthor Commented:
Sorry about that, I did clear up the column headings problem.

It is indeed strange, I am just doing a "select * from" a table and sending the results to an output file. It is forcing a blank character in the first position. If I am in a SQL Query window and do a "select * from" on that table, it displays correctly. Also, if I go to the results window and save it as a text file, it saves it in the correct format. It is only using ISQL where it forces that first blank character. Anyway, here is my ISQL statement:

cmd /c isql -S IMPREDSDDB01 -U xxxx -P xxxx -d Y2K -Q "OutPut_Wires_File"
-h-1 -w 150 > \\IMPREDSDDB01\OptQueue\Y2KDB\Output\Output_Wire.TXT
0
formulaCommented:
Add the /s option to your isql command and the blank will disappear.
0
formulaCommented:
Rkano,

I'll be out of pocket for awhile, so I'm submitting as an answer.  As usual, if you don't think it solves your issues, you can reject it.  Thanks!!

Answer:
Use isql command line utility /h-1 to remove headers from single query.  Also, use isql /s option to get rid of leading blank in output file.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server

From novice to tech pro — start learning today.