请问哪位大侠帮看看这个语句是什么意思

来源:百度知道 编辑:UC知道 时间:2024/08/30 18:51:59
if month(@pdate)<>1
set @premonth= str(year(@pdate))+'-'+ltrim(str((month(@pdate)-1)))+'-'+ltrim(str(26))
set @nowmonth= str(year(@pdate))+'-'+ltrim(str(month(@pdate)))+'-'+ltrim(str(day(@pdate)))

判断@pdate变量中的月份是否是1月,如果不是1月,则将@premonth变量赋值为@pdate前一个月的26日,假设@pdate是 2008年2月1日,执行后,@premonth变量被复制为'2008-1-26'
第二个set与判断语句条件无关,会被赋值为@pdate代表时间的字符串形式,还是假设@pdate是 2008年2月1日,赋值后@nowmonth的值是'2008-2-1'