WHy does this not work? It removes the old database and creates a new one with all the specks that I specify, but when I do the restore, it does not restore any of my old tables. Any ideas? it restores all of the sys... tables but none of my backed up tables.
-- ========================================
-- Used to delete the old Database
-- ========================================
IF EXISTS (SELECT *
FROM master..sysdatabases
WHERE name = N'CVIEW')
DROP DATABASE CVIEW
GO
-- ==================
-- Create Database
-- ==================
USE master
GO
CREATE DATABASE CVIEW
ON
( NAME = 'CVIEW_dat',
FILENAME = 'c:\program files\microsoft sql server\mssql\data\CVIEW.mdf',
SIZE = 2000MB,
FILEGROWTH = 10% )
LOG ON
( NAME = 'CVIEW_log',
FILENAME = 'c:\program files\microsoft sql server\mssql\data\CVIEW.ldf',
SIZE = 2000MB,
FILEGROWTH = 10% )
GO
-- =====================
-- Restore Database
-- =====================
USE master
GO
-- First determine the number and names of the files in the backup.
RESTORE FILELISTONLY
FROM DISK = N'c:\xCVIEWbackup.dbk'
-- Restore the files for new Db.
RESTORE DATABASE CVIEW
FROM DISK = N'c:\xCVIEWbackup.dbk'
WITH REPLACE
GO
-- ========================================
-- Used to delete the old Database
-- ========================================
IF EXISTS (SELECT *
FROM master..sysdatabases
WHERE name = N'CVIEW')
DROP DATABASE CVIEW
GO
-- ==================
-- Create Database
-- ==================
USE master
GO
CREATE DATABASE CVIEW
ON
( NAME = 'CVIEW_dat',
FILENAME = 'c:\program files\microsoft sql server\mssql\data\CVIEW.mdf',
SIZE = 2000MB,
FILEGROWTH = 10% )
LOG ON
( NAME = 'CVIEW_log',
FILENAME = 'c:\program files\microsoft sql server\mssql\data\CVIEW.ldf',
SIZE = 2000MB,
FILEGROWTH = 10% )
GO
-- =====================
-- Restore Database
-- =====================
USE master
GO
-- First determine the number and names of the files in the backup.
RESTORE FILELISTONLY
FROM DISK = N'c:\xCVIEWbackup.dbk'
-- Restore the files for new Db.
RESTORE DATABASE CVIEW
FROM DISK = N'c:\xCVIEWbackup.dbk'
WITH REPLACE
GO