This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallShield
- :
- InstallShield Knowledge Base
- :
- SQL Runtime Error trapping - Violation of PRIMARY KEY constraint 'ABC'. Cannot insert duplicate key ...
Subscribe
- Mark as New
- Mark as Read
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
SQL Runtime Error trapping - Violation of PRIMARY KEY constraint 'ABC'. Cannot insert duplicate key in object 'dbo.XZY'. The duplicate key value is (-508)
SQL Runtime Error trapping - Violation of PRIMARY KEY constraint 'ABC'. Cannot insert duplicate key in object 'dbo.XZY'. The duplicate key value is (-508)
Summary
Discussion about options using SQL script view and runtime error trappingSynopsis
There is no native support to trap and then prompt that an error at runtime caused by a SQL script has occurred. For example, if you include a SQL script that errors during runtime there are some options to use in an effort to handle the error case. However, you cannot prompt the user that some error has occurred natively.Discussion
If your script exposes an error at runtime you have options set in the project to Goto Next Script, Goto Next Statement, Abort the Installation or define an override for the scripts default error handling. The last option is achieved when you select 'Custom' and manually set the error handling. Error handling settings are set on the tab 'Runtime' in the IDE.When using 'Custom' you can trap the error and set the specific behavior based on the three mentioned above. For example, to you trap for Violation of PRIMARY KEY constraint you set in the project On Error Abort the Installation, Goto Next Script or Goto Next Statement.
There is a debugging option pre-build. The InstallShield product includes support when/if you have Microsoft SQL Server Management Studio or Microsoft SQL Server 2000 SQL Query Analyzer installed on your system, you can open a new SQL script that you have added to your project to test, edit, and syntax-check the script. To launch one of those tools and open your script from within InstallShield, right-click the script file in the SQL Scripts view and then click Open Script in Microsoft SQL Server Management Studio. InstallShield searches for one of the following tools and launches the first one that it finds:
? Microsoft SQL Server 2008 Management Studio (any edition, including Express; ssms.exe)
? Microsoft SQL Server 2005 Management Studio (SqlWb.exe)
? Microsoft SQL Server 2005 Management Studio Express (ssmsee.exe)
? Microsoft SQL Server 2000 Query Analyzer (isqlw.exe)
Related Documents
Reference Helpnet article: Adding a New SQL ScriptRelated KB Articles
For information about an approach Microsoft documents please see their KB:Error "Violation of PRIMARY KEY Constraint PKRM30301 Cannot Insert Duplicate Key" when running Paid Transaction Removal in Receivables Management
No ratings