SQL Backup Table And Delte

Dec 20, 2007

this stored proc (sp) should first backup the table if it doesn't exist and then delete all but the most recent 3

View 9 Replies


ADVERTISEMENT

Delte From 3 Table In One Procedure

Jan 9, 2007

HI

I have 3 table
in table 1 i have a ID i use in table 2 and in table 2 i have a ID i use en table 3

In table one i have a datetime field


What i want is to delete all from this 3 table when the datetime value are more than one hour old.

I can delete old from the table one by:
delete from tableName
where datettimeField < dateadd(hour, -1, getdate())

But how do i delete all the records from table 2 and table 3 off course where the ID in table one are the same as in table 2 and the ID in table 2 are the same as in table3

Hope someone can help

LN







View 6 Replies View Related

How To Delte Rows Using Linked Server

Jun 19, 2007

Hi,
I have two mssql databases. I am able to create a linked server.
I want to delete some of the rows using this linked server.

Here HAFEEZ is one mssql database and DPVSQSL is another.So, i want to delete rows from DPVSQL from HAFEEZ using HAFEEZDPVSQL linkedserver.

DELETE OPENQUERY (HAFEEZTODPVSQL, 'SELECT EVENT_SYS_ID FROM DIS_MEASMT_FTR_ACTUAL WHERE EVENT_SYS_ID = ''evesysid0015''');

when i run the query i got the following error.

"Msg 7356, Level 16, State 1, Line 1
The OLE DB provider "SQLNCLI" for linked server "HAFEEZTODPVSQL" supplied inconsistent metadata for a column. The column "EVENT_SYS_ID" (compile-time ordinal 1) of object "SELECT EVENT_SYS_ID FROM DIS_MEASMT_FTR_ACTUAL WHERE EVENT_SYS_ID = 'evesysid0015'" was reported to have a "Incomplete schema-error logic." of 0 at compile time and 0 at run time."

Please note that i am able to query something using this linked server,please see the below query.

SELECT * FROM OPENQUERY (HAFEEZTODPVSQL, 'SELECT EVENT_SYS_ID FROM DIS_MEASMT_FTR_ACTUAL WHERE EVENT_SYS_ID = ''evesysid0015''');

Can anyone please help me regarding this.

Thanks and Regards,
Hafeez.

View 5 Replies View Related

BACKUP LOG Cannot Be Performed Because There Is No Current Database Backup. BACKUP LOG Is Terminating Abnormally.

Jan 31, 2008



Hi there

I'm getting this message on my third automated backup of the transaction logs of the day. Both databases are in full recovery mode, both successfully backed up at 01.00. The transaction logs backed up perfectly happily at 01:30 and 05:30, but failed at 09:30.

The only difference between 05:30 and 09:30's backups is that the log files were shrunk at 08:15 (the databases in question are the ones that sit under ILM2007, and keeping the log files small keeps the system running better).


Is it possible that shrinking the log files causes the database to think that there hasn't been a full database backup?

Thanks

Jane

View 3 Replies View Related

Restoring A Table From Backup Table

Mar 28, 2015

I have a table called Lab_results and I have backed it up to "lab_results_backup032215". how do I restore the back up to the original table. I tried :

select * into Lab_results from lab_results_backup032215

But get error saying the table already exist?

View 5 Replies View Related

Table Backup

Jun 27, 2000

How to export a specific table ?
Export feature is allowing to export the whole database but not table. But i need to take the backup of a specific table to import on a remote server.

Thanks

View 2 Replies View Related

Backup DB, But Without One Table

Aug 3, 2007

Hi,
I have a giant DB that I want to backup. One of it's table is taking a lot of space, and I don't need it in the backup, so I am searching for a way to backup everything but that table in particular.

Does any of you know of a way?
Thanks!

BTW, it's a Microsoft SQL Server 2000 - 8.00.2040 (Intel X86)

View 4 Replies View Related

Get Table From Backup

Apr 25, 2007

