Sunday, August 26, 2007

The difference of the LIKE SQL statements between MS Access and SQL Server

LIKE has been used widely in SQL Statements to filter or qualify certain records like this or that. The commonly used wild card characters in SQL Server are % and _, the former matches 0 or many characters; while the latter matches exactly one character. If you want to express NOT, you use ^.

If you copy and paste a SQL statement from SQL Server to MS Access with LIKE statement in it, you may not get exactly the same set of result. One of the reasons is the different symbols used in the LIKE statement.

In MS Access, * matches 0 or many characters; while ? matches extacly one. To express NOT, you use ! in MS Access.

One more note, if you want to match % or _ as is in LIKE statments in SQL Server, you will need to bracket them with a pair of square brackets [ and ]. Similarly, we need to squarely bracket * and ? to match them in the LIKE statements in MS Access.

Friday, August 24, 2007

How to search for files with specific contents on Windows XP/2003 Server

Microsoft Windows Explorer (or NT Explorer) has the search function to help us to search files with specific attributes. However, if we do not set the preference to our own likes, the default search preference may not be what everybody wants. The most significant one is whether to search files with unknown extensions, or even no extensions. The default setting is NO. That is why we can’t find files with the specific contents we are looking for, even though we know they are there. Please note that it does not have anything to do with turning on the Indexing Service or not.

To set the preference correctly, such that it will search for files with unknown extensions, we will have to (from Desktop):

Start --> Search --> Chang Preferences --> With(out) Indexing Services --> Change Indexing Service Settings (Advanced) --> (Indexing Services Console Shows) --> Right Click on the Console Window Screen --> Properties --> Check "Indexing Files with Unknown Extension" if unchecked --> OK

Please note that this preference may be "per user" not "per machine", so it is possible that whoever logged in will need to setup the preference him/herself.

Wednesday, August 22, 2007

How to use robocopy to mirror two folders

There are many cases that we need two or more folders to be synchronized, or replicated, or mirrored, for the purpose of load sharing, redundancy and backup. One obvious example is to help standalone DFS (Distributed File System) to replicate files among the redundant folders.

In Windows 2000 Resource Kit there is a command line utility called robocopy.exe. This program can synchronize the source and destination folders by deleting the deleted source files and only copying the newer files. It can also copy files recursively. Below is a simple batch file we can use to provide the simplest one-way mirroring:

net use \\host1\share1 password1 /USER:user1
net use \\host2\share2 password1 /USERS:user2
robocopy \\host1\share1 \\host2\share2 /MIR
net use \\host1\share1 /DELETE
net use \\host2\share2 /DELETE

Tuesday, August 21, 2007

Daylight Saving Time update for Linux Systems

Here is the information to manually update the timezone information for RedHat Fedora Core 4-6 and other Linux System, just in case your Fedora does not adjust the time zone information automatically (via Yum).

http://articles.techrepublic.com.com/5100-10877-6163042.html

The basic idea is to update the file /etc/localtime by the right file in tzdata package.

Daylight Saving Time Update for Windows 2000 Servers

Microsoft does not support Windows 2000 anymore and it shows this time, on the occation of daylight saving time change update - ony XP and Server 2003 were updated automatically.

If you are running Windows 2000 you will have to do a bit more work for the daylight saving time change. Microsoft has released KB article 914387 which outlines the process you must go to for the change. There are two methods by which you can change the time zone for Windows 2000 (Professional and Server). The first is to download the TZEdit tool from Microsoft. Once installed, you can run this tool (it installs by default to c:\Program Files\TZEdit\) to manually create and change your time zones. This method will require you to manually change every computer. While this is not a major task if you only have a few Windows 2000, it can be quite daunting if you have a large number of systems to update.

The second method provided by Microsoft for updating Windows 2000 is a combination of a registry edit and a VBS script. These are both available here, though you must copy the text for each of them and save them locally with the proper file extensions (.reg and .vbs respectively). You must then import the registry settings change (by double clicking the .reg file you created), then run the vbs script to perform the update. This process can easily be automated.

Microsoft provides steps to automate the process through group policy (by making a simple command file), but it can also be done using a batch file or another VB script. The only requirement again is that administrator privileges are used to run the files or the script created. This can be mitigated by using group policy to assign it as a startup or shutdown script for a computer not a user.

For further information, please checkout: http://articles.techrepublic.com.com/5100-10877_11-6161680.html