insert into 新表 (field1,field2,field3...) select 旧表1.field1,旧表2.field2,旧表3.field3... from 旧表1,旧表2,旧表3... where ......
首先谢谢各位,但是还有问题,望解决: 我的代码为: sqltempdata1 = "select 1.x,2.x,3.x from 1,2,3 where 1.x=2.x and 1.x=3.x set tempdata=new recordset tempdata1.Open sqltempdata1,dataconnect,adopenstatic, adLockOptimistic 2.现我想把tempdata1中的数据写到另一临时表中去,该如何写代码?谢谢!此临时表不和上面的表在一个位置,上面的表是在SQL服务嚣上,面临时表在本机上.
select 旧表1.field1,旧表2.field2,旧表3.field3... from 旧表1,旧表2,旧表3...
where ......
我的代码为:
sqltempdata1 = "select 1.x,2.x,3.x from 1,2,3 where 1.x=2.x and 1.x=3.x
set tempdata=new recordset
tempdata1.Open sqltempdata1,dataconnect,adopenstatic, adLockOptimistic
2.现我想把tempdata1中的数据写到另一临时表中去,该如何写代码?谢谢!此临时表不和上面的表在一个位置,上面的表是在SQL服务嚣上,面临时表在本机上.
tempdata.Save tempFile , adPersistADTG
将来读取的方法也很简单:
tempRec.Open tempFile, , adOpenStatic
strSQL = strSQL & "Create Table #Temp (ID Char(10), Qty numeric(18, 6) default(0),)"
cnn.Execute strSQL 'cnn本机连接
rsttmp.Open "select ...",conn
for
cnn.execute "insert into #Temp ...."
next
...
cnn.execute "Drop table #Temp"