distal-attribute
distal-attribute
distal-attribute
distal-attribute

compute column

User, date Message
Written by jjk2k
2 years ago
Category: General
1 posts since Tue, 05 Jun 12
I am trying to create a computer field:
USE [GWHospChts]
GO

alter table [dbo.PatMeds]
add [Age_Group] as
case
when [MOMAGE121] < 18 THEN 1 else
when [MOMAGE121] BETWEEN 18 AND 19 THEN 2 else
when [MOMAGE121] BETWEEN 20 AND 24 THEN 3 else
when [MOMAGE121] BETWEEN 25 AND 29 THEN 4 else
when [MOMAGE121] BETWEEN 30 AND 34 THEN 5 else
when [MOMAGE121] BETWEEN 35 AND 39 THEN 6 else
when [MOMAGE121] >= 40 then 7
end
go

go

and I get all kind of errors. MOMAGE121 is string. can someone please help?
thanks,
Raul
Written by jfalchMoney, Euro
2 years ago
380 posts since Sat, 17 Oct 09
at the very least, post (start of) error messages.
 

Please login to leave a reply, or register at first.