Showing posts with label old. Show all posts
Showing posts with label old. Show all posts

Thursday, March 29, 2012

Can I insert into the same table a new row with the "old" row field value?

I'm trying to insert values into the same database from itself.
Essentially, I want to add another row to the table for each row with
reg_cat_id = 3. But in this row, I want the original registration_id
to show up in the new row.
Here is my syntax below - this generates an error:
INSERT INTO Registration_Category
(REG_CAT_ID, REGISTRATION_ID, STAFF_ID,
REGISTRATION_DATE, APPROVAL_STATUS, APPROVEDDATE)
VALUES (90, t1.REGISTRATION_ID, 'test', '05/05/2007', 'Y',
'05/05/2007')
SELECT REGISTRATION_ID, STAFF_ID,
REGISTRATION_DATE, APPROVAL_STATUS, APPROVEDDATE
FROM Registration_Category t1
WHERE (REG_CAT_ID = 3)
ORDER BY REGISTRATION_ID
Any suggestions?On 30 Mar 2006 14:40:12 -0800, Dee wrote:
(snip)
>Here is my syntax below - this generates an error:
>INSERT INTO Registration_Category
> (REG_CAT_ID, REGISTRATION_ID, STAFF_ID,
>REGISTRATION_DATE, APPROVAL_STATUS, APPROVEDDATE)
>VALUES (90, t1.REGISTRATION_ID, 'test', '05/05/2007', 'Y',
>'05/05/2007')
> SELECT REGISTRATION_ID, STAFF_ID,
>REGISTRATION_DATE, APPROVAL_STATUS, APPROVEDDATE
> FROM Registration_Category t1
> WHERE (REG_CAT_ID = 3)
> ORDER BY REGISTRATION_ID
>Any suggestions?
INSERT INTO Registration_Category
(REG_CAT_ID, REGISTRATION_ID, STAFF_ID,
REGISTRATION_DATE, APPROVAL_STATUS, APPROVEDDATE)
SELECT 90, t1.REGISTRATION_ID, 'test',
'20070505', 'Y', '20070505')
FROM Registration_Category AS t1
WHERE REG_CAT_ID = 3
Hugo Kornelis, SQL Server MVP

Tuesday, March 27, 2012

CAN I GET MY DATA BACK AFTER REINSTALLING MSDE

WHEN I REINSTALLED MSDE THE MSQL7/DATA FOLDER HAS MYDB.MDF AND MYDB.LDF FILES IN THERE.
THE NEW INSTALLATION WILL NOT RECOGNISE THESE FROM THE OLD INSTALLATION.
IS THERE ANY WAY TO REINSTATE THESE DBS OTHER THAN FROM THE BACK UP THAT I DID NOT DO?
HOPING AND PRAYING IN YOUR HANDS O LORD GURU.
Hi Lofty,
You can "reattach" the database. Take a look at the sp_attach_db stored proc
in BOL.
Basically, you can just say:
sp_attach_db 'newdbname','pathtomdffile','pathtoldsfile'
HTH,
Greg Low (MVP)
MSDE Manager SQL Tools
www.whitebearconsulting.com
"LOFTY" <anonymous@.discussions.microsoft.com> wrote in message
news:57943C4F-8CC8-4CB8-AC3F-C5B097662168@.microsoft.com...
> WHEN I REINSTALLED MSDE THE MSQL7/DATA FOLDER HAS MYDB.MDF AND MYDB.LDF
FILES IN THERE.
> THE NEW INSTALLATION WILL NOT RECOGNISE THESE FROM THE OLD INSTALLATION.
> IS THERE ANY WAY TO REINSTATE THESE DBS OTHER THAN FROM THE BACK UP THAT I
DID NOT DO?
> HOPING AND PRAYING IN YOUR HANDS O LORD GURU.

Thursday, March 22, 2012

Can I delete BAK and TRN files?

