Question Locked

Help me...Coding to transfer data...

0 helpful
5 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

hye...i really need a help..
some one please teach me make a coding
in VB to transfer data from one table to
a new table in SQL Server..

i need to transfer old data from one table
call "auditTRAIL" to new table call "auditTRAILbackup"....
it refers to the month & year of the data being stored. if its already in the past..we will choose them to transfer it to a new table...

please help me..thanks .. :)

5 replies

by tony hopkinson

Begin Transaction
insert AuditTrialBackup Select * from AditTrail Where ...
Delete AuditTrail Where ...
Commit Transaction

The last thing you want to do is suck the data into a client and then push it back out again.

by dream_gurlz22

Thanks Tony,
i've test da code in SQL Server :

INSERT INTO auditTRAILBac SELECT * FROM auditTRAIL WHERE date = '4/26/2007'.
the data been transfer...

but in VB how can i transfer the data
just by selecting the month and year only then all the data will move to the backup table. not a full date like above...

Thanks..

by tony hopkinson

INSERT INTO auditTRAILBac SELECT * FROM auditTRAIL WHERE Year([Date]) = 2007 and Month([Date]) = 6

by tony hopkinson

format them so they are unambiguous
YYYYMMDD and YYYY-MM-DD are good ones.

Otherwise you get caught out by mm/dd/yy and dd/mm/yyy for say 6/7/2007

6th of July or 7th of June ?

This discussion is closed to new replies.