Link to home
Start Free TrialLog in
Avatar of NigelRocks
NigelRocks

asked on

Varchar and Bit Incompatible??

Experts,

In the attached stored proc, I'm getting this error when I try to compile it:

"The data types varchar and bit are incompatible in the add operator."

What is this?
USE [Gift_Tracker]
GO
/****** Object:  StoredProcedure [dbo].[sp_GiftNew]    Script Date: 12/10/2007 02:48:03 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[sp_GiftNew] 
	@GiftName varchar(75)
	,@GiftDescription varchar(256)
	,@GiftYear DateTime
	,@Occasion varchar(2)
	,@Requested bit
AS
	DECLARE @INSERT varchar(1024)

	SET @INSERT = 'INSERT INTO GIFTS '
	SET @INSERT = @INSERT + '(Gift_Name,Gift_Description,Gift_Year,Occasion,Requested) '
	SET @INSERT = @INSERT + 'VALUES(' + @GiftName + ',' + @GiftDescription  
	SET @INSERT = @INSERT + ',' + @GiftYear + ',' + @Occasion 
	SET @INSERT = @INSERT + ',' + @Requested + ')' 
	
	EXEC (@INSERT)

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Raja Jegan R
Raja Jegan R
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of NigelRocks
NigelRocks

ASKER

It compiles, but I still dont' know why I can't call a bit a bit.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial