4863SQL Server 2012 - Column value -1 or 0
- Mar 22, 2013Hi Guys,
If you look at the Having statement in the query below it has:
HAVING (dbo.TITLES.Check1 = - 1) <- notice the space between - sign and 1.
I have tried removing that space in SQL Server view designer but it keeps
putting it back. The values in the DB column Check1 are either -1 or 0.
If I try:
dbo.TITLES.Check1 = 0)
This pull up records with 0
But when I try:
dbo.TITLES.Check1 = - 1)
This pull up nothing even though there are 2 records in there with a value
of -1 in that column.
I think it is the space between the minus sign and the number 1. But, every
time I remove the space the designer puts it right back.
In access this is basically a true or false column which is represented by a
-1 for true and a 0 for false.
Is there another way I should be checking this in SQL Server?
I did try:
dbo.TITLES.Check1 = True)
But of course that tosses an error even though it works when run in access.
SQL SERVER VERSION:
SELECT MAX(dbo.TITLOC.TitleLocID) AS MaxOfTitleLocID, dbo.TITLES.TitleID,
dbo.TITLES.CustLName, dbo.TITLES.CustFName, dbo.TITLES.RecDT,
dbo.TITLES.TitleID AS Expr1, dbo.TITLES.Check1
FROM dbo.TITLES INNER JOIN
dbo.TITLOC ON dbo.TITLES.TitleID =
GROUP BY dbo.TITLES.CustLName, dbo.TITLES.CustFName, dbo.TITLES.RecDT,
dbo.TITLES.TitleID, dbo.TITLES.Check1, dbo.TITLES.TitleID
HAVING (dbo.TITLES.Check1 = - 1)
SELECT Max(TITLOC.TitleLocID) AS MaxOfTitleLocID, TITLES.TitleID,
TITLES.CustLName, TITLES.CustFName, TITLES.RecDT, TITLES.TitleID,
FROM TITLES INNER JOIN TITLOC ON TITLES.TitleID = TITLOC.TitleID
GROUP BY TITLES.TitleID, TITLES.CustLName, TITLES.CustFName, TITLES.RecDT,
[Non-text portions of this message have been removed]
- Next post in topic >>