VB-like Date Format Function (Corrected Org 3/8/04)
T-SQL String Function: Returns passed date formatted using passed criteria. Format criteria similar to Visual Basic. Saw that I could correct it, so corrected 3/8/04
2003-12-09
187 reads
T-SQL String Function: Returns passed date formatted using passed criteria. Format criteria similar to Visual Basic. Saw that I could correct it, so corrected 3/8/04
2003-12-09
187 reads
This function will strip all extra spaces, CRLFs and tabs from a SELECT statement, from the SELECT keyword to the End of the Order By clause, then reformat the statement to put all keywords at the left margin and subordinate clauses indented by ONE Tab. There is an example of a SELECT statement that came […]
2003-12-07
187 reads
This script will document tables (including constraints and triggers, row counts, sizes on disk), views (including all used fields), stored procedures (including used fields and parameters), database users, database settings and server settings.This script has been cobbled together from several others found on this site, so they deserve the recognition, not me 🙂Simply execute it […]
2003-12-05
707 reads
There are plenty of scripts out there that find duplicate indexes, but they all seem to use cursors. I didn't want to use a cursor so I ended up creating a few that could handle the duplicates and decided to share this one. This will return the table name and the names of the two […]
2003-12-04
2,767 reads
This script is similar in style to my previous script SQL Server Job Status Report, but this script generates an HTML report on the size of all databases on a specific SQL Server instance. The report consists of several sections: a summary report on the size of all databases; a summary report on the size […]
2003-12-04
1,162 reads
In my company's web site there are search pages for allowing users to search info on one or more tables (or in my case a select with 10 joins). Often the requirements for these search pages change over time with users either requesting additional columns to search or remove columns that are no longer useful. […]
2003-12-03
260 reads
Returns the number of times a character expression occurs within another character expression.cSearchExpression -- Specifies a character expression that OCCURS( ) searches for within cExpressionSearched. cExpressionSearched -- Specifies the character expression OCCURS( ) searches for cSearchExpression.OCCURS( ) returns 0 (zero) if cSearchExpression isn't found within cExpressionSearched.
2003-12-03
131 reads
Returns the number of times any word in comma delimeted character expression occurs within another character expression.cSearchExpression -- Specifies a comma delimeted character expression that OccursAny( ) searches for within cExpressionSearched. cExpressionSearched -- Specifies the character expression OccursAny( ) searches for cSearchExpression.OccursAny( ) returns 0 (zero) if cSearchExpression isn't found within cExpressionSearched.Example:OccursAny('the,dog','The quick brown fox […]
2003-12-03
91 reads
Allows user to search for stored procedures from the sysobjects table. Returns the name of the stored procedure with sp_helptext as a prefix. Useful in development environment where developers need to look up existing stored procedures.
2003-12-02
98 reads
T-SQL FunctionReturns passed 10,11 digit UPC codes with calculated checksum as 12th character.Based on http://www.mecsw.com/specs/upc_a.html
2003-12-02
420 reads
Creating a Fabric workspace takes about 30 seconds. Restructuring workspaces after people have built...
By Steve Jones
It’s a small change, but a handy one. Flyway Desktop (FWD) now includes the...
By Steve Jones
Software is hard. While I love our Lucid Gravity, I realize that they are...
Comments posted to this topic are about the item Adding new column with DEFAULT...
Comments posted to this topic are about the item Advanced Deployment Scenarios: Stairway to...
Comments posted to this topic are about the item You Need a DBA Pipeline
Which number did the two COUNT(*) return:
DROP TABLE IF EXISTS #tmp CREATE TABLE #tmp (id INT NOT NULL) INSERT INTO #tmp (id) SELECT gs.value FROM GENERATE_SERIES(1, 5) AS gs ALTER TABLE #tmp ADD my_value INT NOT NULL CONSTRAINT df_tmp_my_value DEFAULT 1 SELECT COUNT(*) FROM #tmp AS t WHERE my_value = 1 ALTER TABLE #tmp DROP CONSTRAINT df_tmp_my_value ALTER TABLE #tmp ADD CONSTRAINT df_tmp_my_value DEFAULT 2 FOR my_value SELECT COUNT(*) FROM #tmp AS t WHERE my_value = 1See possible answers