Using BCP to export data from SQL Server 2016 to SQL Server 4.21

Once more again I’m confronted with a situation where I needed a SQL, but I don’t have direct access to the data. The machine I’m able to run some stuff on is not only insanely out of date (yay!) but doesn’t have enough disk space for even something like SQL Server 2000.

Enter SQL 4.21a

I “installed” 4.21a on this 32bit 2003 server in much the same way I transplanted 4.21a onto Windows 10. However I did use the srvany utility to load up the SQL Server service, much like how I used it to run an instance of Qemu in the background elsewhere. Now I have my intermediary SQL Server running like a normal service, and set a password for the SA user.

Now for the fun.

First be sure to set your target database for ‘bulk/load’ and I’d also set it for ‘truncate log on checkpoint’. If you don’t set the bulk/load then you cannot BCP data into the database.

Using the SQL Explorer tool I could view the tables I wanted, and export them as ‘SQL CREATE’ giving me the table layout. I then quickly converted them into something acceptable for 4.21a. Now it’s a matter of establishing a connection to the old server from the new.

First I tested with the ISQL command. I needed to copy the DLLs DBMSSOCN.DLL & NTWDBLIB.DLL into the directory to get the command to fire up. Since my strategy here is to do a BCP dump/BCP load the first thing I need to do is purge the data.

isql  -Usa -PPASSWORD -S192.168.1.42 -Q"delete network.dbo.firewall_mapping"

This of course assumes that the server address is and that in this case I’m deleting the firewall_mapping table from the network database. If you’ve made it this far that means we are 1/4th of the way there!

I found this ‘one trick’ to get the BCP command from the SQL 4.21a tools to connect to the 2016 server and dump the table as a trusted connection. I’m not sure how much longer this kind of thing will work, but I was pretty amazed it did. I didn’t even bother trying to see if the 4.21a BCP tool could read a 2016 BCP dump. Maybe it would if you keep the formatting the same, but I find ‘like to like’ much easier. I renamed the old BCP.EXE to BCP42.EXE so that they won’t collide in any way causing weirdness. At the same time I run them from a directory that is NOT in the system path.

bcp42 "[Network Database].[dbo].[firewall_rules]" out c:\temp\1.csv -t, -r= -P

The notation looks weird, as my source database name has a space in it. This initially caused endless frustration, but it was just a matter of using the fully qualified name, which is in quotes


I set the field delimiter as a comma, and the row terminator as an equal sign. I tried not setting it but I was getting ‘spiraling data’ as it was not picking up the end of row correctly at first.

The first time you run the BCP without a format file it’ll walk you through the specifics of the fields. I just blindly accepted the defaults, and saved the file as firewall_rules.fmt . Now on subsequent runs, I can run the export like this, which uses the saved formatting:

bcp42 "[Network Database].[dbo].[firewall_rules]" out c:\temp\1.csv -t, -r= -P -ffirewall_rules.fmt

Great so if everything is going well, we have no exported our data! Now the next step is to import the data into our old server. Since we have that format file, this “should” go pretty smoothly. Notice the server is an IP address which implicitly has it connecting by TCP sockets, not named pipes. As such there is no implicit ‘Trusted connection” as there was when talking to the local 2016 server.

bcp42 network.dbo.firewall_rules in c:\temp\1.csv -Usa -PPASSWORD -S192.168.1.42 -t, -r= -ffirewall_rules.fmt

Naturally change PASSWORD to whatever password you have for the SA user.

Starting copy...
1000 rows sent to SQL Server.

1892 rows copied.
Network packet size (bytes): 512
Clock Time (ms.): total =   2216 Avg =      1 (853.79 rows per sec.)

And there you have it, all being well you’ll see the program update every 1,000 rows as it inserts data.

Originally I wanted to use the data transformation wizard thing (whatever they renamed DTS to) however the ODBC is limited to the newer .NET 4 stuff, which won’t use the old SQL Server 6.5 ODBC drivers. I really didn’t think the SQL Server 4.21a BCP command to work on a modern server against a new(ish) version of SQL Server, but it did!

I guess you could neaten it up with a command file to drop tables/re-create if you wanted, or at the least delete data/checkpoint and set the load options, dump/load data, and then turn off the load state for the database. I’m not doing reports or anything fancy, just visualizing data as they say.

Although things like ODBC have drifted out, it’s still kind of interesting that ancient BCP can still communicate over named pipes as an implicit trust.


(This is a guest post by Antoni Sawicki aka Tenox)

As I previously mentioned I’m slowly but surely uploading all my stuff to