i have a backup from yesterday

is there any easy way to restore just one table from the backup?

View 20 Replies View Related

Table Backup

Jan 14, 2008

I have a large table that I need to play with a devise a solution. I want to make a back up copy of it so that if I crash it I can easily restore. What is the best way to backup/restore a single table?

View 2 Replies View Related

Table Backup

Jul 23, 2005

hihow can i create a bak file of single table .And one more doubt ,whether its restorationprocess will be same as its for usual backup(ie full,transactinalbackup).ThanksTV

View 2 Replies View Related

Backup Or Export Of One Table With T-SQL

Jan 23, 2002

is there a quick T-SQL that backup a table to a file
that it is possible to restore the data in the future to the same table ?

Thanks
David

View 4 Replies View Related

Scheduled Job To Backup A Table

Jul 1, 2001

Hi,
I am trying to schedule a job that will backup a table in my database, based on the name which has TABLENAME_mm_yyy that is 3 months old, then delete the table. Basically it is for archiving purposes, with the backup to be held on NT backup for another 12 months, just in case. Can anyone give me sugestions on how to do this - maybe alternatives?
Each monthly table has approx 4 million rows, that are rarely looked at. With other databases competing for space/resources, the thought was to remove these old tables monthly, with the ability to 'restore' them easily if/when required.
Any help or suggestions would be very much appreciated.

View 1 Replies View Related

Restore Only One Table From Backup..

Sep 15, 2000

Hi,

How can I restore just one table from the full backup? It was very easy with 6.5 but I am not sure whether it's possible with 7.0 and if it is possible, how to do it.

Thanks in advance.

View 1 Replies View Related

Backup Table Structure In MS SQL

Dec 6, 2007

I am using Microsoft SQL Server Management Studio Express to connect my MS SQL database.

I have 2 databases, db1 and db2.

recently i have created third database, that is db3.

i wish to have db3 to have the same table structure as db1. how can i export and insert into db3? i only need all tables structure, but not the data.

Thanks.

View 1 Replies View Related

Make A Backup Of A Table

Apr 27, 2007

