Connecting Tech Pros Worldwide Help | Site Map

Im hungry, tired and in need of some MS SQL help

Newbie
 
Join Date: Feb 2007
Posts: 2
#1: May 7 '07
Hello everyone,

I'm creating a database in access but using SQL... its for my course at uni. I want to set a boolean value: Yes/No. but i don't know how to do this, table i want -

CREATE TABLE CASE(
CASE_ID NUMERIC NOT NULL PRIMARY KEY,
CASE_NAME CHAR (255),
CASE_DESCRIPTION CHAR (1024),
CASE_TYPE_ID CHAR (8), /*(FK)*/
CASE_STATUS (YES/NO), <---- here i want it to be either 'OPEN' or 'CLOSED' instead of 'YES or 'NO' is this possible? but would also like how to do a yes and no, lol
CLIENT_ID NUMERIC, /*(FK)*/
INV_OFF_ID NUMERIC, /*(FK)*/
FEE_ID NUMERIC, /*(FK)*/

Cheers
Dan
JConsulting's Avatar
Expert
 
Join Date: Apr 2007
Location: Houston
Posts: 601
#2: May 7 '07

re: Im hungry, tired and in need of some MS SQL help


here's a blurb straight out of Northwind database. Notice the case for IsDiscontinued. Hope this helps.
J

Expand|Select|Wrap|Line Numbers
  1. CREATE TABLE Products (
  2.       ProductID int IDENTITY(1, 1) NOT NULL,
  3.       ProductName nvarchar(40) NOT NULL,
  4.       SupplierID int NULL,
  5.       CategoryID int NULL,
  6.       QuantityPerUnit nvarchar(20) NULL,
  7.       UnitPrice money NULL,
  8.       UnitsInStock smallint NULL,
  9.       UnitsOnOrder smallint NULL,
  10.       ReorderLevel smallint NULL,
  11.       Discontinued bit NOT NULL,
  12.       IsDiscontinued AS (case Discontinued when 1 then 'Yes' when 0 then 'No' end)
  13. )
Reply