473,785 Members | 2,924 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1971
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******** ********@TK2MSF TNGP11.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******** ******@TK2MSFTN GP11.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**********@h ome.com> wrote in message
news:uy******** ******@TK2MSFTN GP09.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******** ********@TK2MSF TNGP11.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******** *******@TK2MSFT NGP11.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**********@h ome.com> wrote in message
news:uy******** ******@TK2MSFTN GP09.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******** ********@TK2MSF TNGP11.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.Transf er
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******** *******@TK2MSFT NGP11.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**********@h ome.com> wrote in message
news:uy******** ******@TK2MSFTN GP09.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******** ********@TK2MSF TNGP11.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************ *************** *************@c ornerstone.se>
wrote in message news:OM******** ******@TK2MSFTN GP10.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******** *******@TK2MSFT NGP11.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**********@h ome.com> wrote in message
news:uy******** ******@TK2MSFTN GP09.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******** ********@TK2MSF TNGP11.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******** ******@tk2msftn gp13.phx.gbl...
Then I have another trick for you!

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

--
- Lars
"Tibor Karaszi" <ti************ *************** *************@c ornerstone.se> wrote in message news:OM******** ******@TK2MSFTN GP10.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******** *******@TK2MSFT NGP11.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**********@h ome.com> wrote in message
news:uy******** ******@TK2MSFTN GP09.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******** ********@TK2MSF TNGP11.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**********@e urostop.co.uk> wrote in message
news:uv******** ******@tk2msftn gp13.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.Transf er
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******** *******@TK2MSFT NGP11.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**********@h ome.com> wrote in message
news:uy******** ******@TK2MSFTN GP09.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******** ********@TK2MSF TNGP11.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******** *****@TK2MSFTNG P10.phx.gbl...
What's the syntax - or where can I find it in SQL-DMO bol
--
- Lars
"Jacco Schalkwijk" <NO**********@e urostop.co.uk> wrote in message
news:uv******** ******@tk2msftn gp13.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.Transf er
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******** *******@TK2MSFT NGP11.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**********@h ome.com> wrote in message
news:uy******** ******@TK2MSFTN GP09.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******** ********@TK2MSF TNGP11.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

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

Similar topics

1
3358
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 advance, ant
1
2606
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 new data in my database? and yes, i want to do it by pressing the button in my C# application... i have just 2 tabes in db, schema is always the same...
4
4889
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 main() and give it as a parameter to every object i make that needs access to the database ex.
3
1740
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 beginning point, and adapt it to what my customer needs. -- Dan Sikorsky, MSCS BSCE BAB
4
3169
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 is, to provide a TabPage for every object with controls on it to interact with them. How can that be achieved dynamically. The only way I can think of to do this is to prepare the max needed TabPages
6
5935
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 seed, or your constraints, or your triggers, or your table. Talking to developers at other companies who have had the misfortune of using DB2, they are adamant that you cannot use the tools; they are buggy and you just have to resign yourself to...
27
3796
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 updates the same data in all other four tables in the right places. I know it would be possible by using the ForeignKeyConstraint object. I have created the tables using the DataSet Visual Tool and I know it doesn't create any ForeignKeyConstraint obj....
7
20332
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, if they do not already exist. In terms of ASP/ADO, that would be fine in a SQL Server Sense by a simply ASP/Server-Side JavaScript as such: var cnTemp = Server.CreateObject("ADODB.Connection");
0
3283
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 - Linux testbox.jumboentertainment.com.au 2.6.18-4-686 #1 SMP Mon Mar 26 17:17:36 UTC 2007 i686 GNU/Linux with the latest apt-get installation of postgres
0
10315
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10147
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8968
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7494
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6737
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5379
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4045
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3645
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.