Creating Duplicate Database

Aug 8, 2006

Instead of me testing my scripts on my main commerce database I was wondering if there was an easy way to duplicate my most currnet database as another database...

that way if I screw up I can just delete it and try again

I looked at the restore as in enterpirse manager, but I don't think thats it

View 4 Replies


ADVERTISEMENT

Creating A Duplicate Row?

Sep 17, 2013

I have a table that I'll call 'places'. This is a table of places to visit and might look like this:

id (autoincrement), name, town, latitude, longitude, etc1, etc2, description

1, My barn, Toronto, 43.44, -79,443, y, n, "Country barn"

2, run down house, 46.4432, -79.4322, y, y, "this is an old house that seems to have been forgotten"

4, parking lot, 45.4322, -80,4333, n, n, "An vacant parking lot, overrun with grass"

I'm trying to implement a 'revert' feature sort of like Wikipedia's (Undo) where if someone vandalizes an entry in the table I can revert it. People can edit the description and latitude, longitude. The ID and name generally stay the same.

I'd like to copy the entire row (about 20 columns in a single row, I didn't list them all) to a temporary table or new row. I think using a new row in the same table might not be a good idea because it would cause the autoincrement ID to increase and I plan to delete the temp row when done with it anyway. Don't want too many gaps in the ID field.

