compute column

[expired user #6428]'s profile image [expired user #6428] posted 12 years ago in General Permalink
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
jfalch's profile image jfalch posted 12 years ago Permalink
at the very least, post (start of) error messages.

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