Quantcast
Channel: Forum Getting started with SQL Server
Viewing all articles
Browse latest Browse all 7129

Table Designer & computed colums & case statement

$
0
0
 

i am creating a table using table designer and i want to add a computed column for Age as follows:

CASE WHEN BirtheDate IS NULL THEN NULL
  WHEN DATEDIFF(yy,BirthDate, CURRENT_TIMESTAMP) >50 THEN 'OLDER'
  WHEN DATEDIFF (yy, BirthDate, Current_Timestamp)>40 then 'middle age' 
  else 'younger'

END

however, whenever i type this code i get an error. is there something that i should change to get it work?

is it possible to use case in table designer for a computed field?

Any answers i would be grateful.

thanks


sukai


Viewing all articles
Browse latest Browse all 7129

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>