I have a database whose schema will vary slightly for each client who buys our application. So, some tables and some fields in a table may only exist only for specific clients. However, this appears to cause problems because, when running certain scripts (from SQL Management Studio Express), it spits out an error. Fir example, the following code:
will fail because the field VatNo does not exist in the Client table (because VAT/tax does not apply for this client and the field does not exist).
Is there a way around this other than by making such fields unconditional (i.e. include them for all clients and leave them null for those clients to whom they are irrelevant)?
Code:
IF (SELECT VATapplies FROM Settings) = 'Yes'
BEGIN
UPDATE Client SET VatNo='1234 564 789'
END
Is there a way around this other than by making such fields unconditional (i.e. include them for all clients and leave them null for those clients to whom they are irrelevant)?