how to make new database through ado ?
-
i had made a program in which i had executed "inser, delete and modify " command of SQL but can anybody tell me how to make new database, new table in a database and alter table queries code will me more helpful
sumit21 wrote: but can anybody tell me how to make new database, new table in a database and alter table queries To create a database, use something like this:
CREATE DATABASE Sales
ON
( NAME = Sales_dat,
FILENAME = 'c:\program files\microsoft sql server\mssql\data\saledat.mdf',
SIZE = 10,
MAXSIZE = 50,
FILEGROWTH = 5 )
LOG ON
( NAME = 'Sales_log',
FILENAME = 'c:\program files\microsoft sql server\mssql\data\salelog.ldf',
SIZE = 5MB,
MAXSIZE = 25MB,
FILEGROWTH = 5MB )To create a table use something like this:
CREATE TABLE publishers
(
pub_id char(4) NOT NULL
CONSTRAINT UPKCL_pubind PRIMARY KEY CLUSTERED,
pub_name varchar(40) NULL,
city varchar(20) NULL,
state char(2) NULL,
country varchar(30) NULL
DEFAULT('USA')
)To alter a table use something like this:
ALTER TABLE doc_exa ADD column_b VARCHAR(20) NULL
If this is not enough help there are already some great documentation and articles already out there on the internet: CREATE DATABASE[^] CREATE TABLE[^] ALTER TABLE[^]
My: Blog | Photos | Next SQL Presentation WDevs.com - Open Source Code Hosting, Blogs, FTP, Mail and More
-
sumit21 wrote: but can anybody tell me how to make new database, new table in a database and alter table queries To create a database, use something like this:
CREATE DATABASE Sales
ON
( NAME = Sales_dat,
FILENAME = 'c:\program files\microsoft sql server\mssql\data\saledat.mdf',
SIZE = 10,
MAXSIZE = 50,
FILEGROWTH = 5 )
LOG ON
( NAME = 'Sales_log',
FILENAME = 'c:\program files\microsoft sql server\mssql\data\salelog.ldf',
SIZE = 5MB,
MAXSIZE = 25MB,
FILEGROWTH = 5MB )To create a table use something like this:
CREATE TABLE publishers
(
pub_id char(4) NOT NULL
CONSTRAINT UPKCL_pubind PRIMARY KEY CLUSTERED,
pub_name varchar(40) NULL,
city varchar(20) NULL,
state char(2) NULL,
country varchar(30) NULL
DEFAULT('USA')
)To alter a table use something like this:
ALTER TABLE doc_exa ADD column_b VARCHAR(20) NULL
If this is not enough help there are already some great documentation and articles already out there on the internet: CREATE DATABASE[^] CREATE TABLE[^] ALTER TABLE[^]
My: Blog | Photos | Next SQL Presentation WDevs.com - Open Source Code Hosting, Blogs, FTP, Mail and More
-
sumit21 wrote: i m using ms-access as database Well, why didn't you say?! I don't know about creating a database, but as for creating and altering tables there is good documentation with MS Access that has many examples. (Adding the search terms "Access" or "Microsoft Access" to the google queries I gave would most likely return the correct documentation also)
My: Blog | Photos | Next SQL Presentation WDevs.com - Open Source Code Hosting, Blogs, FTP, Mail and More