SQL Server : correct DELETE syntax -
i have this:
select * tblpricing pricing left outer join pub_car.dbo.capvehicles vehicle on pricing.capid = vehicle.cvehicle_id pricing.[type] = 'car' , pricing.source = 'arval' , vehicle.cvehicle_mantext = 'bmw' , vehicle.cvehicle_modtext = '5 series diesel saloon' , cvehicle_mantext not null
that works fine , correct results.
but, how delete same result set. tried
delete tblpricing pricing left outer join pub_car.dbo.capvehicles vehicle on pricing.capid = vehicle.cvehicle_id pricing.[type] = 'car' , pricing.source = 'arval' , vehicle.cvehicle_mantext = 'bmw' , vehicle.cvehicle_modtext = '5 series diesel saloon' , cvehicle_mantext not null
but says, incorrect syntax near 'pricing'
thanks
you have specify table alias first. instead of this:
delete tblpricing pricing ....
this:
delete pricing tblpricing pricing left outer join pub_car.dbo.capvehicles vehicle on pricing.capid = vehicle.cvehicle_id pricing.[type] = 'car' , pricing.source = 'arval' , vehicle.cvehicle_mantext = 'bmw' , vehicle.cvehicle_modtext = '5 series diesel saloon' , cvehicle_mantext not null
Comments
Post a Comment