Showing posts with label subgroup. Show all posts
Showing posts with label subgroup. Show all posts

Sunday, February 19, 2012

delete records

Hello,

I have a database called articles

I want to delete all articles from a subgroup e.g. DVD

If I am in the enterprisemanager what steps do I have to take to do this

thanks in advance

PaulI would do it in Query Analyzser (from EM you can select Tools, SQL
Query Analyzer)

Something like this:

BEGIN TRAN

DELETE
FROM articles
WHERE subgroup = 'DVD'

SELECT * FROM articles

ROLLBACK TRAN

Once you've verified that it deleted what you expected then change the
ROLLBACK to COMMIT.

Make sure you have a backup.

--
David Portas
SQL Server MVP
--|||Hello David,

thank you for your answer it is exactly what I need

kind regards Paul

"David Portas" <REMOVE_BEFORE_REPLYING_dportas@.acm.org> schreef in bericht
news:1127237303.004486.198620@.g44g2000cwa.googlegr oups.com...
>I would do it in Query Analyzser (from EM you can select Tools, SQL
> Query Analyzer)
> Something like this:
> BEGIN TRAN
> DELETE
> FROM articles
> WHERE subgroup = 'DVD'
> SELECT * FROM articles
> ROLLBACK TRAN
> Once you've verified that it deleted what you expected then change the
> ROLLBACK to COMMIT.
> Make sure you have a backup.
> --
> David Portas
> SQL Server MVP
> --|||UPDATE articles
SET subgroup ='VHS'
WHERE subgroup = 'DVD'

http://sqlservercode.blogspot.com/|||Hello David

Actually I want do also a rename command
this means not delete the record however change all subgroups with DVD in
e.g. VHS

kind regards Paul

"David Portas" <REMOVE_BEFORE_REPLYING_dportas@.acm.org> schreef in bericht
news:1127237303.004486.198620@.g44g2000cwa.googlegr oups.com...
>I would do it in Query Analyzser (from EM you can select Tools, SQL
> Query Analyzer)
> Something like this:
> BEGIN TRAN
> DELETE
> FROM articles
> WHERE subgroup = 'DVD'
> SELECT * FROM articles
> ROLLBACK TRAN
> Once you've verified that it deleted what you expected then change the
> ROLLBACK to COMMIT.
> Make sure you have a backup.
> --
> David Portas
> SQL Server MVP
> --|||I have a similar project

Database called Spot_Movers

table called Files

and column called End_Date

I need delete all records prior to 2/1/2005

I will write this out in Query Analyzer

I am just getting into the whole SQL and I am sort of struggling

TYIA

Drew