Published on

May 13, 2013

Exploring SQL Server Concepts and Ideas

Welcome to our blog post where we will be discussing various concepts and ideas related to SQL Server. SQL Server is a powerful relational database management system that is widely used in the industry. Whether you are a beginner or an experienced developer, there is always something new to learn in the world of SQL Server.

Finding Tables without Clustered Index

A clustered index is a crucial concept in SQL Server as it heavily impacts performance. In this article, we provide a quick script to find tables without a clustered index. By identifying these tables, you can optimize your database design and improve query performance.

Replacing Deprecated Data Types

SQL Server 2005 introduced new data types, such as VARCHAR(MAX), NVARCHAR(MAX), and VARBINARY(MAX), which are recommended replacements for the deprecated TEXT, NTEXT, and IMAGE data types. We discuss the backward compatibility of these data types and why it is recommended to use the new ones.

Limiting Result Sets with TABLESAMPLE

When working with large tables, it may not always be necessary to retrieve the entire result set. SQL Server 2005 introduced the TABLESAMPLE clause, which allows you to extract a random sampling of rows from a table. We provide examples and explain how to use TABLESAMPLE effectively.

Understanding User Defined Functions (UDF) Limitations

User Defined Functions (UDFs) have their advantages, but they also have limitations. In this article, we explore the limitations of UDFs and compare them to stored procedures. Understanding these limitations can help you make informed decisions when choosing between UDFs and stored procedures.

Changing Database Compatible Level

SQL Server releases new versions every few years, and changing the database compatible level becomes a popular topic. We discuss how to change the compatible level using T-SQL and also provide a guide for changing it using SQL Server Management Studio (SSMS).

Limiting VARCHAR(MAX) Field Length

Have you ever wondered how to limit the length of a VARCHAR(MAX) field? Although it may seem strange, there are scenarios where such a requirement exists. In this blog post, we explain how to limit the maximum length of a VARCHAR(MAX) field to 12500 characters.

Exploring UNPIVOT Table

Understanding the UNPIVOT operation in SQL Server can be challenging. In this article, we simplify the concept and provide examples to help you grasp the concept easily. UNPIVOT is a useful tool for transforming data from a wide format to a tall format.

Creating Default Constraints

Default constraints are a handy feature in SQL Server that allow you to specify a default value for a column. We provide a straightforward script for creating default constraints and explain how to use them effectively in your database design.

Getting the Day of the Week with a UDF

Have you ever needed to retrieve the day of the week in SQL Server? We share a simple user-defined function (UDF) that can immediately give you the day of the week in a single line of code. This function can be a time-saver in various scenarios.

Discovering Hostname and Current Logged In User Name

In this article, we reveal two tricks to quickly find out the hostname and current logged-in user name in SQL Server. These tricks can come in handy when you need to gather information about the environment in which your database is running.

Observing Logon Trigger Behavior

Logon triggers in SQL Server can sometimes exhibit unexpected behavior. We share an interesting observation where a logon trigger executed multiple times, even though it was expected to execute only once. Understanding these nuances can help you troubleshoot similar scenarios.

Difference Between Candidate Keys and Primary Key

Selecting the primary key for a table is a critical decision that can impact database architecture and future normalization. In this article, we discuss the difference between candidate keys and primary keys and the importance of selecting the right primary key for your tables.

Creating Multiple Filegroups for a Database

Why would you want to create multiple filegroups for a database? In this blog post, we explore the advantages of using multiple filegroups and explain how they can benefit your database design and performance.

Listing Objects and Filegroups in a Database

Have you ever wondered which objects belong to which filegroup in your database? We provide insights into how you can find this information and understand the relationship between objects and filegroups in SQL Server.

Working with DATE and TIME in SQL Server 2008

SQL Server 2008 introduced the DATE and TIME data types, which have specific behaviors when converted to DATETIME. We explain these behaviors and highlight considerations when running scripts across different versions of SQL Server.

Managing Disabled Indexes and Update Statistics

If you have disabled nonclustered indexes that you no longer need, it is recommended to drop them to avoid unnecessary overhead. We discuss the impact of disabled indexes on statistics updates and provide guidance on managing them effectively.

Precision of SMALLDATETIME

The SMALLDATETIME data type in SQL Server has a precision of 1 minute. It discards seconds by rounding up or down any seconds greater than zero. Understanding this precision can help you work with SMALLDATETIME effectively in your applications.

Retrieving Column Headers without Result Data

When testing the format of query responses, you may want to retrieve only the metadata without actually running the query. We explain how to use the SET FMTONLY ON setting to achieve this and obtain column headers without retrieving any result data.

Copying Databases between Instances

SQL Server provides a feature to copy databases from one instance to another, and this process can be automated using SQL Server Integration Services (SSIS). We guide you through the steps and highlight the importance of having SQL Server Agent turned on for this feature.

Understanding SELECT * vs SELECT COUNT(*)

Have you ever wondered why executing SELECT * alone gives an error, while SELECT COUNT(*) does not? In this blog post, we unravel this puzzle and explain the reasons behind this behavior in SQL Server.

Creating New Databases with Full Recovery Model

Model database in SQL Server can be a powerful tool for setting default behaviors for newly created databases. We share an interesting story where a user wanted every new database to have a specific recovery model and explain how to achieve this using the model database.

Developer Training and its Significance

In a five-part series, we delve into the importance and significance of developer training. We discuss topics such as employee morals and ethics, difficult questions, alternative perspectives, various training options, and provide a conclusive summary. Continuous learning and training are essential for developers to stay updated in the ever-evolving world of technology.

We hope you find these articles informative and helpful in your SQL Server journey. Stay tuned for more exciting content on SQL Server concepts and ideas!

Click to rate this post!
[Total: 0 Average: 0]

Let's work together

Send us a message or book free introductory meeting with us using button below.