473,394 Members | 1,715 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 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 1933
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.