好看的花池图片:帮MM一个技术问题,必有重谢啊先拿出(30分)

来源:百度文库 编辑:神马品牌网 时间:2024/04/28 00:43:36
set @sql='insert into worknot select a.workno,b.countnum,b.ctime from (select * from Tworktech where '+@tech+') as a,(select workno,countnum,ctime from tmember where status=1 and marking=2) as b where a.workno=b.workno'
其中 @TECH=‘english>1’假设吧 worknot 表中有四个字段,workno,countnum,ctime,lstime..
按上面那样插入肯定是不对的,应为插入的字段列,小于表里面的,我已经试过了,
现在问题就出现了。我想把 @times=getdate() 当前时间变量也插入到的表WORKNOT 里面对应的是ctime
如果用上面的代码怎么办啊怎么才能才能插入@time 这个时间变量啊。
不要分开插入啊。我想一起执行完所有的插入字段内容。上面只是三个字段内容。
高手们给指点些吧!!!

set @sql='insert into worknot
select a.workno,b.countnum,b.ctime from
( select workno from Tworktech where '+@tech+' ) as a,
(select workno,countnum,getdate() as ctime from tmember where status=1 and marking=2 ) as b
where a.workno=b.workno'

不知道行不行