473,408 Members | 2,032 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

A Whimsical Little MS-SQL Backupper

There have been posts about the difficulties of getting ones hands on
some failsafe kind of backup for data that lives on an MS-SQL server
accessible only through the Internet and for which backups are unavailable.

This little JScript script grabs the data and writes it to text files.
It seems to be quite fast. Yes, I know about bulk copy, but I haven't
been able to get bulk copy to connect to a Server across the Internet.

// ****** script begins ******
var c=new ActiveXObject('ADODB.Connection');
var f=new ActiveXObject('Scripting.FileSystemObject');
var r=new ActiveXObject('ADODB.Recordset');
var s=new ActiveXObject('ADODB.RecordSet');
var ts=new String();
var e=new Object();
var g=new String('PROVIDER=SQLOLEDB.1;');
g+='DATA SOURCE=my server;';
g+='INITIAL CATALOG=my database;';
g+='USER ID=moi;';
g+='PASSWORD=RedheadsIsHot';
c.ConnectionString=g;
try{
c.Open();
}
catch(e){
WScript.Echo('Connection failed!');
}
s = c.OpenSchema(20, Array(null, null, null, "Table"))
while(!s.EOF){
ts=s.Fields('TABLE_NAME').Value;
if(ts.substr(0,2)!='dt'){
r=c.Execute('SELECT * FROM [' + ts + ']');

f.CreateTextFile('D:/SpecificFiles/'+ts+'.txt').Write(r.GetString(2,r.RecordCount,'\t ','\n'));
}
s.MoveNext
}
// ****** script ends ******

Well, yes, I know David hates Scripts. That's another reason ....
Nov 13 '05 #1
1 1325
On Thu, 20 Jan 2005 12:42:59 -0500, Lyle Fairfield <ly******@yahoo.ca>
wrote:

Thanks for sharing. Nice and compact.
Of course a db is much more than its data.
We should not do business with ISPs who make this too difficult. A
good ISP would allow you to make your own backups and restores.
Backups could be made to a location accessible via FTP.

-Tom. (not a readhead)

There have been posts about the difficulties of getting ones hands on
some failsafe kind of backup for data that lives on an MS-SQL server
accessible only through the Internet and for which backups are unavailable.

This little JScript script grabs the data and writes it to text files.
It seems to be quite fast. Yes, I know about bulk copy, but I haven't
been able to get bulk copy to connect to a Server across the Internet.

// ****** script begins ******
var c=new ActiveXObject('ADODB.Connection');
var f=new ActiveXObject('Scripting.FileSystemObject');
var r=new ActiveXObject('ADODB.Recordset');
var s=new ActiveXObject('ADODB.RecordSet');
var ts=new String();
var e=new Object();
var g=new String('PROVIDER=SQLOLEDB.1;');
g+='DATA SOURCE=my server;';
g+='INITIAL CATALOG=my database;';
g+='USER ID=moi;';
g+='PASSWORD=RedheadsIsHot';
c.ConnectionString=g;
try{
c.Open();
}
catch(e){
WScript.Echo('Connection failed!');
}
s = c.OpenSchema(20, Array(null, null, null, "Table"))
while(!s.EOF){
ts=s.Fields('TABLE_NAME').Value;
if(ts.substr(0,2)!='dt'){
r=c.Execute('SELECT * FROM [' + ts + ']');

f.CreateTextFile('D:/SpecificFiles/'+ts+'.txt').Write(r.GetString(2,r.RecordCount,'\t ','\n'));
}
s.MoveNext
}
// ****** script ends ******

Well, yes, I know David hates Scripts. That's another reason ....


Nov 13 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Jim Hubbard | last post by:
I have some C# code that is supposed to wrap the defrag APIs and I am trying to convert it to VB.Net (2003). But, I keep having problems. The C# code is relatively short, so I'll post it...
17
by: MLH | last post by:
Can I control what text appears on msgbox function buttons? Sure do like NOT having to build a form to show a msg and solicit a YES/NO response. MsgBox function is a great solution for that. ...
11
by: Steve | last post by:
Hi, i know this is an old question (sorry) but its a different problem, i need to write a binary file as follows 00000011 00000000 00000000 00000101 00000000 11111111
2
by: Mehta Shailendrakumar | last post by:
Hi, I am sending this question again as new question rather than reply to old question Please refer below: struct raw_data { unsigned char x; unsigned char y; }; union full_data
2
by: Marco Ippolito | last post by:
Hi, I am giving a seminar on C# interop and I would like to feature an original sample class to stimulate some interest. Does anybody want to write an open-source ConsoleApp || WinApp that,...
4
by: aaa | last post by:
Up until now I have used MS Web Services which are fairly straight-forward. Now I am being asked to use some third party web services which I do not find nearly as intuitive. Questions: 1. I...
2
by: ash | last post by:
hi friends, i was trying to make a function, which returns the scan code of a key like up arrow,down arrow, right arrow and left arrow. here it is- #include<dos.h> int getkey() { union...
14
by: CMM | last post by:
Do the developers of Visual 2005 actuall use it??? There's lots of great things in VS2005 (mostly related to the outstanding work done on the CLR)... but in general the LITTLE THINGS totally drag...
45
by: Gaijinco | last post by:
Hi my name is Carlos Obregón and I'm currently a profesor of C/C++ programming at the CUMD in Bogotá Colombia. This last term I ask my students to develop an implementation of the minesweeper...
0
by: Prashant | last post by:
Hi , I want a color pallet control in my web-form Data Grid, I don't want color dialoge like MS-Paint, now when user select particular color, I want selected color's Hex value and user can also...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.