We help IT Professionals succeed at work.
Get Started

Help with Delete query in SQL.

84 Views
Last Modified: 2015-03-10
I have a SQL database that populates tables on my local machine.  I then upload this data to a SQL database that is being hosted with Microsoft Azure.  Typically when I am done uploading the data to Azure, I delete it locally.  I do this for backups and to give my clients access to it.

I have one local table that I am having a hard time deleting data from.  I have 4 columns that also constitute the key.   I have a screenshot below.  These four columns will always produce a unique row, however any one of these columns by themselves will not.

Below is an example of data that I want to delete locally.  These are database records that are locally stored and in Azure.  Since they are in Azure, I want to delete them locally.

select c.[statusId], c.[classifierName], c.[className], c.[classValue] 
FROM [dbo].[classifications] c
Inner join [AzureSQL].[MyDb].[dbo].[classifications] ac on 
	c.statusId = ac.statusId 
	and c.classifierName = ac.classifierName
	and c.className = ac.className
	and c.classValue = ac.classVale

Open in new window


How can I update this query to delete my local records?

My local table is [dbo].[classifications]

While my Azure table is [AzureSQL].[MyDb].[dbo].[classifications]

Also, Azure is setup as a linked server.  Any help would be greatly appreciated.
screenshot.jpg
Comment
Watch Question
Senior Developer
CERTIFIED EXPERT
Commented:
This problem has been solved!
Unlock 1 Answer and 3 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE