DECLARE @YieldText VARCHAR(50)

SELECT @YieldText = KeyValue from HotelSetup where SearchKey = 'ProductColor1Text'
SET @YieldText = ISNULL(@YieldText, '')
IF @YieldText <> ''
BEGIN
	UPDATE Color
	SET YieldFilterText = @YieldText,
	YieldFilterColor = 1
	FROM COLOR c
	INNER JOIN ColorRGB cr ON c.FK_ColorRGBID = cr.ColorRGBID AND
	((256 * 256 * BLUE) + (256 * GREEN) + RED) = CONVERT(INT, 0x008000)
END

SET @YieldText = ''
SELECT @YieldText = KeyValue from HotelSetup where SearchKey = 'ProductColor2Text'
SET @YieldText = ISNULL(@YieldText, '')
IF @YieldText <> ''
BEGIN
	UPDATE Color
	SET YieldFilterText = @YieldText,
	YieldFilterColor = 1
	FROM COLOR c
	INNER JOIN ColorRGB cr ON c.FK_ColorRGBID = cr.ColorRGBID AND
	((256 * 256 * BLUE) + (256 * GREEN) + RED) = CONVERT(INT, 0x00FFFF)
END

SET @YieldText = ''
SELECT @YieldText = KeyValue from HotelSetup where SearchKey = 'ProductColor3Text'
SET @YieldText = ISNULL(@YieldText, '')
IF @YieldText <> ''
BEGIN
	UPDATE Color
	SET YieldFilterText = @YieldText,
	YieldFilterColor = 1
	FROM COLOR c
	INNER JOIN ColorRGB cr ON c.FK_ColorRGBID = cr.ColorRGBID AND
	((256 * 256 * BLUE) + (256 * GREEN) + RED) = CONVERT(INT, 0x0000FF)
END

SET @YieldText = ''
SELECT @YieldText = KeyValue from HotelSetup where SearchKey = 'ProductColor4Text'
SET @YieldText = ISNULL(@YieldText, '')
IF @YieldText <> ''
BEGIN
	UPDATE Color
	SET YieldFilterText = @YieldText,
	YieldFilterColor = 1
	FROM COLOR c
	INNER JOIN ColorRGB cr ON c.FK_ColorRGBID = cr.ColorRGBID AND
	((256 * 256 * BLUE) + (256 * GREEN) + RED) = CONVERT(INT, 0xFF0000)
END

SET @YieldText = ''
SELECT @YieldText = KeyValue from HotelSetup where SearchKey = 'ProductColor5Text'
SET @YieldText = ISNULL(@YieldText, '')
IF @YieldText <> ''
BEGIN
	UPDATE Color
	SET YieldFilterText = @YieldText,
	YieldFilterColor = 1
	FROM COLOR c
	INNER JOIN ColorRGB cr ON c.FK_ColorRGBID = cr.ColorRGBID AND
	((256 * 256 * BLUE) + (256 * GREEN) + RED) = CONVERT(INT, 0x6B05A5)
END

SET @YieldText = ''
SELECT @YieldText = KeyValue from HotelSetup where SearchKey = 'ProductColor6Text'
SET @YieldText = ISNULL(@YieldText, '')
IF @YieldText <> ''
BEGIN
	UPDATE Color
	SET YieldFilterText = @YieldText,
	YieldFilterColor = 1
	FROM COLOR c
	INNER JOIN ColorRGB cr ON c.FK_ColorRGBID = cr.ColorRGBID AND
	((256 * 256 * BLUE) + (256 * GREEN) + RED) = CONVERT(INT, 0x800000)
END

SET @YieldText = ''
SELECT @YieldText = KeyValue from HotelSetup where SearchKey = 'ProductColor7Text'
SET @YieldText = ISNULL(@YieldText, '')
IF @YieldText <> ''
BEGIN
	UPDATE Color
	SET YieldFilterText = @YieldText,
	YieldFilterColor = 1
	FROM COLOR c
	INNER JOIN ColorRGB cr ON c.FK_ColorRGBID = cr.ColorRGBID AND
	((256 * 256 * BLUE) + (256 * GREEN) + RED) = CONVERT(INT, 0x00FF00)
END

SET @YieldText = ''
SELECT @YieldText = KeyValue from HotelSetup where SearchKey = 'ProductColor8Text'
SET @YieldText = ISNULL(@YieldText, '')
IF @YieldText <> ''
BEGIN
	UPDATE Color
	SET YieldFilterText = @YieldText,
	YieldFilterColor = 1
	FROM COLOR c
	INNER JOIN ColorRGB cr ON c.FK_ColorRGBID = cr.ColorRGBID AND
	((256 * 256 * BLUE) + (256 * GREEN) + RED) = CONVERT(INT, 0xFF00FF)
END

SET @YieldText = ''
SELECT @YieldText = KeyValue from HotelSetup where SearchKey = 'ProductColor9Text'
SET @YieldText = ISNULL(@YieldText, '')
IF @YieldText <> ''
BEGIN
	UPDATE Color
	SET YieldFilterText = @YieldText,
	YieldFilterColor = 1
	FROM COLOR c
	INNER JOIN ColorRGB cr ON c.FK_ColorRGBID = cr.ColorRGBID AND
	((256 * 256 * BLUE) + (256 * GREEN) + RED) = CONVERT(INT, 0xA86FA8)
END