Question

Locked

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

By dream_gurlz22 ·
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 .. :)

This conversation is currently closed to new comments.

5 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Answers

Collapse -

That's just a bit of SQL and some parameters

by Tony Hopkinson In reply to Help me...Coding to trans ...

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.

Collapse -

I've try but can't make it...

by dream_gurlz22 In reply to That's just a bit of SQL ...

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..

Collapse -

Oh, you mean something like this ?

by Tony Hopkinson In reply to I've try but can't make i ...

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

Collapse -

PS when you use dates in SQL

by Tony Hopkinson In reply to That's just a bit of SQL ...

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 ?

Back to Networks Forum
5 total posts (Page 1 of 1)  

Related Discussions

Related Forums