IF EXIST statement for a JDBC Alert
- 5 years ago2 hours ago, Vitor Santos said:Not sure if I'm understanding it correctly but, I believe if it returns an error it'll abort the operation & return you the exception. 
 My suggestion is to use try, catch (via groovy instead)... to predict those possible scenario(s) & don't abort the script without following the remaining operations.Not sure if this will help you, but, just a suggestion :)/emoticons/smile@2x.png 2x" title=":)" width="20" /> Thanks for the response Vitor, 
 Did a little more digging and found the best way to do it (in this case, not necessarily the best way) was to add DECLARE @SQL NVARCHAR(MAX); and then print @SQL at the end so:--PRINT @SQL 
 EXECUTE sp_executesql @SQL
 ENDThis then allowed me to use multiple DB names and it wouldn't error when the DB didn't exist for different server. 
 Thanks
 Jonny

