Invoke-DatabaseBuild doesn't recognize STRING_AGG function SQL2017
afu
Posts: 1 New member
Our current setup for our CI/CD pipeline for database builds is Azure DevOps and SQL Change Automation 4 (having upgraded from DLM). Developers use SQL Source Control for all database updates, running SSMS 2017. We use a PowerShell script with the "Invoke-DatabaseBuild" command and recently added the SQL2017 function STRING_AGG, but the build fails with the following error:
Invoke-DatabaseBuild : 100 batches failed. The first error is ''STRING_AGG' is not a recognized built-in function name.
Incorrect syntax near the keyword 'ORDER'.'
We have updated and confirmed that all the databases on the target server and the LocalDB on the build server have the compatibility level 140. However, the build continues to fail with the error; we have removed the STRING_AGG function in order to keep moving forward but we would like to use more recent SQL functions.
Is there any other way to figure out what is still tying our CI/CD to SQL2014? Any help would be greatly appreciated. Thank you!
We have updated and confirmed that all the databases on the target server and the LocalDB on the build server have the compatibility level 140. However, the build continues to fail with the error; we have removed the STRING_AGG function in order to keep moving forward but we would like to use more recent SQL functions.
Is there any other way to figure out what is still tying our CI/CD to SQL2014? Any help would be greatly appreciated. Thank you!
Tagged:
Answers
If you're using a Windows hosted Agent in your pipeline, you will need to use the latest 2022 agent as this will be running LocalDB 2017, please see https://learn.microsoft.com/en-us/azure/devops/pipelines/agents/hosted?view=azure-devops&tabs=yaml
https://github.com/actions/runner-images/blob/main/images/win/Windows2022-Readme.md
If you're using your own local agent, then you can follow these steps to upgrade your LocalDB
https://stackoverflow.com/questions/26897152/how-do-i-upgrade-sql-server-localdb-to-a-newer-version
Kind regards
Dan Calver | Redgate Software
Have you visited our Help Center?