Check dates are valid in sql

Tearing my hair out over a query that involves manipulating and querying dates from SQL. Amongst various stuff I came across was this useful little snippet, if you have stored dates in a text field (eg nvarchar) it can tell you if the dates are valid:

set dateformat mdy

select *
from t
where isdate(startdate) = 1
    and convert(datetime, startdate) not between '19000101' and '20790606'

Keeping this one in the toolbox for another day.

Blocking Spammy IPs

A few months ago I found our little web server at home was being constantly wacked by people trying to find a way in. As is now unfortunately the case, the vast majority of the IPs were Chinese or Korean.

I found a neat little utility called IISIP – a free download, that enables you to load a big bunch of IP numbers into IIS to block. You could add them one by one in IIS of course. But they give you block lists for most China and Korean ranges and it adds up to 50,000 IPs. Not a list you want to manually add.

Am reminded because a VPS box for one of my clients seems to be attracting an inordinate amount of interest from those two countries, and given the client does no business there, I'm going to ask their OK to load IISIP and just turn off access from those countries.