472,973 Members | 2,340 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,973 software developers and data experts.

HOWTO create a copy of one database

Hello!

Was wondering how I can create a copy of one database? FYI I'm not
interrested in the data, just the fields and triggers, and so on.

Which way is the easiest? Do I create a script and run it from there? Is it
smart to have it inside a SP?

Any idea would be greatly appreciated.

I'm programming SQL 2k and VC7.0

--
- Lars

Nov 16 '05 #1
10 1914
oj
Yes. Create a script and deploy it.

--
-oj
RAC v2.2 & QALite!
http://www.rac4sql.net

"Lars Grøtteland" <lars@nospam> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Hello!

Was wondering how I can create a copy of one database? FYI I'm not
interrested in the data, just the fields and triggers, and so on.

Which way is the easiest? Do I create a script and run it from there? Is it smart to have it inside a SP?

Any idea would be greatly appreciated.

I'm programming SQL 2k and VC7.0

--
- Lars

Nov 16 '05 #2
Lars
Right click on the database then All tasks then Generate SQL Script.
Save it as .sql (or whatever) file and you can run it from QA or later if
you need from the file.

"Lars Grøtteland" <lars@nospam> wrote in message
news:#B**************@TK2MSFTNGP11.phx.gbl...
Hello!

Was wondering how I can create a copy of one database? FYI I'm not
interrested in the data, just the fields and triggers, and so on.

Which way is the easiest? Do I create a script and run it from there? Is it smart to have it inside a SP?

Any idea would be greatly appreciated.

I'm programming SQL 2k and VC7.0

--
- Lars

Nov 16 '05 #3
Yes I know I can do this in QA, but how to do it in my application?

Was thinking of making a SP, inside the model database. I think I've read of
this database once - that if I create one SP inside this, this should be
copied to the new database that's been created. Is this a solution?

--
- Lars
"oj" <no**********@home.com> wrote in message
news:uy**************@TK2MSFTNGP09.phx.gbl...
Yes. Create a script and deploy it.

--
-oj
RAC v2.2 & QALite!
http://www.rac4sql.net

"Lars Grøtteland" <lars@nospam> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Hello!

Was wondering how I can create a copy of one database? FYI I'm not
interrested in the data, just the fields and triggers, and so on.

Which way is the easiest? Do I create a script and run it from there? Is

it
smart to have it inside a SP?

Any idea would be greatly appreciated.

I'm programming SQL 2k and VC7.0

--
- Lars


Nov 16 '05 #4
Yes, stuff from model are copied to a new database. But this seems to be a
real awkward way of doing it. Just generate the scrip and have your
application loop the script file and for each "GO" it encounters in the file
is executes what you have built in the buffer so far.

--
Tibor Karaszi, SQL Server MVP
Archive at:
http://groups.google.com/groups?oi=d...blic.sqlserver
"Lars Grøtteland" <lars@nospam> wrote in message
news:%2***************@TK2MSFTNGP11.phx.gbl...
Yes I know I can do this in QA, but how to do it in my application?

Was thinking of making a SP, inside the model database. I think I've read of this database once - that if I create one SP inside this, this should be
copied to the new database that's been created. Is this a solution?

--
- Lars
"oj" <no**********@home.com> wrote in message
news:uy**************@TK2MSFTNGP09.phx.gbl...
Yes. Create a script and deploy it.

--
-oj
RAC v2.2 & QALite!
http://www.rac4sql.net

"Lars Grøtteland" <lars@nospam> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Hello!

Was wondering how I can create a copy of one database? FYI I'm not
interrested in the data, just the fields and triggers, and so on.

Which way is the easiest? Do I create a script and run it from there?
Is it
smart to have it inside a SP?

Any idea would be greatly appreciated.

I'm programming SQL 2k and VC7.0

--
- Lars



Nov 16 '05 #5
If you want to do it from inside you application, use SQL-DMO. You can copy
the complete database without using a script with the Database.Transfer
method, or you can generate a script with the Database.Script method. Both
method have a rather long list of parameters, which is a bit too much to
mention here, but whihc you can find in Books Online. The parameters
basically allow you all the options you have when copying a database or
generating a script from Enterprise Manager.

--
Jacco Schalkwijk
SQL Server MVP
"Lars Grøtteland" <lars@nospam> wrote in message
news:%2***************@TK2MSFTNGP11.phx.gbl...
Yes I know I can do this in QA, but how to do it in my application?

