I am creating a SharePoint 2013 workflow project using Visual Studio 2012. I have added a sequence where i need to update some database table. Is it possible to write custom code as a part of workflow? In my case, there is an "If" activity and if the condition is true, then the workflow should update the database table.
You can write your Custom activity to write your custom code. You can follow following link to write your custom code activity.
Other approach would be write a WCF service to update the data in your service and call that service from your worklfow.