Tag Archives | Microsoft SQL Server

List all triggers in SQL Server database with table name and schema

Sample query: Here is and another version where you can the code of the trigger:

Read full story Comments { 0 }

FORMAT Function for Transact-SQL – T-SQL

Returns a value formatted with the specified format and optional culture in SQL Server 2016. Use the FORMAT function for locale-aware formatting of date/time and number values as strings. FORMAT ( value, format [, culture ] ) Return Types:  nvarchar or null The length of the return value is determined by the format. Remarks:   FORMAT returns […]

Read full story Comments { 0 }

T-SQL Script to Group Data by Minute

If you are doing a mass data insert into a table and you want to know how fast is inserting data. I have created a script that groups data by minute, based in a DateTime data type field.

Read full story Comments { 0 }

T/SQL Splint String/Text

One common task performed in database applications is given a full name, how can this be split into the first name and last name.  In this article, three different methods are discussed to perform this task using three different functions in SQL Server.  It is assumed in this article that the full name is just […]

Read full story Comments { 0 }

T/SQL Generate Random Numbers

SQL Server has a built-in function that generates a random number, the RAND() mathematical function.  The RAND math function returns a random float value from 0 through 1.  It can take an optional seed parameter, which is an integer expression (tinyint, smallint or int) that gives the seed or start value. To use it, you […]

Read full story Comments { 0 }

T-SQL Comma Delimited Output

One of the common tasks performed when retrieving data from a SQL Server database is returning the result as a comma-delimited output instead of a result set.  This task can be performed by using a CURSOR selecting the column to be concatenated together.  Each row returned by the CURSOR is then concatenated together into a […]

Read full story Comments { 0 }

Built-in tools troubleshoot SQL Server memory usage

Dynamic management views Dynamic management views, first introduced with SQL Server 2005, provide information about server and database state. These views are useful for monitoring overall SQL Server health, identifying the root cause of SQL Server performance bottlenecks, and tuning SQL Server instance or database performance. The following is a list of dynamic management views […]

Read full story Comments { 0 }

Tips for Effective SQL Server Database Maintenance

“ I have been asked several times for advice on how to effectively maintain a production database. Sometimes the questions come from none-DBAs who are implementing new solutions and want help fine-tuning maintenance practices to fit their new databases’ characteristics. As with the majority of tasks and procedures in the IT world, there isn’t an easy […]

Read full story Comments { 0 }