Bug of the day
-
I've been banging my head against a wall trying to work out why a class in a stored procedure was being skipped.
DECLARE @SuppressionMethod varchar(20)
-- ... lots of code...
SET @SuppressionMethod = 'SkipSuppressedMembers'
If lower(@SuppressionMethod) = 'skipsuppressedmembers'
Begin
...No matter what, the if clause was never entered. Can anyone see the head slapper? It's a groaner.
cheers, Chris Maunder The Code Project | Co-founder Microsoft C++ MVP
Funny, skipsuppressedmembers == 22 chars length @SuppresionMethod is declared as varchar(20) so when you assign 'SkipSuppressedMembers' it gets truncated, Did I make myself clear?
"Whether you think you can, or you think you can't--either way, you are right." — Henry Ford "When I waste my time, I only use the best, Code Project...don't leave home without it." — Slacker007
-
I've been banging my head against a wall trying to work out why a class in a stored procedure was being skipped.
DECLARE @SuppressionMethod varchar(20)
-- ... lots of code...
SET @SuppressionMethod = 'SkipSuppressedMembers'
If lower(@SuppressionMethod) = 'skipsuppressedmembers'
Begin
...No matter what, the if clause was never entered. Can anyone see the head slapper? It's a groaner.
cheers, Chris Maunder The Code Project | Co-founder Microsoft C++ MVP
You're truncating the string. Make @SuppressionMethod a varchar(22)
If your actions inspire others to dream more, learn more, do more and become more, you are a leader." - John Quincy Adams
You must accept one of two basic premises: Either we are alone in the universe, or we are not alone in the universe. And either way, the implications are staggering” - Wernher von Braun -
I've been banging my head against a wall trying to work out why a class in a stored procedure was being skipped.
DECLARE @SuppressionMethod varchar(20)
-- ... lots of code...
SET @SuppressionMethod = 'SkipSuppressedMembers'
If lower(@SuppressionMethod) = 'skipsuppressedmembers'
Begin
...No matter what, the if clause was never entered. Can anyone see the head slapper? It's a groaner.
cheers, Chris Maunder The Code Project | Co-founder Microsoft C++ MVP
The string you set is too long by 1 character.
".45 ACP - because shooting twice is just silly" - JSOP, 2010
-----
You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
-----
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass." - Dale Earnhardt, 1997 -
Ah, you just need a 6 fingered foot then you wouldn't have missed that. Fingers and toes - helping people count since year dot.
Very good :thumbsup:
cheers, Chris Maunder The Code Project | Co-founder Microsoft C++ MVP
-
I've been banging my head against a wall trying to work out why a class in a stored procedure was being skipped.
DECLARE @SuppressionMethod varchar(20)
-- ... lots of code...
SET @SuppressionMethod = 'SkipSuppressedMembers'
If lower(@SuppressionMethod) = 'skipsuppressedmembers'
Begin
...No matter what, the if clause was never entered. Can anyone see the head slapper? It's a groaner.
cheers, Chris Maunder The Code Project | Co-founder Microsoft C++ MVP
The 21 characters into a 20 character field will definitely cause headaches. How about the missing semi-colon? :)
Chris Meech I am Canadian. [heard in a local bar] In theory there is no difference between theory and practice. In practice there is. [Yogi Berra] posting about Crystal Reports here is like discussing gay marriage on a catholic church’s website.[Nishant Sivakumar]
-
I've been banging my head against a wall trying to work out why a class in a stored procedure was being skipped.
DECLARE @SuppressionMethod varchar(20)
-- ... lots of code...
SET @SuppressionMethod = 'SkipSuppressedMembers'
If lower(@SuppressionMethod) = 'skipsuppressedmembers'
Begin
...No matter what, the if clause was never entered. Can anyone see the head slapper? It's a groaner.
cheers, Chris Maunder The Code Project | Co-founder Microsoft C++ MVP
Without reading anyone's responses, 21 chars doesn't fit into a 20 char varchar. Marc
-
I've been banging my head against a wall trying to work out why a class in a stored procedure was being skipped.
DECLARE @SuppressionMethod varchar(20)
-- ... lots of code...
SET @SuppressionMethod = 'SkipSuppressedMembers'
If lower(@SuppressionMethod) = 'skipsuppressedmembers'
Begin
...No matter what, the if clause was never entered. Can anyone see the head slapper? It's a groaner.
cheers, Chris Maunder The Code Project | Co-founder Microsoft C++ MVP
Do you see how smug everyone else is that they can count and you can't? I won't belittle you the way the others have.
Forgive your enemies - it messes with their heads
"Mind bleach! Send me mind bleach!" - Nagy Vilmos
My blog | My articles | MoXAML PowerToys | Mole 2010 - debugging made easier - my favourite utility
-
I've been banging my head against a wall trying to work out why a class in a stored procedure was being skipped.
DECLARE @SuppressionMethod varchar(20)
-- ... lots of code...
SET @SuppressionMethod = 'SkipSuppressedMembers'
If lower(@SuppressionMethod) = 'skipsuppressedmembers'
Begin
...No matter what, the if clause was never entered. Can anyone see the head slapper? It's a groaner.
cheers, Chris Maunder The Code Project | Co-founder Microsoft C++ MVP
But, SQL server does have a bit data-type so maybe there is a larger bug somewhere : )
Need custom software developed? I do custom programming based primarily on MS tools with an emphasis on C# development and consulting. I also do Android Programming as I find it a refreshing break from the MS. "And they, since they Were not the one dead, turned to their affairs" -- Robert Frost
-
Do you see how smug everyone else is that they can count and you can't? I won't belittle you the way the others have.
Forgive your enemies - it messes with their heads
"Mind bleach! Send me mind bleach!" - Nagy Vilmos
My blog | My articles | MoXAML PowerToys | Mole 2010 - debugging made easier - my favourite utility
Pete O'Hanlon wrote:
I won't belittle you the way the others have.
belittle Chris about what exactly? :)
Just along for the ride. "the meat from that butcher is just the dogs danglies, absolutely amazing cuts of beef." - DaveAuld (2011)
"No, that is just the earthly manifestation of the Great God Retardon." - Nagy Vilmos (2011) -
Do you see how smug everyone else is that they can count and you can't? I won't belittle you the way the others have.
Forgive your enemies - it messes with their heads
"Mind bleach! Send me mind bleach!" - Nagy Vilmos
My blog | My articles | MoXAML PowerToys | Mole 2010 - debugging made easier - my favourite utility
That's fine. I'm off to play with the reputation table. <Later on...> Oopsie! Looks like my counting skills still aren't up to scratch.
cheers, Chris Maunder The Code Project | Co-founder Microsoft C++ MVP
-
I've been banging my head against a wall trying to work out why a class in a stored procedure was being skipped.
DECLARE @SuppressionMethod varchar(20)
-- ... lots of code...
SET @SuppressionMethod = 'SkipSuppressedMembers'
If lower(@SuppressionMethod) = 'skipsuppressedmembers'
Begin
...No matter what, the if clause was never entered. Can anyone see the head slapper? It's a groaner.
cheers, Chris Maunder The Code Project | Co-founder Microsoft C++ MVP
-
That's fine. I'm off to play with the reputation table. <Later on...> Oopsie! Looks like my counting skills still aren't up to scratch.
cheers, Chris Maunder The Code Project | Co-founder Microsoft C++ MVP
Just remember who sucked updefended to you ;)
Forgive your enemies - it messes with their heads
"Mind bleach! Send me mind bleach!" - Nagy Vilmos
My blog | My articles | MoXAML PowerToys | Mole 2010 - debugging made easier - my favourite utility
-
I've been banging my head against a wall trying to work out why a class in a stored procedure was being skipped.
DECLARE @SuppressionMethod varchar(20)
-- ... lots of code...
SET @SuppressionMethod = 'SkipSuppressedMembers'
If lower(@SuppressionMethod) = 'skipsuppressedmembers'
Begin
...No matter what, the if clause was never entered. Can anyone see the head slapper? It's a groaner.
cheers, Chris Maunder The Code Project | Co-founder Microsoft C++ MVP
You forgot to drop trou while counting? :confused:
Schenectady? What am I doing in Schenectady?
-
I've been banging my head against a wall trying to work out why a class in a stored procedure was being skipped.
DECLARE @SuppressionMethod varchar(20)
-- ... lots of code...
SET @SuppressionMethod = 'SkipSuppressedMembers'
If lower(@SuppressionMethod) = 'skipsuppressedmembers'
Begin
...No matter what, the if clause was never entered. Can anyone see the head slapper? It's a groaner.
cheers, Chris Maunder The Code Project | Co-founder Microsoft C++ MVP
-
I've been banging my head against a wall trying to work out why a class in a stored procedure was being skipped.
DECLARE @SuppressionMethod varchar(20)
-- ... lots of code...
SET @SuppressionMethod = 'SkipSuppressedMembers'
If lower(@SuppressionMethod) = 'skipsuppressedmembers'
Begin
...No matter what, the if clause was never entered. Can anyone see the head slapper? It's a groaner.
cheers, Chris Maunder The Code Project | Co-founder Microsoft C++ MVP
Using all caps for the Transact SQL operators is SO last century. :)
There is only one Vera Farmiga and Salma Hayek is her prophet! Advertise here – minimum three posts per day are guaranteed.
-
Using all caps for the Transact SQL operators is SO last century. :)
There is only one Vera Farmiga and Salma Hayek is her prophet! Advertise here – minimum three posts per day are guaranteed.
I'm old school
cheers, Chris Maunder The Code Project | Co-founder Microsoft C++ MVP
-
I've been banging my head against a wall trying to work out why a class in a stored procedure was being skipped.
DECLARE @SuppressionMethod varchar(20)
-- ... lots of code...
SET @SuppressionMethod = 'SkipSuppressedMembers'
If lower(@SuppressionMethod) = 'skipsuppressedmembers'
Begin
...No matter what, the if clause was never entered. Can anyone see the head slapper? It's a groaner.
cheers, Chris Maunder The Code Project | Co-founder Microsoft C++ MVP
Is there a good reason why you declared it only 20 chars long? Just checking... My auto-default for in-proc literals is nvarchar(255), just cos I have to deal with localised strings and 255 is generally long enough that I don't have to worry about catching these kinds of bugs.
Beautiful is better than ugly. Explicit is better than implicit. Simple is better than complex. Complex is better than complicated. Flat is better than nested. Sparse is better than dense. In the face of ambiguity, refuse the temptation to guess.
-
I've been banging my head against a wall trying to work out why a class in a stored procedure was being skipped.
DECLARE @SuppressionMethod varchar(20)
-- ... lots of code...
SET @SuppressionMethod = 'SkipSuppressedMembers'
If lower(@SuppressionMethod) = 'skipsuppressedmembers'
Begin
...No matter what, the if clause was never entered. Can anyone see the head slapper? It's a groaner.
cheers, Chris Maunder The Code Project | Co-founder Microsoft C++ MVP
assignment instead of equality check? Shoulda used yoda code. [edit] Ok, so after looking at the other responses i was way off, I guess. Still, is that not stringly typed code? [/edit]
Pete
-
Is there a good reason why you declared it only 20 chars long? Just checking... My auto-default for in-proc literals is nvarchar(255), just cos I have to deal with localised strings and 255 is generally long enough that I don't have to worry about catching these kinds of bugs.
Beautiful is better than ugly. Explicit is better than implicit. Simple is better than complex. Complex is better than complicated. Flat is better than nested. Sparse is better than dense. In the face of ambiguity, refuse the temptation to guess.
It was set at a value guaranteed to be longer than what I would need. You can see the irony, of course.
cheers, Chris Maunder The Code Project | Co-founder Microsoft C++ MVP
-
I've been banging my head against a wall trying to work out why a class in a stored procedure was being skipped.
DECLARE @SuppressionMethod varchar(20)
-- ... lots of code...
SET @SuppressionMethod = 'SkipSuppressedMembers'
If lower(@SuppressionMethod) = 'skipsuppressedmembers'
Begin
...No matter what, the if clause was never entered. Can anyone see the head slapper? It's a groaner.
cheers, Chris Maunder The Code Project | Co-founder Microsoft C++ MVP