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

Popular posts from this blog

twig - Using Twigbridge in a Laravel 5.1 Package -

jdbc - Not able to establish database connection in eclipse -

firemonkey - How do I make a beep sound in Android using Delphi and the API? -