Start Free Trial
Triggering a stored procedure to copy from one tble to another using ASP.
INSERT INTO [dbo].[messagelog_archive]
SELECT * FROM [dbo].[messagelog]
WHERE [DateSent] < DateAdd(m,-3,getdate())
WHERE SN in
(Select SN from [dbo].[messagelog_archive]
I would like to implement this as a stored procedure that I can call from an ASP page, how would I get that done
Microsoft SQL Server 2005
8/22/2022 - Mon
What database are you using?
ASKER CERTIFIED SOLUTION
THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Oh yes... the asp code:
Set cn = Server.CreateObject("ADODB
cn.Open "data source name", "userid", "password"
Set cmd = Server.CreateObject("ADODB
Set cmd.ActiveConnection = cn
cmd.CommandText = "YourSprocName"
cmd.CommandType = adCmdStoredProc
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
So you know, you could just run that like this:
sql = "INSERT INTO [dbo].[messagelog_archive]
" & vbcrlf & _
" SELECT * FROM [dbo].[messagelog] " & vbcrlf & _
"WHERE [DateSent] < DateAdd(m,-3,getdate()) " & vbcrlf & _
"DELETE [dbo].[messagelog] " & vbcrlf & _
"WHERE SN in " & vbcrlf & _
"(Select SN from [dbo].[messagelog_archive]
Plans and Pricing
Certified Expert Program
© 1996-2023 Experts Exchange, LLC. All rights reserved. Covered by US Patent