MS SQL Schema and Data Export

I'm used to MySQL and PHPMyAdmin - I had to switch to MSSQL for an ASP.net project and am having a lot of problems. I am using SQL 2008 Express with SQL Server Management Studio. Below are two questions I've been wrestling with for a while:

1) How to export the DB schema for the database? Table structure, etc.?

2) How to export all data to the database?

Ideally, I would like to have a .sql file that can be run wherever I need duplicated schema or data, such as an employee's computer for a collaborative project, or online when the project is hosted.

Thanks!

+2


a source to share


1 answer


1) How to export the DB schema for the database? Table structure, etc.

INFORMATION_SCHEMA is your friend

 SELECT * FROM INFORMATION_SCHEMA.TABLES

      

http://www.mssqltips.com/tutorial.asp?tutorial=179
http://weblogs.asp.net/jgalloway/archive/2006/07/07/455797.aspx
http://preetul.wordpress.com/ 2009/06/09 / sql-server-information_schema /



Otherwise, if you want something pretty, download the 14 day trial version of the SQL Doc (part of the SQL Toolbelt) here: http://www.red-gate.com/products/SQL_Professional_Toolbelt/index.htm

"2) How to export all data to the database?

In what form? Bak files are generally the most useful. http://www.sqlteam.com/article/backup-and-restore-in-sql-server-full-backups Or do you want to move data to MYSQL or Excel or some other program? If you want to move data to MYSQL check here: http://www.google.com/search?q=mssql+to+mysql

+2


a source







All Articles