Question : SQL Server BIT field true and false

I have a field in a  table in sql server it is of type BIT

I am trying to do an insert in  a stored procedure

BEGIN

INSERT INTO dbo.AccessCodes
(
      AccessCode,
      CodeType,
    Active,
      Assigned
)
VALUES
(
   @AccessCode,
   @BillingMethod,
   true
)
END

I get an error message

The name "true" is not permitted in this context. Valid expressions are constants, constant expressions, and (in some contexts) variables. Column names are not permitted.

I went with 1 and 0

BEGIN

INSERT INTO dbo.AccessCodes
(
      AccessCode,
      CodeType,
    Active
)
VALUES
(
   @AccessCode,
   @BillingMethod,
   1
)
END

Later I want to query

select * from accesscodes where active =false
and get

Invalid column name 'false'.

The column is definitly bit

CREATE TABLE [dbo].[AccessCodes](
      [AccessCode] [varchar](10),
      [CodeType] [varchar](1),
      [Active] [bit] NULL,
....
....
)

What am I doing wrong?  I did try UPPERCASE TRUEand FALSE as well



Answer : SQL Server BIT field true and false

This output doesn't correspond to the code what you have posted above. Show us the same code that you are running.

This error seems to be due to permissions or ownership of file /tmp/output.1224. Do

ls -l /tmp/output.1224

Check the ownership and permission on that file. You may not have write permission on it. If so you can change your output log filename to something that is more specific than output.$$ as many other processes may have used the same name. Something like

err_file=/tmp/MyProgramName_output_$$.err
mail_log=/tmp/MyProgramName_output_$$.log
Random Solutions  
 
programming4us programming4us