Basically I want to have a script (I'll code it myself) that I can approve or disprove the changes to the row. If the changes are invalid (someone has put bad info in, erased the GPS fields, etc) then I just delete the temporary row and nothing changes.

If it's a valid change then I'd have to do something like an UPDATE to update the original row with the info from the temp table.

eg. OLD data from 'places'

2, run down house, 46.4432, -79.4322, y, y, "this is an old house that seems to have been forgotten"

NEW data put into 'places' via UPDATE command:

2, run down house, 46.4342, -79.4222, y, y, "this is an old house that seems to have been forgotten. I have fixed the GPS data that was inauurate."

So it's a matter of updating the old row and deleting the temp table afterwards. I'm not familiar with stored functions or routines in SQL. I use Server Management Studio but only for running queries and viewing the columns - I don't know how to store any routines in the database.

All my code is done simply by sending strings to SQL from Active Server:

sqlst = "insert into table <whatever>"
Set objRs = objCmd.Execute(sqlst)

So if it's possible to accomplish this just through executing a few queries, great. Otherwise I might have to learn how to do a stored routine in SQL.

View 3 Replies View Related

Creating (almost) Duplicate Rows

Aug 6, 2004

Hi everyone, I'm migrating some information for a client at the moment. They had everything in Excel files and I'm getting them into SQL Server. There are some differences in the way I am storing data and the way they were storing data.

For each client they stored, they had something like
Rel1 Rel2 Rel3
100 101 102

Now, what I have is a seperate row for each of Rel1, Rel2 and Rel3 so I would have 3 seperate rows with identical information except for Rel1. So I would have:
Rel1
100
101
102

So one way I thought of doing it was inserting a new row specifying that the value for Rel2 should be stored in Rel1 and for the next row that the value for Rel3 should be stored in Rel1.

Now, I am able to do this but SQL Server inserts an extra row will the NULL value in Rel1. Does anyone know why this would be happening? I think what it is doing is finding a NULL value in Rel3 after creating the two extra rows and is inserting that NULL. So I think I need to check for NULLs and not allow it to create a new row if, say, Rel3 is NULL.

Any pointers are gladly welcome. (I know it's complicated )

View 1 Replies View Related

Creating Duplicate Table

Dec 12, 2006

ravi writes "plz tell me code for
1. i want to create a table with same structure and key value as an existing table.

2. How can i modify the primary key there i new table"

View 1 Replies View Related

Creating Duplicate Table

Aug 9, 2007

Please Help me... How to create duplicate table dynamically(In Code). I have written query like this... select * into table2 from table1. But this creates only structure and data. I need to create along with constraints also(Primary key, default,index). Please help out me....

View 12 Replies View Related

Syntax For Creating Duplicate Table

Nov 29, 2000

Hi
Is there a syntax similar to the oracle in SQL Server?
Oracle statement: create table table2 as select * from table1

which will create table2 with exactly the same structure
and records as table 1

thanks
Liju

View 2 Replies View Related

Creating Duplicate Databases Daily

Nov 6, 2005

I want to be able to create a duplicate database and update / refresh it daily automatically. This database copy would be used for testing purposes so I don't want it to write back to the original database. Is replication of some kind the answer?

View 4 Replies View Related

Reporting Services :: SSRS Subscription Creating Duplicate Job

Jan 4, 2012

We have this sporadic problem where when we go in to save an edit on a SSRS report subscription, it gives us a duplicate job number error.  When I look at the Jobs in the Agent, there are duplicates, so I need to manually delete both duplicate jobs, then the subscription save will work.  If we delete just 1 of the jobs, the issue seems to clear for a while, but then reoccurs.  This has happened to us on multiple reports, but not consistently.  The subscriptions look fine.

View 7 Replies View Related

How Do I Know If There Is A Duplicate Value In Database

Sep 19, 2006

hello, i am creating a user login system. When people register for the site I need a way for sql to check weather or not their is a duplicate username already in the databse. Currently, I am going through the whole member profile table searching for a duplicate name. Is there a better way to do this?

View 6 Replies View Related

Duplicate Of Database

Jul 11, 2013

I want to make a, I want to make an exact replica of one database in sql server 2005 express edition so I have a database called dbTest and I want to create a database called dbTest2 that is the exact replica of dbTest.I am using sql server 2005 express edition.

View 3 Replies View Related

Duplicate Database

Jul 20, 2005

Is there a way to copy/duplicate and rename a database on the same server? Ineed to make a copy for another application. I appreciate any tips or adviceyou can provide!TIA - Rob

View 3 Replies View Related

Duplicate Database

Jun 7, 2006

hi,



I am using SQL Server 2000 and i wanted to know what is the best way to duplicate a database?





View 4 Replies View Related

Duplicate Records On Database

Sep 3, 2007

hi all,
How do i avoid duplicate records on my database? i have 4 textboxes that collect user information and this information is saved in the database. when a user fills the textboxes and clicks the submit button, i want to check through the database if the exact records exist in the database before the data is saved. if the user is registered on the database, he wont be allowed to login. how can i acheive this?
i thought of using the comparevalidator but i'm not sure how to proceed.
thanks

View 2 Replies View Related

Duplicate Database Files

Feb 26, 2001

Hi,

I've got a database called Webmine which is running with multi users.

I want to duplicate it to generate archive.

My problem is that I can't duplicate the MDF file (and the ldf file optionally) without detach the webmine db and reattach after the duplication.

Detach this database is a problem durring this processing of duplication because we can have users always working on Webmine.
Is there a way to proceed without detach Webmine ? Or perhaps it's stupid or dangerous to duplicate a DB if users are always working (that's my position but here, everybody does not agree with this position so can anybody certify
I've got or not reason ?

Thanks to your answers

Best regards
Axel

View 1 Replies View Related

How To Duplicate An Entire Database

Jul 23, 2004

I have built a template database which I'm finally pleased with, however I want to periodically duplicate the design - not data into a new database. How can I duplicate a database? I was hoping to right mouse, copy, then right mouse, paste, and then be prompted for the new name but no such luck.

View 6 Replies View Related

Duplicate Records In The Database

Sep 13, 2006

i have duplicate records, but they have unique ids.

the duplicates resulted as a result of using a view to enter the data using BCP to load data from text file that had many dulicate records as part of consolidting the data i would like to get rid of the duplicate

is there some way of checking if the Name, Address, Telephone and Image are the same as on a record with another then remove them.

the table has the following colunms:

ID, Name, Address, Telephone, Image

1, adam, 45 tree gate road, 00000 000000, adam.jpg
2, uno, 44 garstang road, 00001 000001, uno.jpg
3, adam, 45 tree gate road, 00000 000000, adam.jpg
4, brian, belgarth house, 00022 000022, adam.jpg
5, karen, 3 chester close, 00002 000002, adam.jpg
6, uno, 44 garstang road, 00001 000001, uno.jpg
7, adam, 45 tree gate road, 00000 000000, adam.jpg


from the sample data you can see that there are multiple records is there a way of clensing the data using a sql command?

is there any issues such as performance on clensing it etc?

are there any strategies that should be implemented at the data tier so as to prevent duplication of data?

View 20 Replies View Related

SQL 2000 Q: Duplicate Database

Jul 20, 2005

Hi folksI know just enough about MS-SQL to be dangerous, so feel free to warnme off this it's too much for a non-expert.We are using SQL 2000 as the back-end for website. We would like tocreate a duplicate of the database (on the same server). Then we'd usethem like this:Database A: read-write DB accessed by web administratorDatabase B: read-only 'live' DB accessed by the web serverThe smarts: setting up a way to maintain Database A, have it beaccessible internally (maybe different IP, maybe different port) andwhen a change is approved, have that change replicate to Database B tobe visible on the website.I'm wondering if it's something I can do myself with the rightreading, or I'm going to have to hire some SQL know-how to help meout.Dave

View 1 Replies View Related

CREATE TABLE DUPLICATE OBJECT/DUPLICATE FIELD NAME ERROR Msg 2714

Oct 2, 2007

Hello Everyone:

I am using the Import/Export wizard to import data from an ODBC data source. This can only be done from a query to specify the data to transfer.

When I try to create the tables, for the query, I am getting the following error:




Msg 2714, Level 16, State 4, Line 12

There is already an object named 'UserID' in the database.

Msg 1750, Level 16, State 0, Line 12

Could not create constraint. See previous errors.


I have duplicated this error with the following script:


USE [testing]

IF OBJECT_ID ('[testing].[dbo].[users1]', 'U') IS NOT NULL

DROP TABLE [testing].[dbo].[users1]

CREATE TABLE [testing].[dbo].[users1] (

[UserID] bigint NOT NULL,

[Name] nvarchar(25) NULL,

CONSTRAINT [UserID] PRIMARY KEY (UserID)

)

IF OBJECT_ID ('[testing].[dbo].[users2]', 'U') IS NOT NULL

DROP TABLE [testing].[dbo].[users2]

CREATE TABLE [testing].[dbo].[users2] (

[UserID] bigint NOT NULL,

[Name] nvarchar(25) NULL,

CONSTRAINT [UserID] PRIMARY KEY (UserID)

)

IF OBJECT_ID ('[testing].[dbo].[users3]', 'U') IS NOT NULL

DROP TABLE [testing].[dbo].[users3]

CREATE TABLE [testing].[dbo].[users3] (

[UserID] bigint NOT NULL,

[Name] nvarchar(25) NULL,

CONSTRAINT [UserID] PRIMARY KEY (UserID)

)



I have searched the "2714 duplicate error msg," but have found references to duplicate table names, rather than multiple field names or column name duplicate errors, within a database.

I think that the schema is only allowing a single UserID primary key.

How do I fix this?

TIA

View 4 Replies View Related

Search For Duplicate Entery In Database

Apr 11, 2007

Hi I have created a simple application base on the video based on the 'SQL Server 2005 Express for Beginners' video No. 8.It is working great but I would like to add another feature; if an emial address (in my case userName)  is entered that already exists in the database I would like to display an message say you have already subscrided.How do I search the database for a duplicate email address? Please keep it simple I am still finding my feet with aspx and c#.Cheers   protected void Wizard1_FinishButtonClick(object sender, WizardNavigationEventArgs e)
{
SqlDataSource profilesDataSource = new SqlDataSource();

profilesDataSource.ConnectionString = ConfigurationManager.ConnectionStrings["profilesConnectionString1"].ToString();

profilesDataSource.InsertCommandType = SqlDataSourceCommandType.Text;

profilesDataSource.InsertCommand = "INSERT INTO staffprofiles (userName, fullName, nickName, favouriteSaying, memorableMoment, song, farewell) VALUES (@userName, @fullName, @nickName, @favouriteSaying, @memorableMoment, @song, @farewell)";

profilesDataSource.InsertParameters.Add("userName", userNameTextBox.Text);
profilesDataSource.InsertParameters.Add("fullName", fullNameTextBox.Text);
profilesDataSource.InsertParameters.Add("nickName", nickNameTextBox.Text);
profilesDataSource.InsertParameters.Add("favouriteSaying", favSayingTextBox.Text);
profilesDataSource.InsertParameters.Add("memorableMoment", memMomentTextBox.Text);
profilesDataSource.InsertParameters.Add("song", songTextBox.Text);
profilesDataSource.InsertParameters.Add("farewell", farewellTextBox.Text);

int rowsAffected = 0;

try
{
rowsAffected = profilesDataSource.Insert();
}
catch (Exception ex)
{
// Report a problem
Server.Transfer("submit_problem.htm");
}
finally
{
profilesDataSource = null;
}

if (rowsAffected != 1)
{
// Report a problem
Server.Transfer("submit_problem.htm");
}
else
{
// Everything was OK
Server.Transfer("submit_success.aspx");
}

View 3 Replies View Related

Preventing Duplicate Database Entries

Jan 31, 2006

Hi all.. I've been scouring the forums for about 6 hours to no
avail.  This is a really simple question.  I'm trying to have
a registration page that lets the user input name, email, desired
username, and password.  I want to check the username and email
fields to make sure ppl cannot sign up twice.  So from what I've
gathered I have a couple of options:

1) i can set up a unique constraint on the database columns,
2) i can run a select statement before inserting,
3) i can store the whole database column in a variable then search through it.

