troubleshooting Question

How would you modify the following SQL Server 2008 stored procedure to prevent it's execution if the value being inserted into the field "BRANCH" is a duplicate ? Branch is the Primary Key.

Avatar of zimmer9
zimmer9Flag for United States of America asked on
Microsoft SQL Server
2 Comments1 Solution65 ViewsLast Modified:
How would you modify the following SQL Server 2008 stored procedure to prevent it's execution if the value being inserted into the field "BRANCH" is a duplicate value because "branch" is the Primary Key?

ALTER PROC [dbo].[proc_CSL_Insert_branch]
(@strBranch varchar(3), @strRegion varchar(2), @txtRollup varchar(6), @txtCenter varchar(6),
@txtManager varchar(45), @txtBraddress varchar(50), @txtCity  varchar(35), @txtState varchar(2), @txtZip varchar(10),
@txtPhone varchar(12), @txtFax varchar(12), @txtAssistant varchar(35), @txtMemo varchar(50),  
@txtBrname varchar(50), @txtEmailaddr varchar(50), @txtType varchar(1), @chkStatus bit)  
AS
INSERT INTO dbo.tbl_CSL_Branches (branch, region, rollups, center,  manager, Braddress, city,  states,  zip,
phone, fax,  assistantnm,  memo, branchname, EMAILADD, typ,  closed)
VALUES (@strBranch, @strRegion, @txtRollup, @txtCenter, @txtManager, @txtBraddress, @txtCity, @txtState, @txtZip,
@txtPhone, @txtFax, @txtAssistant, @txtMemo, @txtBrname, @txtEmailaddr, @txtType, @chkStatus)
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 1 Answer and 2 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros