Microsoft
Software
Hardware
Network
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
you can simply remove the execute / run priv from the command su
Random Solutions
Exchange Server Wont Start
How do I change the collating sequence properties at both the database and sql engine level for both SQL 2000 and 2005?
MS Virtual Machine and disk2vhd
Could not find stored procedure 'dbo.aspnet_CheckSchemaVer<wbr />sion'.
How to show number of messages besides a folder
RAID 1 or RAID 10 for windows 2003 server with SQL 2000 server
Microsoft Access Module - Append table to another
Using ADO in VBA for Query with multiple parameters
Query over multiple fields
DCPROMO fails when existing DC's are on different subnet / segment