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)


Recommended Answers

All 7 Replies

It depends

You can either:

Use The MSSQL Managament Studio ( i think)

Write a program / web app to do it

Use Crystal Reports?

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.

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.

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?)

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.

commented: Unfortunate, but this seems to be the best answer. Thank you. +0

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.

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.