Hi all,

i have aproblem to transfer a data from table x to table y based on id. Its mean when 2 table have same id all data table x must move to table y. I don't know which command need to use is it insert into or update? Can someone help me, i'm new in ASP programming.

here the script i make it

Dim conn
Dim rs

Set conn = Server.CreateObject("ADODB.Connection")
Set rs = Server.CreateObject("ADODB.Recordset")
Set cmd = Server.CreateObject("ADODB.Recordset")
conn.ConnectionString = "DSN=prmm;UID=administrator;pwd=sa"


MYSQL = "SELECT * FROM table_x where paymentdate between '" & tarikh1 & "' and '" & tarikh2 & "'"
rs.open MYSQL,conn

if rs.EOF then
response.Write("no data")
if ([table_x.id] = [table_y.id]) then
MYSQL2 = "INSERT INTO table_y (paymentdate, status, no_resit) values ('" & rs ("paymentdate") & "', '" & rs ("status") & "', '" & rs ("no_resit") & "')"
Set rs = conn.Execute(MYSQL2)

response.write "<p>" & "<center>" & "All data have been done to transfer" & "</center>" & "</p>"
response.write "<p>" & "<A HREF=javascript:history.go(-1)>" & "GoBack" & "</a>"
response.write "Cannot transferring the data"
response.write "<p>" & "<A HREF=javascript:history.go(-1)>" & "GoBack" & "</a>"
end if
end if

Set rs = Nothing
Set conn = Nothing

the error meesage i get like below

Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
[Microsoft][ODBC SQL Server Driver][SQL Server]Cannot insert the value NULL into column 'id', table 'rumahmampumilik.dbo.table_y'; column does not allow nulls. INSERT fails.

i don't understand i'm not insert the id