|
Honestly, for anyone that works regularly with LINQ "thinking in sets" is the norm. It's just that those sets are considered after a data layer call has completed, not before. I guess it's all about the abstraction layer that we live in.
On your suggestion I re-read Graus's article and, with inspiration from the article, I found that the table did indeed act as a tally for 2 SPs, which are executed annually, on about 1000 rows between them.
So ultimately tbl50 does indeed have a purpose that would have been better served by an incremental (in this specific case). I appreciate the guidance!
"There are three kinds of lies: lies, damned lies and statistics."
- Benjamin Disraeli
|
|
|
|
|
Well, I wouldn't dirty down the database with a tally table if performance isn't of any importance for something that's used twice a year.
The right tools for the right job is a good rule.
|
|
|
|
|
So now go and rename the table "TallyTable" or add an Description property to the table or something to help the next pilgrim who emerges from the brambles.
cheers
Chris Maunder
|
|
|
|
|
It's a nice thought CM, but honestly I'm gutting the thing for useful logic. SPs will be moved into application code so that I can properly abstract this thing, and that table will have no place in the new version.
"There are three kinds of lies: lies, damned lies and statistics."
- Benjamin Disraeli
|
|
|
|
|
Thanks for the tip. Read the article and found it to be quite illuminating. Thanks.
When you are dead, you won't even know that you are dead. It's a pain only felt by others.
Same thing when you are stupid.
modified 19-Nov-21 21:01pm.
|
|
|
|
|
I think tally tables should be banned.
A tallyban.
|
|
|
|
|
You sound Indian... are you from punjab?
DURA LEX, SED LEX
GCS d--- s-/++ a- C++++ U+++ P- L- E-- W++ N++ o+ K- w+++ O? M-- V? PS+ PE- Y+ PGP t++ 5? X R++ tv-- b+ DI+++ D++ G e++>+++ h--- ++>+++ y+++* Weapons extension: ma- k++ F+2 X
If you think 'goto' is evil, try writing an Assembly program without JMP. -- TNCaver
When I was six, there were no ones and zeroes - only zeroes. And not all of them worked. -- Ravi Bhavnani
|
|
|
|
|
That is a good one. I've seen the:
select * from [day]
Monday
Tuesday
Wednesday
Thursday
Friday
Saturday
Sunday
And when I asked what this is for the response was, "a list of the days of the week, duh!"
|
|
|
|
|
A while back I had to support a client's bloated d/b schema. The customer table had a column "Gender", of type INT. There was a tblGender, with an INT key and a text column. It had two rows; 1/M and 2/F. Then there was another table called tblGenderTexts. It also had two columns, both text. Yep, values M/Male and F/Female.
|
|
|
|
|
That DBA needed to be whacked with a clue-wrecking-ball.
What do you get when you cross a joke with a rhetorical question?
The metaphorical solid rear-end expulsions have impacted the metaphorical motorized bladed rotating air movement mechanism.
Do questions with multiple question marks annoy you???
|
|
|
|
|
Just a couple of days ago I found a table like that in the SQL-Server DB of Team Foundation Server 2015.
It is called Number. So it seems there are uses for this out there. Haven't read the Graussian article yet that is mentioned in the thread, but I think I really should.
Cheers!
"I had the right to remain silent, but I didn't have the ability!"
Ron White, Comedian
|
|
|
|
|
... but the C# compiler doesn't complain, so it's likely valid code:
Dictionary<string, List<Tuple<string, DateTime, List<MyType>>>> MyTypes = new Dictionary<string, List<Tuple<string, DateTime, List<MyType>>>>();
Why should you define a class when you can do the job with built-in types?
|
|
|
|
|
Quick, get him back to front end.
|
|
|
|
|
MyType isn't a built-in type, so he defined a class.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Oh dear, shame on me! What prevented me from seeing that - the code or my presbyopia?
|
|
|
|
|
public class MyComplexType: Dictionary<string, List<Tuple<string, DateTime, List<MyType>>>>
{
}
So, a new MyComplexType would make this more "readable"? :p
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
I've...err....done something like that before.
I'm not proud of it, and in my defense I was about 10 min from presentation and found a bug, but still....
"There are three kinds of lies: lies, damned lies and statistics."
- Benjamin Disraeli
|
|
|
|
|
Nothing wrong with that, but maybe use an alias instead.
Would you prefer:
class MyTypeCollection : Dictionary<string, List<Tuple<string, DateTime, List<MyType>>>> {}
|
|
|
|
|
If todayPos.Instrument.InstrumentTypeID <> TYPE_FIXEDINCOME OrElse todayPos.Instrument Is Nothing Then
Continue For
End If
It works so much better if you do the defensive bit before the OrElse...
|
|
|
|
|
Oh wait, that guy forgot another null check:
If todayPos.Instrument.InstrumentTypeID <> TYPE_FIXEDINCOME OrElse todayPos.Instrument Is Nothing OrElse todayPos Is Nothing Then
Continue For
End If Hope that helps with the ugly "reference not set to an object" exception you faced.
|
|
|
|
|
You must respect the putting of the cart before the horse!
"There are three kinds of lies: lies, damned lies and statistics."
- Benjamin Disraeli
|
|
|
|
|
bool orphan = false;
if (intJobCategory < 0 || intJobType < 0)
{
orphan = true;
}
if (orphan)
{
string message = "orphan detected intJobCategoryJobTypeID=" + intId.ToString();
this.state.Status = message;
}
else
{
...
}
And just to clarify, that bool is never used again...
|
|
|
|
|
Some people prefer to spell it out rather than jam it all into a single line.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
I agree it's ugly, could it be that orphan was used in other places at some point?
"the debugger doesn't tell me anything because this code compiles just fine" - random QA comment
"Facebook is where you tell lies to your friends. Twitter is where you tell the truth to strangers." - chriselst
"I don't drink any more... then again, I don't drink any less." - Mike Mullikins uncle
|
|
|
|
|
That's what I thought, maybe the variable was originally used elsewhere but that code deleted and this not tidied up. Also compiler optimisation would probably fix this code anyway.
|
|
|
|