My question is how to do option 2?  All of my transactions are through a sqldatasource object in c#.

View 6 Replies View Related

Duplicate Data In Multiple Database

Apr 11, 2001

Our programs have and would like to continue keep the same data in multiple database. Example phone numbers. Us DBAs are tring to convince them not to.

Other than keeping the data current, what avantages are there to keep data in one location for multiple application to access.

View 3 Replies View Related

Duplicate A Database Using Restore Backup

Feb 2, 2000

Hi all,

I want to transfer a database from one MS SQL Server 7.0 to another.
When I create a new database (SQL Server 7.0) and then try to load a backup, I always end up with a message that the backup database is not identical with the destination database. That is correct and I know it, so what!? Is there any other possibility to transfer a database other than Export/Import. Using this method took me about 48 hours for 6 GByte database!

All suggestions are welcome
Thank you
Karsten

View 3 Replies View Related

Excel To DataBase (Duplicate Recoards)

Aug 1, 2007



for example i exported student table with sno as (PK)

how to handle the upload twise (som of the records already in the data base )


1) How to ignore the existing records in the database
2) How to modify the records which is already exist in the database

1) EXCEL DATA SOURCE(STUDENT.XLS)
2) DATA CONVERSION
3) DESTINATION DATABASE (SQL SERVER 2005 STUDENT TABLE)


