INSERT info from table1 to table2

Status
Not open for further replies.

techthis

Solid State Member
Messages
10
hi...i've been trying to get my code to work for awhile...i can't seem to find the problem...im trying to insert information from tempusers_tbl to users_tbl...they are both in the same database...im using ASP as my scripting language and ACCESS as my db...here is my code...
--------------------------------------------------------

<% @ Language="VBScript" %>
<% Option Explicit %>

<html>
<head><title>4.Insert MAIN DB 1 </title></head>
<body>
<%
Dim connection
Dim name
Dim sSQL
Dim sConnString

sSQL = "Insert into users_tbl select name from (select name from tempusers_tbl tb where NOT EXISTS (select null from users_tbl where name = tb.name))"

Set connection = Server.CreateObject("ADODB.connection")

sConnString="DRIVER={Microsoft Access Driver (*.mdb)};" & _
"DBQ=" & Server.MapPath("users.mdb") & ";"

connection.Open sConnString

connection.execute(sSQL)

connection.Close
Set connection = Nothing
%>
Thanks...
</body>
</html>

--------------------------------------------------------
thanks for your time...
 
i actually figured it out...i changed the sql statement...

sSQL1 = "Insert into users_tbl (name, email, comments) select name, email, comments from tempusers_tbl;"

this worked...thanks though...
 
Status
Not open for further replies.
Back
Top Bottom