4.7.1 BACKUP
The backup command is used to back up database content or its transaction log to storage media (floppy disk, hard disk, tape). The dump command is used to perform this function when the previous version of SQL Server 7.0 is in use, and the dump command is no longer used from SQL Server 2000. For more information on the backup command, see the "Data Backup and Recovery" section.
4.7.2 CHECKPOINT
The syntax is as follows:
CHECKPOINT
The CHECKPOINT command is used to force a data page, or log page, that has been changed in the current working database, from being forced to the hard drive from the data buffer cache.
4.7.3 DBCC
DBCC Database Base Consistency Checker, Database consistency checker) commands are used to validate the integrity of databases, find errors, analyze system usage, and so on.
The DBCC command must be followed by a child command, and the system knows what to do. The DBCC CHECKALLOC command checks the allocation and usage of all data pages in the current database.
For more information on the DBCC command, see Appendix.
4.7.4 DECLARE
The syntax is as follows:
DECLARE {{@local_variable data_type}
| {@cursor_variable_name cursor}
| {table_type_definition}
} [, .... N]]
The DECLARE command declares one or more local variables, cursor variables, or table variables. After the declare command is declared, all variables are given an initial value of NULL. You need to assign a value to a variable with a select or SET command. Variable types can be system-defined or user-defined types, but not text, NTEXT, or image types. The CURSOR named variable is a local cursor variable.
Example 4-16
DECLARE @x float @y datetime
Select @x = Pi @y = getdate
Print @x
Print @y
The results of the operation are as follows:
3.14159
June 4:32pm
Note: If the variable is a character type, then the data_type expression should indicate