Re: [RadiusNT] T-SQL Commands for moving records to new table

Dale E. Reed Jr. ( (no email) )
Sat, 13 Mar 1999 10:33:35 -0800

> Terry Bomersbach wrote:
>
> What I'm trying to do without much luck is move old records from the
> RadLogs table without removing them from the database.
>
> I would like to move them into a new table that can be named
> Rlog+DATENAME(mm,GETDATE()) so that I get a table with the name like
> RLogMarch, RLogApril, etc.
>
> Anyone have any suggestions?

You'd probably have to copy and then delete them. This isn't complete,
but it would be something like this:

declare @tabname varchar(20)
Select @tabname = "RadLogs_" + DATENAME(mm,GETDATE())

Insert Into @tabname
Select * From RadLogs
Where DatePart(Month, LogDate) = DatePart(Month, GetDate())

You could do -1 on the dates to get last month (for example to
schedule this on the 1st of each mont).

-- 

Dale E. Reed Jr. Emerald and RadiusNT__________________________________________IEA Software, Inc. www.iea-software.com

For more information about this list, including removal, pleasesee this URL: http://www.iea-software.com/maillist.html