|
Generate sequence numbers within a group of values.
|
Total Hit (1550) |
This example shows how to generate sequence numbers within a group of values in a SELECT statement. With proper indexes & search conditions, the example using the SELECT statement with GROUP BY will be very efficient.
|
Rating
|
|
|
Wrong usage of UPDATE FROM clause.
|
Total Hit (1569) |
This script demonstrates the wrong usage of UPDATE statement with a FROM clause esp. in case of a table with 1-to-many relationship with another tables(s).
|
Rating
|
|
|
|
Flight Schedule Ordering problem.
|
Total Hit (1737) |
A flight schedule ordering problem. This demonstrates the powerful derived table feature. More details regarding the problem is in the link.
|
Rating
|
|
|
Generate combinations of data from columns.
|
Total Hit (2243) |
How can you generate various combinations of data from existing columns? This method shows one approach using the CUBE operator with the SELECT statement.
|
Rating
|
|
|
|
|
|
|
|
Minimum value from 4 variables - datetime example.
|
Total Hit (2117) |
This scripts shows how to obtain minimum value of four 4 datatime values contained in local variables. This method can be adapted to any datatye supported by the the SQL Server MIN function. This technique basically eliminates the writing of series of IF..ELSE or CASE statements.
....Read More |
Rating
|
|
|
|
Conditional Firing of Triggers.
|
Total Hit (2135) |
This sample shows how you can conditionally fire triggers. This example shows how to suppress the trigger logic while inserting data from a SP & allowing other inserts to go through fine. A SQL6x/70/2000 version of the example is shown first & another one using the SQL70/2000 cursor function is show
....Read More |
Rating
|
|
|
|
|
Getting the second recent date from a set of values.
|
Total Hit (1855) |
ANSI & T-SQL specific solutions for getting the 2nd recent date from a set of values. This can be extended to answer nth date from a set of values but the ANSI version gets unwieldy & has to be modified for bigger values.
|
Rating
|
|
|
|
|
Strip dirty characters from a numeric string.
|
Total Hit (1766) |
A technique to search & remove dirty characters from a numeric string. This problem shows how you can simplify the solution by looking at only what is needed.
|
Rating
|
|
|
|
|
|
|
|
|
|
|
Moving Average Example #1.
|
Total Hit (2373) |
This example shows how to solve the Moving Average problem using a correlated query.
|
Rating
|
|
|
|