Output to Table format

Im just starting to learn Sybase and I have a basic question.  I have the following SQL statement that outputs the result into a txt file.

Select *
From Table1;
Output to f:\qry1.txt
Format ASCII

How do I re-write this to output in table form?

Thanks
D
lebeau26Asked:
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.

grant300Commented:
What do you mean by "output in table form"?  Do you want the query to create a new table or are you still looking for text file output but want it all pretty-printed?

Regards,
Bill
0
lebeau26Author Commented:
My professor just said "output in table form".  I know we need to show the results in Word so I guess it is "all pretty printed" as you say.  But just in case, can you show me both SQL statements?  Thanks

David
0
grant300Commented:
You use the SELECT/INTO syntax to create a table from a query result.

From what you said, the prof wants it in a MSWord "table".  There are a couple of ways to do that.

The first is to import the text and then use the "Convert text to table" feature of Word.  That is O.K. and, as long as you don't have many columns and they are well behaved, it won't look too bad.

What I prefer to do is take the CSV (comma or tab delimited text file) and import it into Excel first, get things looking the way I want, then move it from Excel into a Word table.

In either event, your technique for sending the query result to a flat file is valid.

Regards,
Bill
SELECT *
  INTO NewTable
  FROM Table1

Open in new window

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
BenSladeCommented:
When your prof said "output in table form", probably you can just take the output from the select statement and paste into MS-Word using a fixed width format.   It will have a rows and columns table structure, just without any vertical or horizontal lines for the cell boundaries.

But if you really really want to have a real table, try downloading the "sqsh" command line utility (google "sqsh" to find it) and then login into your db using sqsh and run the following command (sqsh uses the same options as the Sybase isql utility):

  > sqsh -SMYSERVER -Umylogin -w132
  use mydatabase
  go
  select * from mytable
  go -m html

This will display the "select" output in HTML format.   Copy the outputted HTML text and use the "insert HTML" feature in MS-Word to insert a nicely formatted table.  

If your prof isn't impressed with this you should quit the class, 'cause he's not going to be happy with anything you do.

Ben Slade
Chevy Chase, MD
0
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
Sybase Database

From novice to tech pro — start learning today.