Friday, February 17, 2012

create db

Hi
How can i create and attach a database with out using
enterprise managaer in mssql7.
hi shif,
To create a database you can make use of t-sql command "create database". If
you want to create a database without using enterprise manager you will have
to use above command with the help of application tools like "query
analyzer" OR command line utility like osql.
A typical syntax of create database will look as follows.
CREATE DATABASE <database_name>
ON
( NAME = logical_file_name ,
FILENAME = 'os_file_name_path' ,
SIZE = size_of_file ,
MAXSIZE = max_size_of_file, --max size to which file can grow.
FILEGROWTH = growth_increment_of_file )
LOG ON
( NAME = logical_file_name,
FILENAME = 'os_file_name_path',
SIZE = size_of_file ,
MAXSIZE = max_size_of_file, --max size to which file can grow.
FILEGROWTH = growth_increment_of_file )
GO
If you want to attach a database with the existing data and log files. you
can make use of clause "FOR ATTACH" in create database command. OR you can
make use of system stored procedure sp_attach_db.
See more help on both of the above commands and its explaination in Books
online
Vishal Parkar
vgparkar@.yahoo.co.in

No comments:

Post a Comment