Multiple deletes from table

Christopher Jack 1,616 Reputation points


I am wanting to delete mulitple rows, what is rthe best way to go about it.

I currently have

DELETE FROM FactPayment WHERE paymentid 
in ('D1542607',
and CustomerKey is null;

But that doesn seem to work.. error message is

Msg 102, Level 15, State 1, Line 7
Incorrect syntax near 'D375312'.

Any help appreciated.

A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,580 questions
0 comments No comments
{count} votes

1 additional answer

Sort by: Most helpful
  1. Joe Celko 16 Reputation points

    The immediate answer is that you got a quote mark out of place. But your code actually shows some other problems. In a properly designed schema, there would never be a column named anything like "<attribute>_key" under the ISO 11179 naming rules. You're supposed to named data elements by what they are and not by how they are used for. Those postfixes are called attribute properties and they cannot represent metadata. Separation of data from metadata is one of the fundamentals of RDBMS.