Was thinking of making a SP, inside the model database. I think I've read of this database once - that if I create one SP inside this, this should be
copied to the new database that's been created. Is this a solution?

--
- Lars
"oj" <no**********@home.com> wrote in message
news:uy**************@TK2MSFTNGP09.phx.gbl...
Yes. Create a script and deploy it.

--
-oj
RAC v2.2 & QALite!
http://www.rac4sql.net

"Lars Grøtteland" <lars@nospam> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Hello!

Was wondering how I can create a copy of one database? FYI I'm not
interrested in the data, just the fields and triggers, and so on.

Which way is the easiest? Do I create a script and run it from there?
Is it
smart to have it inside a SP?

Any idea would be greatly appreciated.

I'm programming SQL 2k and VC7.0

--
- Lars



Nov 16 '05 #6
Then I have another trick for you!

I have "GOTO" inside the script. What should I do then?

--
- Lars
"Tibor Karaszi" <ti****************************************@corner stone.se>
wrote in message news:OM**************@TK2MSFTNGP10.phx.gbl...
Yes, stuff from model are copied to a new database. But this seems to be a
real awkward way of doing it. Just generate the scrip and have your
application loop the script file and for each "GO" it encounters in the file is executes what you have built in the buffer so far.

--
Tibor Karaszi, SQL Server MVP
Archive at:
http://groups.google.com/groups?oi=d...blic.sqlserver

"Lars Grøtteland" <lars@nospam> wrote in message
news:%2***************@TK2MSFTNGP11.phx.gbl...
Yes I know I can do this in QA, but how to do it in my application?

Was thinking of making a SP, inside the model database. I think I've read
of
this database once - that if I create one SP inside this, this should be copied to the new database that's been created. Is this a solution?

--
- Lars
"oj" <no**********@home.com> wrote in message
news:uy**************@TK2MSFTNGP09.phx.gbl...
Yes. Create a script and deploy it.

--
-oj
RAC v2.2 & QALite!
http://www.rac4sql.net

"Lars Grøtteland" <lars@nospam> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
> Hello!
>
> Was wondering how I can create a copy of one database? FYI I'm not
> interrested in the data, just the fields and triggers, and so on.
>
> Which way is the easiest? Do I create a script and run it from
there? Is it
> smart to have it inside a SP?
>
> Any idea would be greatly appreciated.
>
> I'm programming SQL 2k and VC7.0
>
> --
>
>
> - Lars
>
>
>



Nov 16 '05 #7
No problem. Just check that the first character after GO (i.e., the third
character as GO must be first two characters on the line) is either blank,
tab or CR or NL (new line).

--
Tibor Karaszi, SQL Server MVP
Archive at:
http://groups.google.com/groups?oi=d...blic.sqlserver
"Lars Grøtteland" <lars@nospam> wrote in message
news:uy**************@tk2msftngp13.phx.gbl...
Then I have another trick for you!

I have "GOTO" inside the script. What should I do then?

--
- Lars
"Tibor Karaszi" <ti****************************************@corner stone.se> wrote in message news:OM**************@TK2MSFTNGP10.phx.gbl...
Yes, stuff from model are copied to a new database. But this seems to be a
real awkward way of doing it. Just generate the scrip and have your
application loop the script file and for each "GO" it encounters in the

file
is executes what you have built in the buffer so far.

--
Tibor Karaszi, SQL Server MVP
Archive at:

http://groups.google.com/groups?oi=d...blic.sqlserver


"Lars Grøtteland" <lars@nospam> wrote in message
news:%2***************@TK2MSFTNGP11.phx.gbl...
Yes I know I can do this in QA, but how to do it in my application?

Was thinking of making a SP, inside the model database. I think I've

read
of
this database once - that if I create one SP inside this, this should

be copied to the new database that's been created. Is this a solution?

--
- Lars
"oj" <no**********@home.com> wrote in message
news:uy**************@TK2MSFTNGP09.phx.gbl...
> Yes. Create a script and deploy it.
>
> --
> -oj
> RAC v2.2 & QALite!
> http://www.rac4sql.net
>
>
>
> "Lars Grøtteland" <lars@nospam> wrote in message
> news:%2****************@TK2MSFTNGP11.phx.gbl...
> > Hello!
> >
> > Was wondering how I can create a copy of one database? FYI I'm not
> > interrested in the data, just the fields and triggers, and so on.
> >
> > Which way is the easiest? Do I create a script and run it from