You may want to know that I just finished uploading apps for Windows NT RISC… Alpha AXP, MIPS and PowerPC. Happy downloading.

Early MSDN CD’s on

I ran across this, and thought it was cool. These CD’s are getting harder and harder to find, and unless you want the old physical disks, getting ISO images is, of course the next best thing.

Granted these disks replaced the much older Microsoft Programmer’s Library. The new CD’s use a Windows based search & interface program removing the clunky old MS-DOS program that made it feel like trying to view the world through a straw. (Although the up side of the MS-DOS version is that you could easily dump the video RAM and save the contents to plain text).

And in this brave new post Windows 3.0 centric world of Microsoft just about everything regarding OS/2 was dumped, and the seeding of Win32 via Windows NT had started.

Naturally after winning this war, Microsoft withdrew many low end products and just couldn’t compete with the tidalwave that was GNU/Linux.

At any rate for the curious kids down the road that want to see what all the fuss was with Win16, and how Windows 3.0 had changed the landscape removing the force of IBM it’s worth a look.

Microsoft XENIX 286 BASIC Compiler

(This is a guest post by Antoni Sawicki aka Tenox)

I have recently acquired this artifact:

It’s the Microsoft BASIC compiler for XENIX 286 Operating System. Compiler as opposed to just BASIC interpreter, it can produce executable a.out files, similar to C compiler for example.  

Carefully removed the shrink wrap. Inside were couple of 5.25″ floppies, registration card and a manual:

Interestingly the 32 year old disks read just fine on a first attempt. I need to start backing up important files to 5.25″ floppy disks as they seem to outlast everything else.

Thanks to efforts of Michal Necasek from OS/2 Museum now you can run Microsoft XENIX 286 in Virtual Box

The disks can be installed in to XENIX running on Vbox following a few simple steps:

tar xvf /dev/fd0
./msinstall /dev/fd0

Upon installation you invoke the compiler like this:

bascom demo.bas

And it produced an a.out executable which worked perfectly fine.

It’s fun to write BASIC code in vi editor, which I just realized I never done before.

Curiously the compiler also worked on the brand spanking new Xenix 2018, or rather I should call it Open Server 6, which you can download here (includes an evaluation license).

The BASIC compiler is available for download from along with the manual in pdf.

Compiling Microsoft Word 1.1a for Windows

A while back, Microsoft had famously released the source code to Word for Windows 1.1a (and OS/2 as well!), to some fanfare.

People were excited, but then kind of dismayed as they couldn’t really do much with it.  Oddly enough the source code release really didn’t have any notes on how to build it, although everything needed is included.  I went looking for information on how to build Word to see why it keeps doing weird things on WineVDM, and I came across this thread on betaarchive:

Special props to yksoft1 for getting it to build in the first place, and Ringding for noticing that the OS/2 supplied compiler binaries can be re-bound to run under MS-DOS using a MS-DOS Extender.

So I went ahead and fired up Qemu and within an hour I had done it!

Word 1.1a compiled and on Windows 2.11

Well this is great fun, and all, but there isn’t a heck of a lof of people with Windows 2.x around anymore.  And of course Word 1.1a really wanted to have 2.11 or higher.  It has some hooks for what would be Windows 3.0 although I think it was much more.  Although it certainly doesn’t want to run (unmodified) under debug release 1.14.

So now that the world has gone beyond Win16 OS’s what can you do?

Well the tip of  WineVDM will run it!

Word 1.1a on Windows 10 using WineVDM

So now there is some new life for this old word processor.

Another fun thing in Word 1.1a is that it has an early implementation of MDI letting you view and work with several documents at once.  Naturally you would need a massive monitor, which we all have today.  Although people tend to just launch more than one copy of Word to accomplish this.

Early MDI

So now on my 64bit machine I can not only play with the source to Word, but I can run it at unimaginable resolutions on my modern machine!

So while out today I found a Windows RT Surface for $25

I had to pay another $15 for the charger.  I should have run away, but I’m a sucker.

Yes, there are basically NO apps, but thanks to this little guide

QuakeWorld on Windows RT

I was able to port over some trivial stuff, the usual things like hello world, Infocom Interpreter, a f2c build of Dungeon, then I went with something I’d been messing around an old GDI driver for WinQuake that builds with the NT 3.5 SDK (finally got it!).  So with a few minor tweeks here it is cross compiled from my x86_64 to the surface.

Last time I talked about the Surface was nearly 6 years ago…  The platform’s fate was pretty much sealed on day one.  With no open Win32 API it shunned traditional devs, and with some completely new and insane model it was such a hurdle for new devs, why put so much effort into such an old tired company like Microsoft?

I figured for the price of a good lunch it’d be a fun toy.

Too bad the speakers don’t work though.

I know the window on Windows 8.1 apps is closing soon.  I should put something together for the dead platform.  Maybe for phone too.  But for tonight, it was kinda fun doing a copy/paste attack to then run unsigned EXE’s on the device.

I might upload the tool chain later, but at the moment getting Visual Studio 2012 Ultimate is a breeze.

Reading older SQL Server 6.5 books online

So as part of my fun day job stuff involves moving data around and from time to time, there is that proverbial server in the corner (in this case it’s even physical!) and in this case I needed to move stuff into an old version of SQL Server as I needed to remember how to use the older BCP syntax.  Obviously I guess I could have just installed 6.5 into a VM, did the SQL transfer, then the whole upgrade to 7/2000 and up to something modern, but per requirements I needed to check data in the middle, so the quickest way is to just BCP it out into something human readable, and BCP it into something new.

SQL Server Books Online on Windows 10

So it turns out the books are easily copied off the install CD, and just run the viewer application directly.  And even better the ‘massive and optional’ install of all the online documentation turns out to be absolutely trivial by modern standards.

08/27/2018  12:33 PM           457,780 SQLBOOKS.AUX
08/27/2018  12:33 PM         1,163,078 SQLBOOKS.CAC
08/27/2018  01:33 PM                28 SQLBOOKS.flt
08/27/2018  01:33 PM                79 SQLBOOKS.hst
08/27/2018  12:33 PM               766 SQLBOOKS.ICO
08/27/2018  12:33 PM           238,252 SQLBOOKS.IDX
08/27/2018  12:33 PM           118,805 SQLBOOKS.KWD
08/27/2018  12:33 PM        10,193,094 SQLBOOKS.MVB
               8 File(s)     12,171,882 bytes

As you can see it’s really not that much in the world of terabyte disks.  Anyways just copy out all the SQLBOOKS* files and then from the binn directory grab the INFOVIEW program.  To view the books just run “INFOVIEW SQLBOOKS.MVB” and you’ll be set!

Some of the other older tools like Visual C++ 4.x also use this InfoViewer format, and you can copy all the other associated files, in the off chance you want to keep this ancient stuff handy.

WineVDM 0.5.0 released!

This version has MANY issues fixed, and is capable of running more and more Win16 software on Win64 based OS’s.

Printing on paper!

One of the more exciting things is that as long as I do a print setup first, I can actually print on a new printer from MS Word 2.0c!

You can download it from the releases page here:

MSDN from October 1994

I picked this 20 disc set recently and ugh the cringe is just… insane.  And yes, that is Bill Nye


STUDS from Microsoft .
(Video in MPEG-1/Audio MPEG-2 care of JSMpeg).

I had this ages ago, although I couldn't remember if the NT 3.5 SDK/DDK had shown up at this point, but it's only the Japanese version in this set.  Since I'm having such a PITA in tracking down a 3.5 set, and I'm not sitting on this, I may as well archive it.

Yes, I had to rip 20 of these!

So you too can find the early Video for Windows, and all kinds of other things from the mid '90's on

Or Wallpapers like this 'puppy' from the Japanese version of Windows 3.1

Excel Working Model

While messing around with Windows/386 and talking to others going through their old stuff, I’d forgotten that in the box was a working model of Excel. Since I only have the physical diskettes for 2.03, I did dump the disks for 2.11 when I had that.

Envelope with the demo

At this time in history the big spreadsheet that defined the PC was 1-2-3 which took the spreadsheet mantle away from the CP/M spreadsheet who in turn took it away from the progenitor VisiCalc on the Apple II.  And this was the chance to define the new spreadsheet for a whole new platform.  

Excel started out on the Macintosh, but with version 2 it was time to come to the PC for the new and exciting Windows 2 platoform.  And to get people to try it out the key was free working demos.

Automated demo

I thought it was interesting that it comes with a demo showing off the ability to take data from several spreadsheets and make a 3rd with data.  Oh what an exciting world 1989 was!

Oddly enough I couldn’t directly import text (csv) data into XL, but I could use Excel 3 to create a version 2 xls with my current top blog stats and then create some graphs.

So first, here is from the blog stats package wp-statistics:

Chart in Excel 2

And there we go in Excel 2.  Since I have Excel 3, here is it running under WineVDM on Windows 10:

Excel 3

Obviously the higer resolution helps for moving stuff around.  And the legend doesn’t resize in either, but in Excel 3’s larger display it and move stuff around.

Needless to say this stuff is down right primative in 2018, but it’s always fun to check out ‘professional’ tools from 30 years ago.