dbWriter Home
IP to Country Look up
Site Map

IP to Country DB

Free Databases:

ASP Code

ASP Links

VB Script functions:
Array
Case/Select
In String (inStr)
Replace

HTML code:
SELECT Color
SELECT Countries
SELECT Language
SELECT State/Province

SQL:

SQL Functions:
Delete leading Char
Get Browser
Long number from IP

Stored Procedures:

SQL Tricks:
Delete ALL duplicates
Delete dup records

MISC
IP Address Owner
MS SQL Server

Mortgage Calcs:
how much is my payment
Loan Amortization
Loan Calculator
Mortgage Calculator
Motrgage Pay Off

dbWriter License

Link to US

Links

Contact US
 

dbWriter.com SQL archive files code

Archive or move files using SQL server.  This code will move files from one directory to another.  It can be set as a scheduled job:

declare @Path varchar(255)
declare @MoveTO varchar(255)
declare @sql varchar (255)
declare @name varchar (255)
declare @ext varchar (10)
declare @eID int
declare @eMaxID int

set @Path = 'Q:\DirectoryToArchive\'

set @MoveTO = 'Q:\TheArchiveDirectory\'

set @ext = '"*.asp"'  -- requires the double quotes inside of single quotes!!

create table #tempDB
(
theFiles varchar(255) ,
ID int identity (1,1)
)

select @sql = 'dir /b/a-d ' + @Path
select @sql = @sql + @ext

insert #tempDB exec master..xp_cmdshell @sql

delete #tempDB
where theFiles is null OR theFiles = 'File Not Found'
OR theFiles = 'The system cannot find the file specified.'

select * from #tempDB

-- loop round
select @eID = 0 ,
@eMaxID = coalesce(max(ID), 0)
from #tempDB

while @eID < @eMaxID
begin
select @eID = min(ID) from #tempDB where ID > @eID
select @Name = theFiles from #tempDB where ID = @eID

select @sql = 'move ' + @Path + '"' + @Name + '" ' + @MoveTO
exec master..xp_cmdshell @sql, no_output

end

drop table #tempDB


 

Partners/Links © 2005 - 2008 dbWriter.com All Rights Reserved
This site is protected by the dbWriter IPtoCountry MS/SQL database!!
Site map | Link to US
Contact Us

Sign up for PayPal and start accepting credit card payments instantly.