Export excel or data from sql to pdf file

hi ,

i need to export excel file or data from table sql to pdf file

i try by this link,but not success

enter link description here

Try This from cmd

sqlcmd -S . -d DatabaseName -E -s, -W -Q "SELECT * FROM TableName" > C:\Test.pdf



Have you tried using SSRS? It will export rather nicely to PDF. The sqlcmd utility doesn't support going to PDF directly. Yes it generates the file but it's not a PDF file. Please correct me if I am wrong.

That's my opinion too

You can choose second option (which is shown in Snapshot) if you are unable to via sqlcmd.

There you will have PDF option.


That appears to require buying dbForge? (or using the Trial, but that won't be a long term solution of course ...)

I'm looking for a replacement to SSMS - how does dbForge compare?

dbForge has an "express" or "free" edition for many of their tools including the one for SQL Server. The "express" version allows for you to export up to 50 rows.

If you are looking to replace SSMS, a good alternative may be Aqua Data Studio. We use that where I work now. It works with almost every RDBMS on the market and many non-RDBMS platforms.

Very good tool, has some frustrating aspects to it, but in general very good. Rather spendy.

One of my favorite parts of Aqua Data Studio is the data compare feature. You can run an SQL statement on one DBMS platform on one server and run the same SQL on a different platform/server. You can then compare the results between the two and it will show you the differences. It will also generate INSERT statements based on SQL results. Something the SSMS Tools Pack does on SQL Server. There are so many great tools out now that I feel like Tim the Tool Man Taylor.

1 Like