there?
Is
> it
> > smart to have it inside a SP?
> >
> > Any idea would be greatly appreciated.
> >
> > I'm programming SQL 2k and VC7.0
> >
> > --
> >
> >
> > - Lars
> >
> >
> >
>
>



Nov 16 '05 #8
What's the syntax - or where can I find it in SQL-DMO bol
--
- Lars
"Jacco Schalkwijk" <NO**********@eurostop.co.uk> wrote in message
news:uv**************@tk2msftngp13.phx.gbl...
If you want to do it from inside you application, use SQL-DMO. You can copy the complete database without using a script with the Database.Transfer
method, or you can generate a script with the Database.Script method. Both
method have a rather long list of parameters, which is a bit too much to
mention here, but whihc you can find in Books Online. The parameters
basically allow you all the options you have when copying a database or
generating a script from Enterprise Manager.

--
Jacco Schalkwijk
SQL Server MVP
"Lars Grøtteland" <lars@nospam> wrote in message
news:%2***************@TK2MSFTNGP11.phx.gbl...
Yes I know I can do this in QA, but how to do it in my application?

Was thinking of making a SP, inside the model database. I think I've read
of
this database once - that if I create one SP inside this, this should be copied to the new database that's been created. Is this a solution?

--
- Lars
"oj" <no**********@home.com> wrote in message
news:uy**************@TK2MSFTNGP09.phx.gbl...
Yes. Create a script and deploy it.

--
-oj
RAC v2.2 & QALite!
http://www.rac4sql.net

"Lars Grøtteland" <lars@nospam> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
> Hello!
>
> Was wondering how I can create a copy of one database? FYI I'm not
> interrested in the data, just the fields and triggers, and so on.
>
> Which way is the easiest? Do I create a script and run it from
there? Is it
> smart to have it inside a SP?
>
> Any idea would be greatly appreciated.
>
> I'm programming SQL 2k and VC7.0
>
> --
>
>
> - Lars
>
>
>



Nov 16 '05 #9
In the Books Online index:
objects-SQL-DMO, Database
methods-SQL-DMO, Transfer
objects-SQL-DMO, Transfer
objects-SQL-DMO, Transfer2

I couldn't find any examples in C++, but here is one in VB:
http://sqldev.net/download/sqldmo/80...rEvent.cls.txt

--
Jacco Schalkwijk
SQL Server MVP
"Lars Grøtteland" <lars@nospam> wrote in message
news:uR*************@TK2MSFTNGP10.phx.gbl...
What's the syntax - or where can I find it in SQL-DMO bol
--
- Lars
"Jacco Schalkwijk" <NO**********@eurostop.co.uk> wrote in message
news:uv**************@tk2msftngp13.phx.gbl...
If you want to do it from inside you application, use SQL-DMO. You can

copy
the complete database without using a script with the Database.Transfer
method, or you can generate a script with the Database.Script method. Both
method have a rather long list of parameters, which is a bit too much to
mention here, but whihc you can find in Books Online. The parameters
basically allow you all the options you have when copying a database or
generating a script from Enterprise Manager.

--
Jacco Schalkwijk
SQL Server MVP
"Lars Grøtteland" <lars@nospam> wrote in message
news:%2***************@TK2MSFTNGP11.phx.gbl...
Yes I know I can do this in QA, but how to do it in my application?

Was thinking of making a SP, inside the model database. I think I've

read
of
this database once - that if I create one SP inside this, this should

be copied to the new database that's been created. Is this a solution?

--
- Lars
"oj" <no**********@home.com> wrote in message
news:uy**************@TK2MSFTNGP09.phx.gbl...
> Yes. Create a script and deploy it.
>
> --
> -oj
> RAC v2.2 & QALite!
> http://www.rac4sql.net
>
>
>
> "Lars Grøtteland" <lars@nospam> wrote in message
> news:%2****************@TK2MSFTNGP11.phx.gbl...
> > Hello!
> >
> > Was wondering how I can create a copy of one database? FYI I'm not
> > interrested in the data, just the fields and triggers, and so on.
> >
> > Which way is the easiest? Do I create a script and run it from

there?
Is
> it
> > smart to have it inside a SP?
> >
> > Any idea would be greatly appreciated.
> >
> > I'm programming SQL 2k and VC7.0
> >
> > --
> >
> >
> > - Lars
> >
> >
> >
>
>



Nov 16 '05 #10
THanks!

