select(casewhen convert (int,substring(身份证号,17,1))%2 =1 then "男"when convert (int,substring(身份证号,17,1))%2=0 then "女"end)from dbo._低保数据
你用的什么数据库呢?“男”改为'男'SQL中字符串用单引号