Thor Logo dbatools

Error

Get-DbaCustomError

Garry Bargsley (@gbargsley), blog.garrybargsley.com

Get-DbaCustomError View Source Garry Bargsley (@gbargsley), blog.garrybargsley.com Windows, Linux, macOS Synopsis Retrieves user-defined error messages from SQL Server instances for auditing and documentation. Description Retrieves all custom error messages that have been added to SQL Server using sp_addmessage or through SQL Server Management Studio. These user-defined error messages are stored in the sys.messages system catalog and are commonly used by applications for business logic validation and custom error handling. This function helps DBAs inventory custom errors across multiple instances during migrations, troubleshooting, or compliance audits.

Read more

New-DbaCustomError

Adam Lancaster, github.com/lancasteradam

New-DbaCustomError View Source Adam Lancaster, github.com/lancasteradam Windows, Linux, macOS Synopsis Creates custom error messages in SQL Server’s sys.messages table for standardized application and stored procedure error handling Description Creates custom error messages in SQL Server’s sys.messages table using sp_addmessage, enabling standardized error handling across applications and stored procedures. This replaces the need to manually execute sp_addmessage for each custom message you want to define. Custom error messages are essential for application development and database maintenance workflows where you need consistent, meaningful error reporting.

Read more

Remove-DbaCustomError

Adam Lancaster, github.com/lancasteradam

Remove-DbaCustomError View Source Adam Lancaster, github.com/lancasteradam Windows, Linux, macOS Synopsis Removes user-defined error messages from the sys.messages system catalog Description Removes custom error messages that applications have added to SQL Server’s sys.messages catalog, cleaning up obsolete or unwanted user-defined messages with IDs between 50001 and 2147483647. This is essential when decommissioning applications, cleaning up test environments, or managing custom error message lifecycles during application deployments. You can remove messages for specific languages or all language versions of a message ID at once.

Read more