How in the world can this possibly be valid syntax? It apparently works,
because QA is chewing on it now. Why not just simply say WHERE
LEN(MiddleName) = 35 ?
> SELECT *
> FROM CMR WITH (nolock)
> WHERE ({ fn LENGTH(MiddleName) } = 35)
> SELECT *
> FROM CMR WITH (nolock)
> WHERE ({ fn LENGTH(LastName) } = 35)
Peace & happy computing,
Mike Labosh, MCSD
"Musha ring dum a doo dum a da!" -- James HetfieldThey are called "ODBC escape sequences".
For more informations, see:
http://msdn.microsoft.com/library/e...r_functions.asp
http://msdn.microsoft.com/library/e..._ar_ad_87sj.asp
Razvan|||{ fn ... } is ODBC syntax. For example, you can say SELECT { fn CURDATE() }
to get a string containing today's date in YYYY-MM-DD format.
I'm not sure why they would do it this way either; maybe to avoid LEN()
which is proprietary? Did you ask your coworker?
"Mike Labosh" <mlabosh@.hotmail.com> wrote in message
news:ep$dZZ1oFHA.3552@.TK2MSFTNGP10.phx.gbl...
> How in the world can this possibly be valid syntax? It apparently works,
> because QA is chewing on it now. Why not just simply say WHERE
> LEN(MiddleName) = 35 ?
>
>
> --
> Peace & happy computing,
> Mike Labosh, MCSD
> "Musha ring dum a doo dum a da!" -- James Hetfield
>|||> They are called "ODBC escape sequences".
> For more informations, see:
> http://msdn.microsoft.com/library/e...dbc.as
p
> http://msdn.microsoft.com/library/e...r_functions.asp
> http://msdn.microsoft.com/library/e..._ar_ad_87sj.asp
I cannot believe she would have written code like that. Since she works in
EM a lot, do you think this could have been code that EM generated from her
working in the graphical designer?
Peace & happy computing,
Mike Labosh, MCSD
"Musha ring dum a doo dum a da!" -- James Hetfield|||> I'm not sure why they would do it this way either; maybe to avoid LEN()
> which is proprietary? Did you ask your coworker?
This was something she did late last night, and she's not in today. And
yeah, she modified my VB code too. Outside of SourceSafe. It's been a
wonderful afternoon of tracking down and reconciling her changes. -- Changes
that don't even have a single bloody comment. @.#$%^&*!!!!
Peace & happy computing,
Mike Labosh, MCSD
"Musha ring dum a doo dum a da!" -- James Hetfield|||> I cannot believe she would have written code like that. Since she works
> in EM a lot, do you think this could have been code that EM generated from
> her working in the graphical designer?
EM does a lot of unnecessary and even bad things, but I don't think I've
ever seen it produce ODBC stuff.
Purely out of curiosity, why are the values where len=35 of particular
interest anyway?|||Maybe you could use the deprecated but still functional { fn
FIRING_SQUAD() }
"Mike Labosh" <mlabosh@.hotmail.com> wrote in message
news:O29ilk1oFHA.320@.TK2MSFTNGP09.phx.gbl...
> This was something she did late last night, and she's not in today. And
> yeah, she modified my VB code too. Outside of SourceSafe. It's been a
> wonderful afternoon of tracking down and reconciling her changes. --
> Changes that don't even have a single bloody comment. @.#$%^&*!!!!
> --
> Peace & happy computing,
> Mike Labosh, MCSD
> "Musha ring dum a doo dum a da!" -- James Hetfield
>|||"Mike Labosh" <mlabosh@.hotmail.com> wrote in message
news:ep$dZZ1oFHA.3552@.TK2MSFTNGP10.phx.gbl...
> How in the world can this possibly be valid syntax? It apparently works,
> because QA is chewing on it now. Why not just simply say WHERE
> LEN(MiddleName) = 35 ?
>
>
In my experience, there is usually a reason when somebody wrote something
like this. It usually involves a bug they had to get around.
I think you should ask him why he did it.
... seriously.|||"John" <please.reply@.to.the.group.com> wrote in message
news:ut9d$m1oFHA.3408@.tk2msftngp13.phx.gbl...
> "Mike Labosh" <mlabosh@.hotmail.com> wrote in message
> news:ep$dZZ1oFHA.3552@.TK2MSFTNGP10.phx.gbl...
> In my experience, there is usually a reason when somebody wrote something
> like this. It usually involves a bug they had to get around.
> I think you should ask him why he did it.
> ... seriously.
>
I just read some of the other posts, and your response. And another idea
came to mind.
She may have cut & pasted code from somewhere not knowing what it was .. but
since it solved the problem ... she left it.
I guess it really depends on the knowledge level of your coworker.|||> Purely out of curiosity, why are the values where len=35 of particular
> interest anyway?
Business logic rule to truncate stuff to make sure it fits in the column
without exploding:
CREATE TABLE Contact (
-- other columns
LastName NVARCHAR(35)
)
Peace & happy computing,
Mike Labosh, MCSD
"Musha ring dum a doo dum a da!" -- James Hetfield
No comments:
Post a Comment