I have an implementation of SQL Server 2000 with a job to
backup a customer database. The backup works file, but
none of the old backup and transaction files are removed
after each backup, so it is consuming a lot of disk
space. I have BAK and TRN files dating back 3 months.
Before I deleted any of the old files, I wanted to make
sure I am okay to do so. Does anyone know of a problem
with manually most of these files, leaving only the most
recent week or two of backups?
Thanks,
Jason... and if the backups are created by a SQL Server maintenance plan, you can
modify it to have the files older than a specified period removed. It's on
the Complete Backup and Transaction Log Backup tabs respectively, Remove
files older than item.
"Linchi Shea" <linchi_shea@.NOSPAMml.com> wrote in message
news:0b4a01c3d932$260faea0$a001280a@.phx.gbl...
> As far as whether deleting the old backup files will do
> any damage to the backup setup (e.g. your maintanance
> plans) is concerned, there is no problem. But you do need
> to make sure that if you ever need them, you can get them
> back (e.g. from your tape backup facility).
> Linchi
> >--Original Message--
> >I have an implementation of SQL Server 2000 with a job to
> >backup a customer database. The backup works file, but
> >none of the old backup and transaction files are removed
> >after each backup, so it is consuming a lot of disk
> >space. I have BAK and TRN files dating back 3 months.
> >Before I deleted any of the old files, I wanted to make
> >sure I am okay to do so. Does anyone know of a problem
> >with manually most of these files, leaving only the most
> >recent week or two of backups?
> >
> >Thanks,
> >
> >Jason
> >.
> >sql

Can I delete BAK and TRN files?

I have an implementation of SQL Server 2000 with a job to
backup a customer database. The backup works file, but
none of the old backup and transaction files are removed
after each backup, so it is consuming a lot of disk
space. I have BAK and TRN files dating back 3 months.
Before I deleted any of the old files, I wanted to make
sure I am okay to do so. Does anyone know of a problem
with manually most of these files, leaving only the most
recent week or two of backups?
Thanks,
JasonAs far as whether deleting the old backup files will do
any damage to the backup setup (e.g. your maintanance
plans) is concerned, there is no problem. But you do need
to make sure that if you ever need them, you can get them
back (e.g. from your tape backup facility).
Linchi
quote:

>--Original Message--
>I have an implementation of SQL Server 2000 with a job to
>backup a customer database. The backup works file, but
>none of the old backup and transaction files are removed
>after each backup, so it is consuming a lot of disk
>space. I have BAK and TRN files dating back 3 months.
>Before I deleted any of the old files, I wanted to make
>sure I am okay to do so. Does anyone know of a problem
>with manually most of these files, leaving only the most
>recent week or two of backups?
>Thanks,
>Jason
>.
>
|||... and if the backups are created by a SQL Server maintenance plan, you ca
n
modify it to have the files older than a specified period removed. It's on
the Complete Backup and Transaction Log Backup tabs respectively, Remove
files older than item.
"Linchi Shea" <linchi_shea@.NOSPAMml.com> wrote in message
news:0b4a01c3d932$260faea0$a001280a@.phx.gbl...[QUOTE]
> As far as whether deleting the old backup files will do
> any damage to the backup setup (e.g. your maintanance
> plans) is concerned, there is no problem. But you do need
> to make sure that if you ever need them, you can get them
> back (e.g. from your tape backup facility).
> Linchi
>

Thursday, March 8, 2012

Can data be retrieved from a SQL LDF file (Log)

I have a database that has a corrupt .MDF file, but
the .LDF file is still accessible. My most recent backup
is a week old. My question is: After I re-create the
database, is there any way I can recover the past weeks
transactions from the .LDF file. No transaction dump has
been done since the last backup, so I would think that
theoretically the week's transactions are still in the LDF
file.If you haven't done any transaction log backups since the most recent
database backup you can now backup the log, restore the full backup and then
restore the transaction log backup.
See Books Online for the details.
--
Jacco Schalkwijk
SQL Server MVP
"SteveB" <steve_brooks@.adp.com> wrote in message
news:430d01c39e52$c1fa2950$7d02280a@.phx.gbl...
> I have a database that has a corrupt .MDF file, but
> the .LDF file is still accessible. My most recent backup
> is a week old. My question is: After I re-create the
> database, is there any way I can recover the past weeks
> transactions from the .LDF file. No transaction dump has
> been done since the last backup, so I would think that
> theoretically the week's transactions are still in the LDF
> file.|||"SteveB" <steve_brooks@.adp.com> wrote in message
news:430d01c39e52$c1fa2950$7d02280a@.phx.gbl...
> I have a database that has a corrupt .MDF file, but
> the .LDF file is still accessible. My most recent backup
> is a week old. My question is: After I re-create the
> database, is there any way I can recover the past weeks
> transactions from the .LDF file. No transaction dump has
> been done since the last backup, so I would think that
> theoretically the week's transactions are still in the LDF
> file.
Yes.
Before restoring back up your log with NOTRUNCATE
BACKUP LOG mydb
TO mydevice1
WITH NOTRUNCATE
RESTORE DATABASE mydb
FROM mydevice2
WITH RESTORE.
That should roll your log file forward.
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.532 / Virus Database: 326 - Release Date: 27/10/2003