954,593 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

How to print tables in SQL Server 2005

Hi,

I have a small database with 15 tables and 20-40 records in each table. I just want to ask how can I print all the tables together with their names, atribute names and all the records? (the Print option from the File menu is not active)

Thanks,
Robert

quiptro
Newbie Poster
19 posts since Jan 2007
Reputation Points: 10
Solved Threads: 0
 

It depends

You can either:

Use The MSSQL Managament Studio ( i think)

Write a program / web app to do it

Use Crystal Reports?

jbennet
Moderator
Moderator
18,523 posts since Apr 2005
Reputation Points: 1,826
Solved Threads: 601
 

In Sql Server Management studio expand databases on the left, expand the database that contains your tables, right click on Database diagrams and choose 'New database diagram', you may at this point receive a message saying you don't have all the support objects required, click ok to have them created. A dialogue box appears with a list of the tables, select them all and click add. Now choose Print from the file menu. You may need to manually size and drag the tables around if you want to fit them to one A4 page.

hollystyles
Veteran Poster
1,182 posts since Feb 2005
Reputation Points: 262
Solved Threads: 68
 

Thanks for the prompt response. I followed your instructions and created the diagram and the Print option became active. However, it only printed the diagram and all the relationships mapped, and did not print the tables with their content (the records). I just need to simply print the tables (just like if they were in exel). Thanks.

quiptro
Newbie Poster
19 posts since Jan 2007
Reputation Points: 10
Solved Threads: 0
 

I think you wil need to produce a report then, either by writing an web or local application or by using a report generator (crystal reports maybe?)

jbennet
Moderator
Moderator
18,523 posts since Apr 2005
Reputation Points: 1,826
Solved Threads: 601
 

In Sql Server Management Studio, expand databases, right click your database and choose tasks -> Export. In the first wizard page choose the source (this should already be the databse you just right clicked), click next. In the destination drop down choose Microsoft Excel, browse to a folder and type a filename, check the box 'First row has column names' click next. Choose the first option 'Copy data from one or more tables or views' click next. Select all the tables and click next, check the box 'Execute immediately' click next, click finish.

hollystyles
Veteran Poster
1,182 posts since Feb 2005
Reputation Points: 262
Solved Threads: 68
 

You can create a view to get the data you want and the import it into excel. The "Import External Data" is in the Data menu, and is wizard based, so it's pretty easy.

If your data changes, all you have to do is refresh your excel sheet and you get updated data as well.

M_K_Higa
Junior Poster
102 posts since Sep 2006
Reputation Points: 12
Solved Threads: 2
 

Thanks to everybody for the responses. I am not much of a programmer so I can not create an application to produce the reports or make one with existing software, but importing and printing the tables in excel using "Import External Data" was straightforward and quite easy. Thanks.

quiptro
Newbie Poster
19 posts since Jan 2007
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You