[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

I need a query to Delete a SITE_ID entry for a dbo.MERC_SITE in SQL Server 2008

Posted on 2014-04-16
2
Medium Priority
?
197 Views
Last Modified: 2014-04-16
Hello all,

I am needing to run a query to delete an entry from the table dbo.MERC_SITE and am not sure how to go about it.  

I know to use this query when I need to change the SITE_ID from one to another when a mistake happens:

use poswest
update dbo.MERC_SITE
set SITE_ID='A5532592'--New Site ID you wish to have.
Where SITE_ID='A5532592'--Old Site ID you are replacing.

But I am not sure how to use a query to delete an entry.  Can someone help me with this?
0
Comment
Question by:IT Tech
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 66

Accepted Solution

by:
Jim Horn earned 2000 total points
ID: 40005282
DELETE FROM dbo.MERC_SITE WHERE Where SITE_ID='A5532592'

Open in new window

Or to make life easy on yourself, bundle the whole thing in a transaction, to make sure both statements succeed or fail together:
BEGIN TRAN tr

update dbo.MERC_SITE
set SITE_ID='A5532592'--New Site ID you wish to have.
Where SITE_ID='A5532592_old'--Old Site ID you are replacing.

DELETE FROM dbo.MERC_SITE Where SITE_ID='A5532592_old'

COMMIT TRAN tr

Open in new window

0
 

Author Comment

by:IT Tech
ID: 40005347
I thank you for the help on this one. I am so glad to have this resource available. Always grateful for the help you provide.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question