Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Print Table(s)

Status
Not open for further replies.

net123

Programmer
Oct 18, 2002
167
US
How can one print the contents of a table? Does one go through the Enterprise Manager and then select the table and all rows?

Please help...
 
Well I'd go into Query Analyzer(MS SQL program) which is where I've done my printing.

Open Query Analyzer, then connect using the same settings you would in EntManager.

Select the correct database in the dropdown.

Type: SELECT * FROM [tablename]

You can view result in text or grid (toolbar). You can print directly from either but Grid will let you copy and paste into excel which you can format allot better(ctl+A, ctl+C, ctl+V).
 
When I use Query Analyzer and run my query in datagrid format, the print icon is disabled! Why does this happen? Thus I can't print from there.

I also copy all and then past my data onto Excel, but the string data loses its format by treating some numeric strings has numbers, i.e. changing to say 1.23423E+12.

Don't know what to do! Just want to print the results of my query...

Thank in advance.
 
Hi!
In Query Analiser:
You just need to set "Results in text", then run again the query, click in the results pane and then go to File\Print!
That's all. It works for me (I've tried it seconds ago).

Hope it helps!

Bogdan.
 
If you want more control over the look n feel of your printout I suggest you use DTS to export your table directly into excel, then do the formatting in excel.

The simplest way to do this is open Enterprise Manager, browse to your table, right-click and choose export data. From there its a simple wizard where you can choose excel and a new file to export to.

Posting code? Wrap it with code tags: [ignore]
Code:
[/ignore][code]CodeHere
[ignore][/code][/ignore].
 
If you have MS Access you could link to your SQL Server and then use one of the only decent things in Access - namely the Report Wizards, thus allowing you to format the output of the data exactly as you need.

But the simpliest way is definitely Query Analyser with results in Text rather than datagrid.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top