DECLARE @LCount INT,
@LName VARCHAR(30),
@LType INT

SET @LName = 'Gift Certificate'
SET @LType = 2
IF (SELECT COUNT(*) FROM PrinterTypes WITH (NOLOCK) WHERE Name = @LName AND PrinterTypeNumber = @LType) = 0
  IF (SELECT COUNT(*) FROM PrinterTypes WITH (NOLOCK) WHERE Name = @LName) = 0
    AND (SELECT COUNT(*) FROM PrinterTypes WITH (NOLOCK) WHERE PrinterTypeNumber = @LType) = 0
    INSERT INTO PrinterTypes (PrinterTypeNumber, Name) VALUES (@LType, @LName)
  ELSE IF (SELECT COUNT(*) FROM PrinterTypes WITH (NOLOCK) WHERE PrinterTypeNumber = @LType) = 0
    UPDATE PrinterTypes SET PrinterTypeNumber = @LType WHERE Name = @LName
  ELSE
    UPDATE PrinterTypes SET Name = @LName WHERE PrinterTypeNumber = @LType

SET @LName = 'Credit Card'
SET @LType = 3
IF (SELECT COUNT(*) FROM PrinterTypes WITH (NOLOCK) WHERE Name = @LName AND PrinterTypeNumber = @LType) = 0
  IF (SELECT COUNT(*) FROM PrinterTypes WITH (NOLOCK) WHERE Name = @LName) = 0
    AND (SELECT COUNT(*) FROM PrinterTypes WITH (NOLOCK) WHERE PrinterTypeNumber = @LType) = 0
    INSERT INTO PrinterTypes (PrinterTypeNumber, Name) VALUES (@LType, @LName)
  ELSE IF (SELECT COUNT(*) FROM PrinterTypes WITH (NOLOCK) WHERE PrinterTypeNumber = @LType) = 0
    UPDATE PrinterTypes SET PrinterTypeNumber = @LType WHERE Name = @LName
  ELSE
    UPDATE PrinterTypes SET Name = @LName WHERE PrinterTypeNumber = @LType

SET @LName = 'Letter'
SET @LType = 7
IF (SELECT COUNT(*) FROM PrinterTypes WITH (NOLOCK) WHERE Name = @LName AND PrinterTypeNumber = @LType) = 0
  IF (SELECT COUNT(*) FROM PrinterTypes WITH (NOLOCK) WHERE Name = @LName) = 0
    AND (SELECT COUNT(*) FROM PrinterTypes WITH (NOLOCK) WHERE PrinterTypeNumber = @LType) = 0
    INSERT INTO PrinterTypes (PrinterTypeNumber, Name) VALUES (@LType, @LName)
  ELSE IF (SELECT COUNT(*) FROM PrinterTypes WITH (NOLOCK) WHERE PrinterTypeNumber = @LType) = 0
    UPDATE PrinterTypes SET PrinterTypeNumber = @LType WHERE Name = @LName
  ELSE
    UPDATE PrinterTypes SET Name = @LName WHERE PrinterTypeNumber = @LType

SET @LName = 'Confirmation'
SET @LType = 8
IF (SELECT COUNT(*) FROM PrinterTypes WITH (NOLOCK) WHERE Name = @LName AND PrinterTypeNumber = @LType) = 0
  IF (SELECT COUNT(*) FROM PrinterTypes WITH (NOLOCK) WHERE Name = @LName) = 0
    AND (SELECT COUNT(*) FROM PrinterTypes WITH (NOLOCK) WHERE PrinterTypeNumber = @LType) = 0
    INSERT INTO PrinterTypes (PrinterTypeNumber, Name) VALUES (@LType, @LName)
  ELSE IF (SELECT COUNT(*) FROM PrinterTypes WITH (NOLOCK) WHERE PrinterTypeNumber = @LType) = 0
    UPDATE PrinterTypes SET PrinterTypeNumber = @LType WHERE Name = @LName
  ELSE
    UPDATE PrinterTypes SET Name = @LName WHERE PrinterTypeNumber = @LType

SET @LName = 'Slip/Stand'
SET @LType = 9
IF (SELECT COUNT(*) FROM PrinterTypes WITH (NOLOCK) WHERE Name = @LName AND PrinterTypeNumber = @LType) = 0
  IF (SELECT COUNT(*) FROM PrinterTypes WITH (NOLOCK) WHERE Name = @LName) = 0
    AND (SELECT COUNT(*) FROM PrinterTypes WITH (NOLOCK) WHERE PrinterTypeNumber = @LType) = 0
    INSERT INTO PrinterTypes (PrinterTypeNumber, Name) VALUES (@LType, @LName)
  ELSE IF (SELECT COUNT(*) FROM PrinterTypes WITH (NOLOCK) WHERE PrinterTypeNumber = @LType) = 0
    UPDATE PrinterTypes SET PrinterTypeNumber = @LType WHERE Name = @LName
  ELSE
    UPDATE PrinterTypes SET Name = @LName WHERE PrinterTypeNumber = @LType
  
SET @LName = 'Course Certificate'
SET @LType = 10
IF (SELECT COUNT(*) FROM PrinterTypes WITH (NOLOCK) WHERE Name = @LName AND PrinterTypeNumber = @LType) = 0
  IF (SELECT COUNT(*) FROM PrinterTypes WITH (NOLOCK) WHERE Name = @LName) = 0
    AND (SELECT COUNT(*) FROM PrinterTypes WITH (NOLOCK) WHERE PrinterTypeNumber = @LType) = 0
    INSERT INTO PrinterTypes (PrinterTypeNumber, Name) VALUES (@LType, @LName)
  ELSE IF (SELECT COUNT(*) FROM PrinterTypes WITH (NOLOCK) WHERE PrinterTypeNumber = @LType) = 0
    UPDATE PrinterTypes SET PrinterTypeNumber = @LType WHERE Name = @LName
  ELSE
    UPDATE PrinterTypes SET Name = @LName WHERE PrinterTypeNumber = @LType

SET @LName = 'Bon A4'
SET @LType = 11
IF (SELECT COUNT(*) FROM PrinterTypes WITH (NOLOCK) WHERE Name = @LName AND PrinterTypeNumber = @LType) = 0
  IF (SELECT COUNT(*) FROM PrinterTypes WITH (NOLOCK) WHERE Name = @LName) = 0
    AND (SELECT COUNT(*) FROM PrinterTypes WITH (NOLOCK) WHERE PrinterTypeNumber = @LType) = 0
    INSERT INTO PrinterTypes (PrinterTypeNumber, Name) VALUES (@LType, @LName)
  ELSE IF (SELECT COUNT(*) FROM PrinterTypes WITH (NOLOCK) WHERE PrinterTypeNumber = @LType) = 0
    UPDATE PrinterTypes SET PrinterTypeNumber = @LType WHERE Name = @LName
  ELSE
    UPDATE PrinterTypes SET Name = @LName WHERE PrinterTypeNumber = @LType

