vba将现有表插入到新表中

时间:2017-08-17 10:33:34

标签: sql-server vba

我正在尝试将表插入新表。 这是我的代码,我不知道如何继续。 它不是一个完整的代码。

Private Sub CommandSubmit_Click()

Dim cmd As ADODB.Command
Dim conn As ADODB.Connection
Dim strConn As String
Dim par As ADODB.Parameter           'input

strConn = "DRIVER=SQL Server;SERVER=CHU-AS-0004;DATABASE=RTC_LaplaceD_DEV;Trusted_Connection=Yes;"

Set conn = New ADODB.Connection
conn.Open strConn               'open connection

Set cmd = New ADODB.Command
cmd.CommandText = "dbo.SubmitBlend"
cmd.CommandType = adCmdStoredProc
cmd.ActiveConnection = conn

Dim strBlend As String

strBlend = "INSERT INTO dbo.SubmitBlend SELECT * FROM dbo.AddBlendPrac"



cmd.Execute

conn.Close
Set conn = Nothing
Set cmd = Nothing
MsgBox "Request Submit Succeed"

我先创建了一个表,这个表有数据。需要将此表插入到新表中。有没有人如何编码这个?任何评论都会有很大帮助:))

0 个答案:

没有答案