What is the best way (short of backing up the entire DB) to make a copy of a Table so that It can be easily restored. We have a table that we want to make some serious changes to, but I want to make sure I can restore if if I need to (if the changes don't work)

View 10 Replies View Related

Backup A Single Table ?

Apr 16, 2008

Is there a tool out there to backup only one table at time
in SQL Server 2005 ?

View 9 Replies View Related

Huge Table Backup

May 13, 2008

Hello
i want to ask about the huge table(table with many tera records) backup time cost , any one can help me please in determining the time cost nearly

View 2 Replies View Related

SQL Server Table Backup

Jul 23, 2005

Anybody know how to backup a table with particular range.Ex one column contains date..I need to backup only data belong from date to date.is is possible via programming in C?if yes give example ( don`t tell backup SQL command)RLN

View 2 Replies View Related

BACKUP TABLE(historical)

Jul 20, 2005

How to build a TRIGGER that copies, all the time, the data from the table onwhich the transaction occurs to the historical table?thanksFernand---Outgoing mail is certified Virus Free.Checked by AVG anti-virus system (http://www.grisoft.com).Version: 6.0.659 / Virus Database: 423 - Release Date: 2004-04-15

View 1 Replies View Related

Recover Just One Table From Backup

Sep 6, 2007

I work on sql server 2000.
Is it possble to recover just one table from the database backup ???
I am new to this.

Please let me know.
thanks

View 1 Replies View Related

Restoration Of A Table From Backup

May 15, 2007

Hello there,



I am facing problem in restoring a single table from backup file.



I have taken backup before one week, and now that i lost my data of one table named 'activity' i want to restore its data from backup.



How do i do it? i am not able to restore it.



Regards,

Dev.

View 3 Replies View Related

How To Restore Only One Table From DB Backup(urgent)

Mar 20, 2002

Hi
Is there a way to restore only one table from a DB backup.
I need restore one table not database because I have update others tables in this database.
thanks in advance
kinds regards
Abdel

View 1 Replies View Related

Restoring A Dropped Table - No Backup - HELP!!

Nov 24, 2000

Hello,

I'm in trouble, I have just dropped a table from a sql dbase and now need to recreate it. I have no backup and I am panicking!!! I need to know if I can recrreate them .

Any and all help appreciated

DVNC

View 1 Replies View Related

Load Table From Backup Error...

Jun 7, 2000

I posted this a while back with no responses...does anyone know of another SQL Server discussion site that I can post this question to? I'm still having problems.

TIA,Mike

----8<-----original post--------------
I'm receiving the following error at one of my production sites and can't determine the problem. I'm restoring one table to tempdb, but the LOAD command isn't finding the table definition/address information in SYSOBJECTS for that table. I've ran a dbcc checktable on sysobjects and it's fine. Any other suggestions? (FYI - there are some errors when running a checkdb, but none on sysobjects - a FIX_AL is scheduled to be run soon.).

THX,
Mike

------------------------------------------------------------------------

load table tempdb..acct_map_condition
from disk = 'd:mssqlackupcarman.dump'
with source = 'acct_map_condition'

Msg 4039, Level 10, State 1
Warning, file <1> on device 'd:mssqlackupcarman.dump' was dumped from database 'carman'.
Msg 8409, Level 16, State 1
Invalid source table 'acct_map_condition' specified in LOAD TABLE. Could not find table in SYSOBJECTS in dump. Table load has been aborted for table 'acct_map_condition'.

View 3 Replies View Related

SIngle Table Backup/Restore

May 31, 2002

Hi guys,
How to make single table backup / or Restore individual table from the Database backup file.SQL server 6.5 got an option to do this...Anyone know in SQL 7.0 or 2000
I appreciate ur immediate reply!
Thanks
Rajeev

View 3 Replies View Related

Which System Table Indicates Whether Backup Successful Or Not?

Jul 9, 2001

Is there a Systems Table that tells you whether or not the backup job completed or not? Help?
'

View 3 Replies View Related

Backup A Single Table In Server

Jul 24, 2015

I need to backup a single table in SQL server. I use SQL Server 2008 r2 and this is new for me

View 2 Replies View Related

Help In Table Level Restore/backup

Feb 6, 2008

Hello AllI am currently doing a project on MS SQL Server 2005 where I am inneed of table level backup/restore. I know about FILEGROUP. But inour project using FILEGROUP is not feasible. As far as I know MS SQLServer 2005 does not support Table level restore directly. Moreoverrelational integrity is also matter.Is there any clever trick or 3rd party free software to do table levelrestore/backup? Please Help.Best regardsNasif

View 5 Replies View Related

Can I Restore Only A Table From A Backup File?

Nov 24, 2006

Hi,

i have a backup file , and i saw the wizard to restore the file in sql2005.

But i need to restore only a table.

Is there a wizard for that?

View 11 Replies View Related

Restoring Just A Table From A Full Backup

Jun 15, 2006

is there a way to restore certain tables from a full backup?

View 8 Replies View Related

Dropped Table - Restorring With No Backup - VERY URGENT

Nov 24, 2000

Hello,

I'm in trouble, I have just dropped a table from a sql dbase and now need to recreate it. I have no backup and I am panicking!!! I need to know if I can recrreate them .


If this can't be done let me know I have to bit the bullet

thanx

View 3 Replies View Related

T-SQL (SS2K8) :: Delete Table Records With Backup?

May 2, 2014

using below query

DELETE FROM Table_name
WHERE Date_column < GETDATE() - 30

am able to delete old records morethan 30 days, but i want to results to be saved in file.

before deleting i want to a craete a file and save the to be deleted records.

View 7 Replies View Related

Restore One Table In Database Use Backup File

May 6, 2008

hi

can you posible one tabel restore in database using full backfile

thanks

View 1 Replies View Related







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