Re: Database creation
"Beauchemin, Bob" <[email protected]> Tue, 18 Jun 2002 21:03:36 -0700
| Newsgroups | gmane.comp.windows.devel.oledb.devel |
|---|---|
| Message-ID | <94FD4438D783D74EA86DC692E776C1270160611A@la-infoserver.develop.com> |
Hi Mark, You need to pass each command in separately or, subject to constraints, in a batch, with the GO removed, through the OLE DB Command object. You also need to be signed in as someone with database creation authority. The "official" OLE DB interface and method for creating a new data source (database), IDBDataSourceAdmin::CreateDataSource, is not supported by SQLOLEDB (although it supports IDBDataSourceAdmin, it returns E_NOTIMPL to CreateDataSource). So you have to use data definition language with the Command cotype. Bob Beauchemin [email protected] -----Original Message----- From: Mark A. Gregory [mailto:[email protected]] Sent: Tuesday, June 18, 2002 4:56 AM To: [email protected] Subject: Re: [OLEDB_DEV] Database creation I created a database and then a script from it I would like to know how to identify where to put the data and log files and to create a database using OLEDB Command calls to a SQL server. /****** Object: Database scmem Script Date: 18/06/2002 9:00:09 PM ******/ IF EXISTS (SELECT name FROM master.dbo.sysdatabases WHERE name = N'scmem') DROP DATABASE [scmem] GO CREATE DATABASE [scmem] ON (NAME = N'scmem_dat', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL\Data\scmem.mdf' , SIZE = 2, FILEGROWTH = 10%) LOG ON (NAME = N'scmem_log', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL\Data\scmem.ldf' , SIZE = 2, FILEGROWTH = 10%) COLLATE Latin1_General_CI_AS GO You can read messages from the OLEDB_DEV archive, unsubscribe from OLEDB_DEV, or subscribe to other DevelopMentor lists at http://discuss.develop.com. You can read messages from the OLEDB_DEV archive, unsubscribe from OLEDB_DEV, or subscribe to other DevelopMentor lists at http://discuss.develop.com.