Another Number of Days in Month Function
Here is another Number of Days in the Month function for SQL Server without the use of Case or if statements. It uses the DATEPART and DATEADD built-in functions.
2002-10-28
442 reads
Here is another Number of Days in the Month function for SQL Server without the use of Case or if statements. It uses the DATEPART and DATEADD built-in functions.
2002-10-28
442 reads
The script will do the following:- build a ten digit phone number regardless of input column size.- Ignores extensions- Ignores leading 1, as in 1(800)...- Ignores most special characters or spaces- converts literals to digitsIt can be easily convert to a UDFEnjoy.C. Z. Ovits
2002-10-28
596 reads
2002-10-28
98 reads
Using the sp_help to get a table structure is very cumbersome. First, in order to print it you have to use"Results in Text" not "Results in Grid". Second, the results are very wide screen-wise and very hard to read or print. Third, you do not get the size or number rows with the same request.This […]
2002-10-28
215 reads
This script will list the spaceused by all tables in a database. You can order the output by changing one of the parameters.It also provides totals
2002-10-27
702 reads
Recently I saw here a script that returns the number of days of the month however I made my own script and I think that it's better elaborated. It's true that this is my opinion, but here it's. Evaluate it yourself.print dbo.f_days_in_month('2000-02-21')
2002-10-26
503 reads
This stored procedure extract the error code and description form the DTS package log tables in the msdb database.You just pass it the package name, step name and the time that the step started ( because you could end up with many entries in the log ) and it will return the Error Code and […]
2002-10-25
2,713 reads
When creating indexes on tables, it is always best to choose columns that have a high degree of selectivity, or uniqueness. This SP, ShowUniqueness, gives the user an easy way to determine the "uniqueness" percentage of a given column or combination of columns.
2002-10-23
477 reads
This script returns the latest package log for the DTS package specified in the @package_name variable. The interface for viewing DTS package logs through Enterprise Manager is limited in the fact that it doesn't provide textual descriptions of the values for the Step Execute Status and Step Execute Results. This makes it difficult to trace […]
2002-10-22
646 reads
We frequently have to work out a date based on a number of working days before or after a specified date, excluding Saturdays and Sundays.Attached is the script to create the function. I call another function called fn_Midnight which was designed to help whe programmers get a date with no time portion without having to […]
2002-10-22
512 reads
When I put together the invitation for T-SQL Tuesday #202, I wasn't sure what...
By Steve Jones
My life has some crazy travel stretches for sure. Between speaking, office visits, customer...
In Part 1, we saw how ‘Vamana’ represents vectors as nodes, connects them with...
Comments posted to this topic are about the item Server-Level Table sizes
Comments posted to this topic are about the item Optional Parameter Plan Optimization in...
There is a table tmp_tab:
CREATE TABLE tmp_tab ( id int, val int );
INSERT INTO tmp_tab VALUES (1, 1), (2, NULL), (3, 3), (4, 4), (5, 5);You want to order the rows ids by the following expression:
ISNULL(val, id) + 1Which of the following queries produces the expected ordering and why? (Select all correct) See possible answers