June 25, 2015 at 2:29 pm
I have been trying to get this condition to be TRUE, but can't seem to get it right.
Any suggestions would be helpful. Thanks.
DECLARE @stopat datetime
SET @stopat = '2015-06-23 02:16'
IF @stopat LIKE '[1-2][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9][^0-9a-z][0-9][0-9]:[0-9][0-9]'
PRINT 'TRUE'
ELSE PRINT 'FALSE'
June 25, 2015 at 3:03 pm
fpchavula (6/25/2015)
I have been trying to get this condition to be TRUE, but can't seem to get it right.Any suggestions would be helpful. Thanks.
DECLARE @stopat datetime
SET @stopat = '2015-06-23 02:16'
IF @stopat LIKE '[1-2][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9][^0-9a-z][0-9][0-9]:[0-9][0-9]'
PRINT 'TRUE'
ELSE PRINT 'FALSE'
TRY:
DECLARE @stopat datetime
SET @stopat = '2015-06-23 02:16'
IF CONVERT(VARCHAR(16), @stopat, 120) LIKE '[1-2][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]_[0-9][0-9]:[0-9][0-9]' PRINT 'TRUE'
ELSE PRINT 'FALSE'
Try SELECT @stopat and you'll see why it was not matching.
For best practices on asking questions, please read the following article: Forum Etiquette: How to post data/code on a forum to get the best help[/url]
June 25, 2015 at 3:16 pm
I see the cause, thank you very much for your help.
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply