SQL里条件判断后怎么使用增加语句?
蓝色光芒 2007-02-27 11:27:25 想实现如下:
如果发现数据表中存在某条记录则更新,如果不存在就增加一条记录,
select * from table where nYear=1000 and nMonth=12 and nDay=31
如果该记录存在则执行
update table set nMoney=nMoney+10 where nYear=1000 and nMonth=12 and nDay=31
如果不存在就执行
insert into table (nMoney,nYear,nMonth,nDay) values (100,1000,12,31)
如果合在一起怎么写??
再有一个问题,SQL语句有没有最大长度的限制?