Scripting a SQL Server database schema is a fairly trivial task if the dependencies between the objects are ignored. The trouble is that if you generate a schema script on server A and try to execute it on server B to create a copy of that database you will soon realize how critical those dependencies are – the script will simply fail to execute.
That’s where xSQL Object and xSQL Data Compare come in – both of those tools allow you to script an individual object in the database or the whole database schema and the script you get is properly ordered respecting the dependencies between objects so that it executes flawlessly.
Furthermore, those tools allow you to script the data as well or you can script both the schema and the data in one place. Scripting both schema and data together is very cool as it allows you to transfer a whole database from one server to another even if you can’t use a backup and restore. For example, you have a database hosted on a web server somewhere and you can execute T-SQL scripts against the database but you don’t have access on the server to be able to place a copy of your database backup which you can then restore. No worries, you simply generate a schema and data script of the whole database and execute that on the target server and there, you have transferred the whole database.
Best part: the scripting functionality included in the xSQL Object and xSQL Data Compare is completely free – no limitations, no expiration.