Viewing 12 posts - 46 through 58 (of 58 total)
I am always scared when I see code I don't understand. I will offer a solution that requires very little coding, once preparations are done. Later, date based calculations are...
Zidar's Theorem: The best code is no code at all...
September 24, 2021 at 8:15 pm
If you provide DDL (CREATE TABle) for at least Table_1 and some test data, perhaps somebody can help you write a trigger.
Zidar's Theorem: The best code is no code at all...
September 23, 2021 at 6:16 pm
Zidar's solution will always be in data modeling and table design 🙂
The first thing to do is to add two calculated fields to the table design - that does not...
Zidar's Theorem: The best code is no code at all...
September 1, 2021 at 4:43 pm
There are other methods, with less use of date functions. If uahmed90 provides CREATE TABLE statement and some reasonable test records, we could try another approach.
Zidar's Theorem: The best code is no code at all...
August 31, 2021 at 8:38 pm
Good idea would be to leave "the lookup" to the SQL server, then pass the results to C# code. Something like:
SELECT ID, NAme FROM DirectoryTable
WHERE ID...
Zidar's Theorem: The best code is no code at all...
August 31, 2021 at 8:11 pm
Ravi77, you may bi in bigger trouble than it seems.
In any case, you need to figure out what makes each table unique, does not have to be just one column....
Zidar's Theorem: The best code is no code at all...
August 31, 2021 at 8:01 pm
Function coalesce() should also do the job. In this example, I assumed that order of using dates for sorting is LastReplied, IncidentDate, CreatedDate. I also reordered columns to my liking...
Zidar's Theorem: The best code is no code at all...
August 31, 2021 at 7:49 pm
Not directly about coalesce, but since we are also talking about ways to concatenate rows, worth checking is a relatively recent addition to T-SQL functions is string_agg (expression, separator) . ...
Zidar's Theorem: The best code is no code at all...
August 18, 2021 at 7:53 pm
ROW_NUMBER in DESCending order, cool trick. Thank you SoCal_DBD. In spite being a newbie, I knew about this one, but hesitated to apply it due to possible slow execution. Live...
Zidar's Theorem: The best code is no code at all...
August 18, 2021 at 6:56 pm
Be careful with dates. Expression
>= @StartDate AND < @EndDate --- this will miss all rows within @end date
>= @StartDate AND <= @EndDate --- this...
Zidar's Theorem: The best code is no code at all...
August 18, 2021 at 6:35 pm
I haven't been on SQL.Central for a long time, so i just noticed the post.
Not sure if this is the simplest solution, but for sure is the shortest for typing:
Zidar's Theorem: The best code is no code at all...
August 18, 2021 at 6:15 pm
This is INNER JOIN. In distant past, SQL did not have JOIN keword, so people used WHERE block to specify both JOIN condition and filters. Your statement would look like...
Zidar's Theorem: The best code is no code at all...
March 5, 2020 at 1:34 am
Viewing 12 posts - 46 through 58 (of 58 total)