Move Table Records Into New Database In The Same Server
Aug 2, 2007
I have a question here.
I have a Audit tables database. I want to archive the Audit Tables data to another new database in the same server and remove the data in the Actual database but continues with the table seed where it's the primary ID.
Example:
I have a AuditProducts Table with AuditID as BIGINT and auto increment value.
contains10,000 records in AuditTable Database.
I want to archive the tables to a new database: Audit200707
After archived, the AuditProducts Table in AuditTable database will remove all the records and continues with 10001 in the next record.
How can I done the whole process using T-SQL so that it can schedule and run for every month? BTW I am using SQL Server 2005 SP2.
Thanks and regards,
View 5 Replies
ADVERTISEMENT
Jun 30, 2000
Here is the sql code I am using. However this code adds duplicate records. It adds the record and exactly one extra record... any help would be greatly appreciated...
It's wrapped in a little ASP code:
sql2 = "INSERT INTO prodcampsignup " &_
"(Camp_ID,UserName,Password,CampName,Host,Director ,Contact,Address, " &_
"City,State,Zip,Country,Phone,AlternatePhone,Fax,C ontactEmail,AdminEmail, " &_
"URL,CampProfile, InsertTime)" &_
"SELECT * FROM tempcampsignup WHERE Camp_ID = " & lastid
View 2 Replies
View Related
Feb 7, 2008
I wanted to set up a mechanism that would transfer blocks of records (a few dozen to in rare cases a few thousand), with slight modification, from one database to another. It's a sort of custom partial archiving process that would be triggered from a web-based admin application in plain old ASP (not .net alas). Records in the target db would be identical except:
-- the primary key in the source table, an identity field, would be just an integer in the target table
-- the target table has an extra field, an integer batch ID supplied by the web application that triggers the process
It's a simple, if not efficient matter to do it within the web application: query the source table, suck the records into memory, and insert them one by one into the target db. This will be an infrequent process which can be done at off-hours, so a bit of inefficiency is not the end of the world. But I wondered if there is a more sensible, orthodox approach:
-- Could this process be done, and done efficiently, as a stored procedure with the batch ID passed as a parameter?
-- Is there any way to do a bulk insert from a recordset or array in memory using plain ASP, ADO and SQL? And if so, is that better than inserting records one by one?
I realize that the ASP.NET tableadapter and dataset features might provide a good solution, but in the short run I can't rewrite the whole application. Advice on the best general approach from an ASP-ADO platform would be appreciated, and I will try to figure out the details.
View 3 Replies
View Related
Apr 4, 2007
If I run an UPDATE query on a table which is partitioned by the column I am updating - will the records be moved to another partition?
ie. I have a table where Historical bit column marks whether a particular record should go to Partition1 (=0) or Partition2 (=1). Now, I update a record in that table and change the Historical column value from 0 to 1. What happens with that record?
View 3 Replies
View Related
Jun 30, 2004
Hi, all I got one stupid question in mind. The idea is that I want my SQL database to install into another computer. The best way for me is I want to create a script file for creating tables, triggers, stored procedure. But I want all the SQL statement that insert all the records in to each table too.
Does anyone have a solution for me? Or there be other way?
I am always waiting for ur suggestion.
View 2 Replies
View Related
Jun 21, 2008
hello everybody,
how can I move (or copy) a table from one database to another database in ms sql server? does a syntax code exist for that operation.
thanks a lot
temp
View 4 Replies
View Related
Aug 24, 2015
I'm trying to delete some records from some tables in a SQL Server 2008 R2 database. There's a foreign key relationship between the two tables. To make things easier here's the definition of both tables:
-- Parent table
CREATE TABLE [dbo].[PharmInvInItemPackages](
[InventoryInDetailID] [int] IDENTITY(1,1) NOT NULL,
[InventoryInID] [int] NOT NULL,
[ItemPackageID] [int] NOT NULL,
[code]....
View 5 Replies
View Related
Jan 23, 2007
Hi,
I am relatively new to this stuff.
I am using Microsoft SQL Server Management Studio Express (9.00.1399.00)
Can someone tell me the way to get a table and its content to another database (I use two at webhosts4life)
Or perhaps a way to export the data of a table so I can do it at a later stage.
Is that at all possible with this program or do I have to use the non-express version?
Thanks in advance,
Lex
View 4 Replies
View Related
Aug 11, 2015
Table1 contains fields Groupid, UserName,Category, Dimension
Table2 contains fields Group, Name,Category, Dimension (Group and Name are not in Table1)
So basically I need to read the records in Table1 using Groupid and each time there is a Groupid then select records from Table2 where Table2.Category in (Select Catergory from Table1)
and Table2.Dimension in (Select Dimension from Table1)
In Table1 There might be 10 Groupid records all of which are different.
View 9 Replies
View Related
Mar 21, 2008
Hi all,
I have worked mostly in oracle, and new to sql server. I am trying to move a very small table from oracle database to sql server database. I see a different methods I can do this, I guess DTS etc.
I tried import wizard in SSMS, I was not succesful in that.
Can any expert suggest me any possible ways of doing this the best way? Thank you very much!
View 5 Replies
View Related
Nov 9, 2000
Hi there!
I am fairly new to SQL Server 7. I have a SQL server database on one machine (box A).
Now I installed a new box with SQL server on it (box B).
How do I move the database from box A to box B?
What are the steps involved? What is the easiest way to do it?
What files need to be copied over?
Thanks,
Helmut
View 3 Replies
View Related
Dec 7, 2007
What is the best and safest way to move all databases(almost 500GB total) from our existing server(2000) to the new server(2005).and What about the jobs and SSIS(DTS) Packages.Thanks
View 5 Replies
View Related
Jul 5, 2007
Hey,
To reduce the load on my current server I wish to move a table which is being updated frequently by a static feed to an independant server.
Is there any way of moving a table with all of it's dependancies (Stored procedures and other tables) to another server without manually finding them all.
I'm very new to this as you can tell so if you require specifics let me know :)
Jim
View 2 Replies
View Related
Jan 8, 2004
Currently I'm working on my Desktop computer but I wanna put all my data to my laptop so that I could continue my work on my laptop.
How can I transfer my SQL Server database to my laptop?
View 3 Replies
View Related
Jul 30, 2004
Anybody can give me a reference about how to move database from Oracle to Sql Server.
View 2 Replies
View Related
Jul 14, 2007
I am running SQL Server 2000.
I have about 300 tables scattered across 3 databases that I am trying to consolidate into a single database. There are other tables within these 3 databases that I don't wish to consolidate (so I don't want to copy the full database).
What are my options to move these tables to the consolidated database?
Are there options beyond, the pain and extensive run-time of copying from the DTS wizard into the new database (plus the indices won't copy will they?) or writing code that creates tables in the new database, populates them with data from the old tables and then deletes the old tables?
My understanding is sp_rename won't work with two separate databases --i.e., your destination db must be the same as the db of the object you are renaming. (if my understanding is wrong, that would seem to be the easiest way to accomplish this)
Thanks,
View 4 Replies
View Related
Nov 7, 2007
Hi,
Here is the situation:
My SQL server is in B'lore. I need to transfer the Database from the B'lore server to a new Server in California.
Kindly let me know how it could be done.
Thanks in advance.
View 2 Replies
View Related
Jul 29, 2014
I have a table attendance_details in both database DB1 and DB2, i need to move 01/7/14 and 02/7/14 records from db1 to db2, My table contains
employee_no INT,
date_of_attendance datetime,
present varchar(20),
shift_type VARCHAR(20),
marked_by VARCHAR(50)
View 4 Replies
View Related
Oct 9, 2015
I would like to know that how can I move 70 plus tables that are on sql 7.0 to sql 2012 via SSIS.I know its a two step process but what is the best route and how I can process.
View 0 Replies
View Related
Sep 9, 2015
Is there a way to move the Distribution database (that is currently on the publisher server) to a different server without having to reync the subscriptions.
View 0 Replies
View Related
Jan 29, 2007
HI guys!
I have a Japanese sql server installed in one server..
I want to transfer everything to an English SQL Server version.
Will this be no problem?
Hope you can enlighten me on this one...
Thanks!
View 2 Replies
View Related
Oct 7, 2006
How to import database in SQL server 2005 from the SQL server 2000 ??
View 1 Replies
View Related
Sep 7, 2006
Can anyone refer me to good 'recipes' or sources of information on thistopic??I have Visual Studio Tools for Office, which installs SS 2005 Expresslocally to my XP box, and I want to develop in SS 2005, then copy thetables or queries or reports etc. to a SS 2005 Standard server.Thank you, Tom
View 3 Replies
View Related
Nov 25, 2006
Hi,I need to know the way in which I can copy my sql server 2005 database from one computer to another ?
Please I need a clear and complete explanation ,thanx .
View 2 Replies
View Related
May 13, 2004
I am moving a database from one server to another. I am going to replace the old server to the new one. I heard that you can move the datfiles and put them in the same directory, and sql server will pickup the datafiles based on the system tables. Is this possible, and what are the steps to get this to work. Thanks for the help in advance.
View 4 Replies
View Related
Sep 14, 2015
I want to to move all database log files from drive E to F .
There are more than 10 databases so I don’t wanna move them 1 by 1 .
At the moment I use detach – attach method .
-Detach db
-Move log file
-Attach db
How do I do this massively in one go ?
View 5 Replies
View Related
Feb 7, 2007
I have two databases in sql server management studio and I want to move tables from one into another. Is this possible? and how? Thanks
Andrew
View 3 Replies
View Related
Oct 18, 2014
I would like to move the data / findings into a perm table?The reason for this is so clients can connect to the table using excel. I have another stored procedure which is setup in this process already and it works well. I basically have the stored procedure setup on a task to run early in the morning so when clients get up they connect and get their data.
USE [MMAUDIT]
GO
CREATE PROCEDURE [dbo].[MMA_AUDIT_QUESTIONS_SUMM_STG] AS
BEGIN
[code]....
View 4 Replies
View Related
Dec 23, 2004
Hi all! I know I might sound stupid, but I have this problem. I have developed my database on my laptop which does not use Active directory. Lets say I access the database with: SPIDERMANDB1 on SQL server, where the name of my laptop is SPIDERMAN, and the database is DB1. Now, I create an SQL script from sql server and make the necessary changes, like changing the computer name to say, SUPERMAN where my deployment server's name is SUPERMAN. But when I run the SQL script on the SUPERMAN server, it gives me an error like: "User or role SUPERMANDB1 does not exist in this database". I have deployed databases in this way on servers without Acive directory, so I'm sure its not a mistake on my side. So how am I supposed to go around this active directory thingi! Please help me out! I'm counting on u guys!
Wes
View 4 Replies
View Related
Nov 10, 2014
I'm trying to find a way to insert data from a TableA on ServerA into TableB on ServerB using SSIS in Visual Studio.
The specification I was given is basically
Insert INTO TableB AS (Select * from TableA WHERE NOT EXISTS on TableB).
I can't use a linked server unfortunately.
I wonder if it possible to move data from tables on a linked server to a "normal database"? What am I doing wrong?
View 4 Replies
View Related
Aug 10, 2007
Hi,
We have an old machine which holds SQL server 2000 database. We need to migrate a whole database to a new machine which has SQL server 2005.
When we tried to move whole database using Import and Export Wizard, only tables can be selected to import/export. However we want to import/export the whole database, including tables, stored procedure, view, etc. Which tool should we use?
Thanks.
View 1 Replies
View Related
Aug 10, 2007
Hi,
We have an old machine which holds SQL server 2000 database. We need to migrate a whole database to a new machine which has SQL server 2005.
When we tried to move whole database using Import and Export Wizard, only tables can be selected to import/export. However we want to import/export the whole database, including tables, stored procedure, view, etc. Which tool should we use?
Thanks.
View 5 Replies
View Related
Apr 16, 2015
I am using SQL Server 2012 SE.I am trying to delete rows from a couple of tables (GetPersonValue has 250 million rows and I am trying to delete 50Million rows and GetPerson has 35 Million rows and I am trying to delete 20 million rows). These tables are in TX replication.The plan is to delete data older than 400 days old.
I tried to move data to new tables from the last 400 days and it took me like 11 hours. If I delete data in chunks of 500000 then its taking a long time to rebuild indexes(delete plus rebuild indexes 13 hours). Since I am using standard edition partition wont work.
find ddl below:
GO
CREATE TABLE [dbo].[GetPerson](
[GetPersonId] [uniqueidentifier] NOT NULL,
[LinedActivityPersonId] [uniqueidentifier] NOT NULL,
[CTName] [nvarchar](100) NULL,
[SNum] [nvarchar](50) NULL,
[PHPrimary] [nvarchar](50) NULL,
[code]....
View 1 Replies
View Related