For SQL Server 6.5 information, see LOAD Statement in What's New for SQL Server 6.5.
Restores a backup copy of a user database and its transaction log (LOAD DATABASE) or only the transaction log (LOAD TRANSACTION) from a dump that was created using the DUMP statement. The LOAD statement can also be used to retrieve header information from a database dump (LOAD HEADERONLY).
Loading a database:
LOAD DATABASE {dbname | @dbname_var}
FROM dump_device [, dump_device2 [..., dump_device32]]
[WITH options
[[,] STATS [ = percentage]]]
Loading a transaction log:
LOAD TRANSACTION {dbname | @dbname_var}
FROM dump_device [, dump_device2 [..., dump_device32]]
[WITH options]
Loading header information:
LOAD HEADERONLY
FROM dump_device
where
Allows backups to be loaded directly from temporary dump devices. These devices must already exist when the load occurs; they do not have entries in sysdevices. The device types of DISK, TAPE, and FLOPPY should be specified with the actual address (for example, complete path and filename) of the device. A device type of PIPE should specify the name of the named pipe that will be used by the client application. If specified as a variable (@temp_dump_dev_var), the device name can be specified as a string or as a char or varchar variable. If you are using either a network server with a UNC name or a redirected drive letter, specify a device type of DISK.
Important When specifying a striped dump, you can use both logical device names (or variables) and temporary device names (or variables). PIPE devices have been added to allow third-party vendors a flexible and powerful way to connect their own software. For typical Transact-SQL use, the PIPE device will not be used.
During the load, the specified database must not be in use. Any data in the specified database is replaced by the loaded data.
You can use LOAD DATABASE to move a database to another device or another server as long as the same code page and sort order are running on both servers. If the code page or sort order differs, use the SQL Transfer Manager to move the data. If the sort order and code page are the same, the recipient database must be as large as, or larger than, the database to be loaded. If the recipient database is too small, SQL Server displays an error message that gives the required size. The device fragments that the new database uses for data and for the log must appear in the same order and have the same amount of space as the fragments in the original database. For example, if the original database had 10 MB of data (on any number of fragments), followed by 3 MB of log, followed by 6 more MB of space for data, the new database must have the same order by space and usage: that is, 10 MB for data, 3 for log, and 6 (or more) for data. The total size of the destination database must be at least as large and have at least as many fragments (assigned in the same order and have the same uses) as the load.
If the dumped database uses segments to store particular tables or indexes, the new database must include devices of the same size and page order for these segments and their related data in order for LOAD statement to work correctly. Execute the sp_helpdb system stored procedure with the database name to see the size and fragments. Select from the sysusages system table to determine the order of the device fragments. Then re-execute the CREATE DATABASE statement and the ALTER DATABASE statement to re-establish the fragments. For details on using the LOAD statement to restore or move databases, see the Microsoft SQL Server Administrator's Companion.
If a database will be loaded into a newly created database, use CREATE DATABASE FOR LOAD when creating the new database. The FOR LOAD option specifies that the data pages will not be zero-initialized because the only operations allowed against that database are ALTER DATABASE FOR LOAD or LOAD DATABASE. Any unused data pages will be initialized by the database load. For more information, see the CREATE DATABASE statement.
For compatibility, user database dumps from SQL Server 4.2x can be loaded into SQL Server 6.0, as long as the same sort order is running on both SQL Servers. The user database dump (the master database is not allowed to be loaded or upgraded from SQL Server 4.2x dumps) must be a full database dump, not a transaction log dump, and the dump must occur when there is no update activity taking place in the database. For this reason, it is recommended that the dump occur when SQL Server is started in single-user mode. After the database is successfully loaded, the database will be upgraded. For more information about database upgrades and potential compatibility issues, see Microsoft SQL Server Setup.
Important Cross-platform dumping and loading is not supported. For example, a database dumped on a MIPS-based computer cannot be loaded into an Intel-based computer. If you need to move data from one platform to another, use the Microsoft SQL Transfer Manager.
LOAD DATABASE and LOAD TRANSACTION permission default to the database owner and are not transferable.