Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Change YN to Boolean

Status
Not open for further replies.

mattyboy2000

Programmer
Jul 31, 2002
129
GB
Hi,

I have a table in SQLServer that contains a Field called Monthly. It is a varchar(1) type field that contains 'Y' or 'N'.

In my VB Application I want to use it as a boolean. I want to do it via a SQL Stored procedure. I tried to do a case statement:

SELECT Ref as SettleCode, [Desc],
CASE SetMonth WHEN 'Y' THEN True
ELSE False
END as bolMonthly, SettDays, DiscPerc
FROM Settle

The problem is that True and False are not constants in SQL Server. I tried to return 0 or 1, but my program then saw them as integers


Any help or sudgestions will be greatfully recieved

Matt
 
SQL has no Boolean data type. The closest is Bit type butit is basically TinyInt with only 2 possible values, 0 and 1 .. ________________________________________________________________________________
If you do not like change, get out of the IT business...
 
I guess my problem is the way .net interprets the values

I've solved it with a work around, but thanks for your help

Matt
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top