Id = "23T256472549";

Prefix = left(id, len(id) - 2);
Suffix = right(id, 2);

SELECT count(*) AS [count]
FROM myTable
WHERE id >= "#prefix##suffix - 5#"
AND id <= "#prefix##suffix + 5#"

If 'count' is greater than zero, there are some within 5 of the specified id

Cheers,
barneyb

> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> Sent: Monday, February 23, 2004 3:32 PM
> To: CF-Talk
> Subject: Checking strings
>
> How would I check a string such as:
> 23T256472549 and make sure there are no other entries in the database
> within 5 digits of that? So, 23T256472554 would not be allowed and
> 23T256472544 would not be allowed (and the inbetweens as well).
>
> Thanks!
>
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to