OK, check this out. I already solved this, but I had to share cause it
threw me for a major loop.
I was working on a stored procedure last night and there was an if
statement which ALWAYS evaluated true. I finally isolated the problem
(which kept reoccurring) in query analyzer as the following code:
declare @error_cnt as int
SET @error_cnt = 0
--email if address problem on order
IF @error_cnt = 1
BEGIN
print 'true'
print @error_cnt
end
The output of the following code was:
true
0
What the heck!!?? After beating my head against the wall for a very
long time, I figured out that SOMEHOW the line break between the comment
and the IF statement was not the standard ASCII 13 and 11 CR and LF.
It was just a carriage return all by itself (13). The editor shows it
as a regular line break, but the server acts as if the CR is NOT THERE
and evaluates the IF statement as PART OF THE COMMENT. The BEGIN and
END block was always entered because there was no if statement.
1) I don't know how I managed to get a CR ONLY typed in there.
2) I don't think it is right that the editor and compiler have DIFFERENT
perceptions as to what constitutes as line break.
3) I reproduced this "feature" on MS SQL Server 2000 and 2005
Ok, that is my rant/epiphany for today.
~Brad
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four
times a year.
http://www.fusionauthority.com/quarterly
Archive:
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:260587
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4