Friday, September 5, 2008

Cannot copy (filename): The filename, directory name, or volume label syntax is incorrect.

One of the products I test is available for download, in addition to being available on CD media. We use WinZip to create a single-file self-extracting downloadable version. Our customers are able to download a ProdName.exe file, and run it to extract the CD image to a local or network folder.

Sometimes, depending on where they extract it to, they get an error. The problem is that our product CD incorporates the SQL Express installer, which has a very deep folder structure of its own. The longest path in the product CD folder structure is 186 characters:

\Bin\3rdParty\SQLExpress\setup\program files\microsoft sql server\90\tools\binn \windows\winsxs\3kn09qps.lm8\x86_microsoft.vc80.mfcloc_1fc8b3b9a1e18e3b_ 8.0.50727.42_x-ww_3415f6d0.manifest

If someone attempts to extract the contents to a directory that has a long path already, they can get this error:

Cannot copy (filename): The filename, directory name, or volume label syntax is incorrect.

Or, if they're able to extract it successfully, sometimes they get this error when they try to copy the entire CD directory to a different location:

Can't create output file: (filename)

The errors occur because the maximum length of a Windows path is 260 characters.

The solution is to extract or copy the install to a folder with a shorter path name. In our case, because our sub-path takes up 186 characters, everything that comes before \Bin... must have a length not more than 74 characters.

Tuesday, September 2, 2008

How do you know what version of SQL Server you have?

To find out what version and service pack of SQL Server you are running, run this query:

SELECT @@VERSION

For example, I'm at home right now using an old laptop running Windows XP Home, and in the Services console I see only one SQL Server 2000 instance called MICROSOFTBCM.

I've never used BCM, but I know it stands for Business Contact Manager and it is part of Microsoft Office. Let's see what version of SQL Server it is, and what service pack is installed.

First, I open a command window and type:

c:> osql -S localhost\microsoftbcm -E

The response is:

[DBNETLIB]SQL Server does not exist or access denied.
[DBNETLIB]ConnectionOpen (Connect()).

I can see in the Services console that the MSSQL$MICROSOFTBCM service is Started, so I figure maybe TCP/IP connections are not enabled. In the command window, I type:

c:> svrnetcn

This brings up the SQL Server Network Utility. Sure enough, TCP/IP is in the list of Disabled Protocols. So I select it, click the Enable button, and click Apply. An alert tells me I need to restart the service in order for the change to take effect, so I switch over to the Services console and restart the service.

Now I try OSQL again, and this time I get connected. I type:

1> select @@version
2> go

The response is:

Microsoft SQL Server 2000 - 8.00.818 (Intel X86)
May 31 2003 16:08:15
Copyright (c) 1988-2003 Microsoft Corporation
Desktop Engine on Windows NT 5.1 (Build 2600: Service Pack 2)

So now I can tell I'm running MSDE with SP2.

I think I'll disable TCP/IP again, since I don't really need it. I don't use this app. In fact, I'm going to disable the service so it won't start any more when I reboot.