BlackWaspTM
<< Previous | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | ... | Next >> |
Raising Errors in Transact-SQLRaising Errors in Transact-SQL
When developing reusable scripts, such as stored procedures and triggers, it is often necessary to raise errors. With the RAISERROR command, it is possible to create errors with varying severity and customised messages.
Obtaining the Current Database NameObtaining the Current Database Name
When developing stored procedures or functions that are to be reused by multiple databases, it may be necessary to obtain the name of the current database. This can be achieved using a metadata function.
Determining the Length of SQL Server Text DataDetermining the Length of SQL Server Text Data
When it is necessary to determine the length of character data in SQL Server, the Len function can be used. This function is not compatible with Text or NText data, so an alternative approach is required.
Preventing Overlapping Ranges in SQL ServerPreventing Overlapping Ranges in SQL Server
In some scenarios it is necessary to store ranges in a table in SQL Server. If those ranges should not be permitted to overlap, this can be prevented using a combination of constraints and a trigger.
Creating Filtered Indexes using SQL Server Management StudioCreating Filtered Indexes using SQL Server Management Studio
SQL Server filtered indexes allow only the rows in a table that meet specified criteria to be indexed, without including the remaining data. They can be created using Transact-SQL or with the tools provided in Microsoft SQL Server Management Studio.
SQL Server Filtered IndexesSQL Server Filtered Indexes
SQL Server allows data in selected columns from entire tables to be indexed, in order to improve the performance of some queries. SQL Server 2008 introduces the concept of filtered indexes. These index a limited set of the rows in a table.
Selecting into Variables in Transact-SQLSelecting into Variables in Transact-SQL
Variables are essential to the operation of many stored procedures, as they allow the temporary storage of values calculated using the operators and functions provided by Transact-SQL. Assigning variable values from query results is a common technique.
Using T-SQL&#39;s COALESCE FunctionUsing T-SQL's COALESCE Function
In denormalised databases, such as those used for reporting purposes or to feed data warehouses, it is common to need to query information from a group of columns where only one has a value. This can be simplified with the coalesce function.
Obtaining a SQL Server&#39;s NameObtaining a SQL Server's Name
In some situations it is necessary to obtain the server and instance names for a SQL Server instance, either for informational purposes or to modify the behaviour of stored procedures. These names can be obtained using configuration functions.
Simplifying Repetitive Queries with INSimplifying Repetitive Queries with IN
The usual use of the IN clause in a Transact-SQL (T-SQL) query allows a column to be compared with multiple values. For searches, where the same literal is compared with multiple columns, the IN clause can be used to simplify the query.
<< Previous | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | ... | Next >> |