--
- Lars
"Jacco Schalkwijk" <NO**********@eurostop.co.uk> wrote in message
news:ub**************@TK2MSFTNGP09.phx.gbl...
In the Books Online index:
objects-SQL-DMO, Database
methods-SQL-DMO, Transfer
objects-SQL-DMO, Transfer
objects-SQL-DMO, Transfer2

I couldn't find any examples in C++, but here is one in VB:
http://sqldev.net/download/sqldmo/80...rEvent.cls.txt

--
Jacco Schalkwijk
SQL Server MVP
"Lars Grøtteland" <lars@nospam> wrote in message
news:uR*************@TK2MSFTNGP10.phx.gbl...
What's the syntax - or where can I find it in SQL-DMO bol
--
- Lars
"Jacco Schalkwijk" <NO**********@eurostop.co.uk> wrote in message
news:uv**************@tk2msftngp13.phx.gbl...
If you want to do it from inside you application, use SQL-DMO. You can

copy
the complete database without using a script with the Database.Transfer method, or you can generate a script with the Database.Script method. Both method have a rather long list of parameters, which is a bit too much to mention here, but whihc you can find in Books Online. The parameters
basically allow you all the options you have when copying a database or generating a script from Enterprise Manager.

--
Jacco Schalkwijk
SQL Server MVP
"Lars Grøtteland" <lars@nospam> wrote in message
news:%2***************@TK2MSFTNGP11.phx.gbl...
> Yes I know I can do this in QA, but how to do it in my application?
>
> Was thinking of making a SP, inside the model database. I think I've

read
of
> this database once - that if I create one SP inside this, this should
be
> copied to the new database that's been created. Is this a solution?
>
> --
>
>
> - Lars
>
>
> "oj" <no**********@home.com> wrote in message
> news:uy**************@TK2MSFTNGP09.phx.gbl...
> > Yes. Create a script and deploy it.
> >
> > --
> > -oj
> > RAC v2.2 & QALite!
> > http://www.rac4sql.net
> >
> >
> >
> > "Lars Grøtteland" <lars@nospam> wrote in message
> > news:%2****************@TK2MSFTNGP11.phx.gbl...
> > > Hello!
> > >
> > > Was wondering how I can create a copy of one database? FYI I'm

not > > > interrested in the data, just the fields and triggers, and so on. > > >
> > > Which way is the easiest? Do I create a script and run it from

there?
Is
> > it
> > > smart to have it inside a SP?
> > >
> > > Any idea would be greatly appreciated.
> > >
> > > I'm programming SQL 2k and VC7.0
> > >
> > > --
> > >
> > >
> > > - Lars
> > >
> > >
> > >
> >
> >
>
>



Nov 16 '05 #11

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Antonio Lopez Arredondo | last post by:
hi all !!! I need to copy a folder and its subfolders to another location; which class should I use ? could only find the System.IO.Directory.MOVE but don't know how to COPY. thanks in...
1
by: Serdge Kooleman | last post by:
hi i have Access 2000 database. All id is guid, so it is always unique. several users add data into own copy of this database. then they send .mdb files to me (by e-mail). how to copy the...
4
by: Digital Fart | last post by:
howto make a connection to database available in my classes. What is the best practice when i want to write classes that need a connection to the database? Do i make a conn variable in my...
3
by: Dan Sikorsky | last post by:
How can I install the Portal starter kit to a different Solution/Project name, having a different SQL Server database name? I'd like to start a new solution using the Portal starter kit as a...
4
by: Rainer Queck | last post by:
Hi NG, I am looking for a good way to dynamically generate a bunch of TabPages. I have a list of more or less identical object. For each of these objects I need a user interface. My thought...
6
by: Ian Boyd | last post by:
Every time during development we had to make table changes, we use Control Center. Most of the time, Control Center fails. If you try to "undo all", it doesn't, and you end up losing your identity...
27
by: max | last post by:
Hello, I am a newbye, and I'm trying to write a simple application. I have five tables with three columns; all tables are identical; I need to change some data in the first table and let VB...
7
by: =?Utf-8?B?QVRT?= | last post by:
HOWTO Run multiple SQL statements from ASP/ADO to an Oracle 10g. Please help, I'm trying to write an ASP page to use ADO to run a long query against an Oracle 10g database, to create tables,...
0
by: glubber | last post by:
I have a cronned perl script that runs on a different server. when I try to restore it to the server below things dont copy across correctly. the target server is described below. debian 4.0...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
3
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.