Create New Column If It Doesn T Exist
Hello everybody,
today I just want to preserve simple sql which creates column, if it is not created yet in ms sql db. Important feature of this code is indempotency.
IF Col_length('APPayment', 'usrPOSkipped') IS NULL
BEGIN
PRINT '[usrPOAllocated] will be created'
ALTER TABLE appayment
ADD usrposkipped BIT
END
ELSE
BEGIN
PRINT '[usrPOAllocated] already exists'
END
Few explanations. This code will create column usrPOSkipped in table APPayment.
Ready to take your Acumatica customization to the next level? Just like the SQL snippet above ensures seamless and idempotent column creation, our team can help you tailor Acumatica to fit your unique business needs. Whether it’s adding custom fields, optimizing workflows, or building entirely new features, we’ve got you covered. Leave a customization request today and let’s make your Acumatica system work smarter for you!