this is i have please tell me how to ignore/update the exisitng records


koti

View 3 Replies View Related

Duplicate Table Structures To A New Database

Aug 7, 2007

Hi all expert,

Question as stated title above, how do I duplicate the table structure to another database whether it copies all columns, primary and foreign keys, default values, descriptions, constraints, indexes

Many thanks for the help.

regards,

View 8 Replies View Related

Creating Database From Stored Proc With Variable Holding The Database Name

Aug 16, 2007

Here is my code


ALTER PROCEDURE Test
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;

DECLARE @From varchar(10)
DECLARE @To varchar(10)
DECLARE @DBName varchar

SELECT TOP 1 @From = CONVERT(char,CreateDate,101) FROM CustomerInfo
WHERE TicketNum =
(SELECT TOP 1 TicketNum FROM CustomerInfo
WHERE CreateDate <= DATEADD(mm, -30, CURRENT_TIMESTAMP)
ORDER BY CreateDate DESC)
SELECT @To = CONVERT(char,GETDATE(),101)

SET @DBName = 'Archive_SafeHelp'
CREATE DATABASE @DBName + ' ' + @From + ' ' + @To
END


I am trying to create a database based on the name contained in the variables. I get the error 'Incorrect syntax near '@DBName'. How do i accomplish this?

Thanks
Ganesh

View 2 Replies View Related

SQL Express: Duplicate, Rename And Copy A Database

Jun 18, 2008

