How can i export table data with column name in text file in sql server 2005?
views:
94answers:
3safest way to do that is to backup data and then restore it on other server! right click on database in ms sql management studio>tasks>backup , choose directory to backup the file. Zip it ( saves a lot of space) move to other location, create database with the same name right click on database>tasks>restore.
In backup and restore always choose overwrite in options menu otherwise it will be appended to existing dataset.
Other way to do that is right click on database, tasks, export data and move it to another location. more advanced though, backup works faster and you supposed to use it unless you want partial move, like some tables and some stored procedures.
If it's a small amount of data, you can upgrade your Management Studio to SSMS 2008 (you do not need to upgrade your server). The Results tab has the ability to copy data with headers, so you can cut and paste into Excel.
A larger amount of data can be extracted in several ways such as an SSIS package, the Import/Export wizard, or doing a pull through ODBC from Excel.