|
SomeGuyThatIsMe wrote: wonder why they just didnt use one varchar(max) or a text field.
I'd guess this was written in SQL 2000. max didn't exist and it took too much thinking to do character manipulation on text fields. (For anyone who'd write this in the first place.)
I can't picture how to execute a cursor on a varchar field. (Extract a fraction of the data and then use a cursor to retrieve it from a table, sure, but ON the field?)
|
|
|
|
|
If i find the time today i'll post that piece of the sp.
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
Because people are still looking for a silver-bullet, 1 thing that can do everything for you. Would hate to see the design & architecture of the rest of the 'solution'
____________________________________________________________
Be brave little warrior, be VERY brave
|
|
|
|
|
Design? Architecture? Not on this project man!
|
|
|
|
|
Because the person who wrote it likes to curl up in a small ball with a nervous twitch in their eye whilst they inappropriately touch a small fury animal.
Honestly, you're better not asking, pretend you never saw it and maybe, just maybe, you'll make it through to tomorrow with a shred of sanity left in you.
Eagles may soar, but weasels don't get sucked into jet engines
|
|
|
|
|
Gave me a good laugh right now
|
|
|
|
|
You have an application that is 25 years old with no documentation for the tables, c-isam tables. You have to make this wonderful application talk to a modern day databases. You have been given a budget of $0 to get this task completed. You have just enough time to learn syntax to put something together that will hopefully work. That is how this happens.
|
|
|
|
|
I could see it happening that way sometimes. But this code was from an ASP.net app. The comments put the creation date of this piece around 2005.
This may have come about through code rot. Maybe it worked great for something small and the scope and input string kept expanding. In any case... ick. And of course I don't have the time to fix it either. So I'll pass it on to somebody else also.
|
|
|
|
|
I see this and I think "Why did I enable it? Why did I agree to varchar(8000)? I could have stopped it. I could have kept Sybase's 255 character limit. I could have...."
Ah the law of unintended consequences.
|
|
|
|
|
I've seen code like that were they were manipulating data -- usually because they couldn't (normally they just didn't want to) use better tools.
But I'm worried about this line -- Which was then pealed apart using cursors.
Cursors?
|
|
|
|
|
|
|
It doesn't compile because it's printed on sheets of paper.
Then again, you can always try to hold the paper in front of a webcam and press CTR-SHFT-B.
.
|
|
|
|
|
99% of the time,
customer.DataExtRetList != null . This was supposed to fix the edge cases when
customer.DataExtRetList == null .
if (customer.DataExtRetList != null) {
this.QBInfo.DateCatSent = "";
this.Source = "";
} else {
for (int i = 0; i < customer.DataExtRetList.Count; i++) {
IDataExtRet ext = customer.DataExtRetList.GetAt(i);
if (ext.DataExtName.GetValueOrEmpty() == "Date Cat. Sent")
this.QBInfo.DateCatSent = ext.DataExtValue.GetValueOrEmpty();
else if (ext.DataExtName.GetValueOrEmpty() == "Source")
this.Source = ext.DataExtValue.GetValueOrEmpty();
}
}
modified 9-Nov-12 22:35pm.
|
|
|
|
|
Daer frnds,
need help urgenz. Most time my code simply not work. Sometime it give errro refernce not setting object. Plz help its urgentz.
|
|
|
|
|
Why do you think I posted it in this forum? Did you miss the mistake?
|
|
|
|
|
And do you see that I marked it as a joke? Oh dear, I know the meaning of this forum, and I saw the problems the code snippet causes. And I posted like someone would do who uses to write such code. That seems to be beyond the joking capacity of an average CP member though, as can be deduced from the votes...
|
|
|
|
|
Ouch.
I think computer viruses should count as life. I think it says something about human nature that the only form of life we have created so far is purely destructive. We've created life in our own image.
Stephen Hawking
|
|
|
|
|
That is a level of fail which leaves me speechless.
|
|
|
|
|
I can do it even better ...
Yesterday I found that gem in my own code
Boolean deleted = false;
if(deleted){
...
}
what a great luck I wrote it only five minutes before I observed my supersophisticated State-of-the-art-Failure...
|
|
|
|
|
In few of the reports I came across this while doing some maintenance work... beautiful isn't it ???
select ......
where
and F2TRDT >= " & Year(Parameters!DateFrom.Value)*10000+Month(Parameters!DateFrom.Value)*100+day(Parameters!DateFrom.Value) & "
and F2TRDT <= " & Year(Parameters!DateTo.Value)*10000+Month(Parameters!DateTo.Value)*100+day(Parameters!DateTo.Value) & "
Zen and the art of software maintenance : rm -rf *
Math is like love : a simple idea but it can get complicated.
|
|
|
|
|
Nice thinking!
|
|
|
|
|
Oh, I see your point: that guy was assuming a month could have upto 99 days, and a year upto 99 months, and thus was waisting many numbers, and his formula will soon hit the limits of an Int32.
He'd better do a
and F2TRDT >= " & Year(Parameters!DateFrom.Value)*372+Month(Parameters!DateFrom.Value)*31+day(Parameters!DateFrom.Value) & "
and F2TRDT <= " & Year(Parameters!DateTo.Value)*372+Month(Parameters!DateTo.Value)*31+day(Parameters!DateTo.Value) & "
which still waists some 6 or 7 days per year.
|
|
|
|
|
It is not about converting into integer number... The date needs to be in yyyyMMdd format.. The whole point is why not use Foramt() function...
Zen and the art of software maintenance : rm -rf *
Math is like love : a simple idea but it can get complicated.
|
|
|
|
|
... I'd better have marked my post as a joke ...
|
|
|
|