Hi,
first of all escuse my English. I'm new to SQL Server, my experience is with MySQL, Interbase and Firebird, but now I have a new job so I need to use SQL Server, version 2005 Express.
I have two SQL 2005 Express installations in two different machines (local and remote). I can access both servers via SQL Management Studio
I need to do the following:
1) Create a copy of a database with a new name in the same machine (local).
2) Copy the new renamed database to another host (remote)
Please help me, remember I use Express edition.

Thanks in advance.

Giorgio

View 1 Replies View Related

Unable To Delete Duplicate Records In Database

Jul 20, 2005

Hi,I have an sql database that has the primary key set to three fields,but has not been set as unique(I didn't create the table).I have 1 record that has 2 duplicates and I am unable to delete theduplicate entries.If I try to delete any of the three records(they are identical) I getthe message 'key column is insufficient or incorrect. Too many rowswere affected by update'.I am trying to do this within Enterprise Mgr.Any suggestion?Thanks much

View 2 Replies View Related

Guidelines For Creating A Database Snapshot On A Mirror Database

Nov 24, 2006

Hi guys, can I know the steps on creating a database snapshot on a mirror database? Thx for the assistance. :)



Best Regards,

Hans

View 1 Replies View Related

Insert From Formview And Checking Database To Avoid A Duplicate Entry

Apr 6, 2007

I have a form view that I am using to insert new data into a sql express database and would like to find a way to avoid attempting to insert a record if the key already exists.  is there a way to do this with the formview insert command.  Everything works great until I try to add a record with an already existing value in the unique key field, then it breaks.

View 1 Replies View Related

Delete Duplicate Entries From Tables In My Database Using Query Analyzer

Jun 25, 2004

Hello,

How can I delete duplicate entries from tables in my database using Query Analyzer, as there are many duplicate entries in my tables, I want to delete them.

Thanks in advance,
Uday.

View 4 Replies View Related

Creating Database

Jun 26, 2006

How do you create a SQL database (Sql Express 2005) in real time using VB.Net 2005 ASP.net 2.0?

View 2 Replies View Related

Creating Database

Dec 4, 2007

I am working on site in asp.net with c# and using database sql server 2000 and managing all  the data on server i have created one database on server and in that i have created 15 table.  should i continue with the same or create another database for table.
tell me how many tables should i maintain in  one database. and what precausion should i take while mainting database to increse the speed of site.and what precausion should i take to avoid serverload
please guide me i dont have an idea.
thanks for spending ur valuable time for me.

View 8 Replies View Related

Need Help On Creating A Database

Nov 21, 2003

Sorry, I'm a newbie out there when it comes to creating database. I currently have an ASP.Net project which requires a database. I spent the past few days thinking about how to create a proper database for the application but to no avail. I think tis thread might be out of point for tis forum, but i am really in need of help.

Here goes the storyline of my database:

The project is an online project management system, meant for students to submit their deliverables (reports, eg. Minutes, agenda, project monitor chart) Lecturers will access the web application to grade the student’s submission. The application must allow administrators to add in new subjects. When a new subject is added, the subject leader will set a dateline for a particular module to be submitted. Eg, minutes dateline. Once the dateline is due, the system will inform the lecturers in charge of who/which group did not submit the module. Lecturers and subject leaders can then generate warning letters to be sent via email to the students involved. Lecturers and subject leaders will be able to make announcements through the system as well.

A student can either submit his/her work as an individual or as a group.
A student will be studying more than 1 subject.
A subject will consist of more than 1 module.
Every module will have a dateline for its submission.
Students can make more than 1 submission for each module.
Students belong to different groups/classes for different subjects.
For different modules, there will be different fields to be inserted into the database.
Example, in the “Minutes module�, the student will have to be able to key in the objectives, the date of the meeting, the venue, its members, absent members, actual minutes, action by and meeting end time.

In the “Project monitor chart module�, the student will have to key in the week/date, the name of the member, task involved, as well as the status.

When a new subject is created, the subject leader will have to specify the percentage of each different module. (Eg, Exams – 40%, Term test 15%, and so on.)

A subject will also be taught by more than 1 lecturer. So subject leader will specify the lecturers teaching that particular subject.


I hope someone out there can help me out on the construction of a database for the above storyline. Thanks a lot.

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved