Sunday, February 19, 2012

Importing a SQL Database using SQLDMO.. URGENT HELP REQUIRED..

I have written an application in Microsoft Access. I'm currently using SQL
Server 2000 as my datatabase, and use SQLDMO to perform various functions
like Backup, Restore and copy. Now I want to create a new database from a
template database which I have backed up to a template.mdf file. Now I want
to create a new database, and then import the template file into the New
database.
Basically this is the steps that I need to follow.
1) Create Blank SQL Server Database - Can already do this.
2) Import Template database into new blank sql server database. - This is
where the problem occurs.
If there is an easier way of doing this then It will also be appreciated..
bascially If I can just specify the template file and say to the application
create me a new database from that file then it will also be fine.
Any help will be greatly appreciated!!if you'll be using the template many times
might as well do it in the model database
any thing you create will be patterned with the model databse
Jose de Jesus Jr. Mcp,Mcdba
Data Architect
Sykes Asia (Manila philippines)
MCP #2324787
"Db_Stuff" wrote:

> I have written an application in Microsoft Access. I'm currently using SQL
> Server 2000 as my datatabase, and use SQLDMO to perform various functions
> like Backup, Restore and copy. Now I want to create a new database from a
> template database which I have backed up to a template.mdf file. Now I wan
t
> to create a new database, and then import the template file into the New
> database.
> Basically this is the steps that I need to follow.
> 1) Create Blank SQL Server Database - Can already do this.
> 2) Import Template database into new blank sql server database. - This is
> where the problem occurs.
>
> If there is an easier way of doing this then It will also be appreciated..
> bascially If I can just specify the template file and say to the applicati
on
> create me a new database from that file then it will also be fine.
> Any help will be greatly appreciated!!
>|||I am still a beginner at this and I have only managed to get so far with the
help of various sources on the internet. I will be using the template
basically all the time to create a new database, but what do you mean I migh
t
as well do it in the Model Database..
thanks.
"Jose G. de Jesus Jr MCP, MCDBA" wrote:
> if you'll be using the template many times
> might as well do it in the model database
> any thing you create will be patterned with the model databse
>
> --
>
> Jose de Jesus Jr. Mcp,Mcdba
> Data Architect
> Sykes Asia (Manila philippines)
> MCP #2324787
>
> "Db_Stuff" wrote:
>|||the model database is the template database of sql server
--
Jose de Jesus Jr. Mcp,Mcdba
Data Architect
Sykes Asia (Manila philippines)
MCP #2324787
"Db_Stuff" wrote:
> I am still a beginner at this and I have only managed to get so far with t
he
> help of various sources on the internet. I will be using the template
> basically all the time to create a new database, but what do you mean I mi
ght
> as well do it in the Model Database..
> thanks.
>
> "Jose G. de Jesus Jr MCP, MCDBA" wrote:
>|||hi,
Db_Stuff wrote:
> I have written an application in Microsoft Access. I'm currently
> using SQL Server 2000 as my datatabase, and use SQLDMO to perform
> various functions like Backup, Restore and copy. Now I want to create
> a new database from a template database which I have backed up to a
> template.mdf file. Now I want to create a new database, and then
> import the template file into the New database.
Jose already introduced you the way new databases are created, actually a
"clone" of model system database...
if you want your application databases all inherit from your particular
template, why not just provide a backup of it and perform a restore
operation specifying a new database name and providing the WITH MOVE terms
to generate the relative physical files in the correct (and obviously
different) position?
BTW, I usually prefer all databases inherit from target model database and
create all required dbobjects via standard Transact-SQL scripts...
the best deployment article I ever read for programmers can be found at
http://msdn.microsoft.com/msdnmag/i...abaseinstaller/
..this kind of soulution takes care of appropriate versioning and successiv
e
database schema updates...
--
Andrea Montanari (Microsoft MVP - SQL Server)
http://www.asql.biz/DbaMgr.shtmhttp://italy.mvps.org
DbaMgr2k ver 0.15.0 - DbaMgr ver 0.60.0
(my vb6+sql-dmo little try to provide MS MSDE 1.0 and MSDE 2000 a visual
interface)
-- remove DMO to reply

No comments:

Post a Comment