Put all SQL Stored Procedures in BEGIN TRY > BEGIN TRANSACTION > IF ELSE blocks and use the following as a TEMPLATE
Create an output parameter so the source code can log the error and you can check the DB table for the error.
@ELog_ID int = 0 OUTPUT
SET XACT_ABORT, NOCOUNT ON;
BEGIN TRY
BEGIN TRANSACTION
IF
IF EXISTS (SELECT 'x' FROM People_tbl WHERE Email_Address = @Email_Address)
RAISERROR (N'Person is already in the database.',11,11, 'usr_Person_Add')
--PRINT 'Person is already in the database!'
ELSE
-- CRUD work
END TRY
BEGIN CATCH
--PRINT 'In the Catch Statement'
IF @@trancount > 0 ROLLBACK TRANSACTION
PRINT 'Process has reached the CATCH'
EXECUTE dbo.[usr_InsertErrorInfo];
SELECT @ELog_ID = max(ELog_ID)
FROM ErrorLog_tbl;
END CATCH
Software engineering and business solutions blog featuring SaaS reviews, automation tools, and business insurance guides. Buyer-intent content designed to drive high-quality traffic and conversions.
Wednesday, February 27, 2019
Tuesday, February 26, 2019
PowerShell output to table and text file
Get-SPUser -Web "https://subdomain.domain.com" | format-table -autosize > e:\spusers.txt
https://docs.microsoft.com/en-us/powershell/scripting/overview?view=powershell-6
https://docs.microsoft.com/en-us/powershell/scripting/overview?view=powershell-6
Subscribe to:
Comments (Atom)
Home Lab Security Best Practices
Understanding Home Lab Security Definition and Importance A home lab is a personal environment where individuals set up servers, network...
-
How to clear SharePoint People Picker suggestion cache If you have been SharePoint Site owner long enough, you would have definitely ...
-
Getting the following error (Figure 1): Server Error in '/' Application. ID4014: A SecurityTokenHandler is not registered to ...
-
The problem was that the remote connection needed to utilize Named Pipes, but in order to utilize Named Pipes both the machine hosting the i...