t-sql statements Archives - {coding}Sight https://codingsight.com/tag/t-sql-statements/ Blog for SQL Server DBAs and Developers Mon, 30 Oct 2023 09:32:50 +0000 en-US hourly 1 https://wordpress.org/?v=6.5.2 https://codingsight.com/wp-content/uploads/2021/10/cropped-Soсial_-Fb_180х180-1-32x32.png t-sql statements Archives - {coding}Sight https://codingsight.com/tag/t-sql-statements/ 32 32 Getting Started with the SQL Server T-SQL CASE Expression Statement https://codingsight.com/getting-started-with-the-sql-server-t-sql-case-expression-statement/ Tue, 15 Mar 2022 15:44:46 +0000 http://codingsight.com/?p=19931 SQL Server CASE expression is very useful in returning an output based on some conditional matching criteria. We can state multiple conditions in the CASE..WHEN expression and get the associated output defined in the THEN or ELSE statement. CASE expression offers two approaches to compare and return a condition-based result. As per MSDN, the Simple …

The post Getting Started with the SQL Server T-SQL CASE Expression Statement appeared first on {coding}Sight.

]]>
How to Use SQL Server T-SQL Function SUM: 5 Use Cases https://codingsight.com/how-to-use-sql-server-t-sql-function-sum-5-use-cases/ Wed, 08 Sep 2021 07:43:58 +0000 http://codingsight.com/?p=16773 The T-SQL SUM function is one of the fundamental functions. Its purpose is to calculate the sum of all values in the specified column – note that it applies to numeric columns only. Below is the syntax of SQL SUM. ALL is a default value, not mandatory to pass. It allows for returning the sum …

The post How to Use SQL Server T-SQL Function SUM: 5 Use Cases appeared first on {coding}Sight.

]]>
SQL Server ORDER BY Clause: The 5 Do’s and Don’ts to Sort Data Like a Pro https://codingsight.com/sql-order-by-the-5-dos-and-donts-to-sort-data-like-a-pro/ Thu, 12 Aug 2021 08:24:21 +0000 http://codingsight.com/?p=16061 Ugly. That’s what unsorted data looks like. We make data easy for the eyes by sorting them. And that’s what SQL ORDER BY is for. Use one or more columns or expressions as a basis to sort data. Then, add ASC or DESC to sort ascending or descending. ORDER BY syntax Learn the syntax of …

The post SQL Server ORDER BY Clause: The 5 Do’s and Don’ts to Sort Data Like a Pro appeared first on {coding}Sight.

]]>
Overview of T-SQL PRINT Statement https://codingsight.com/t-sql-print-statement/ Thu, 12 Aug 2021 07:57:25 +0000 http://codingsight.com/?p=16076 PRINT statements are crucial in any programming language. They will allow the routine or program that you are running to dump some type of log or information into a console to be viewed and analyzed. PRINTs are valuable to debugging problems within an application code. In this article, we will explore how to effectively use …

The post Overview of T-SQL PRINT Statement appeared first on {coding}Sight.

]]>
Guide for CTE in SQL Server https://codingsight.com/guide-for-cte-in-sql-server/ Wed, 28 Jul 2021 09:31:59 +0000 http://codingsight.com/?p=15802 The Common Table Expression aka CTE in SQL Server provides a temporary result set in T-SQL. You can refer to it within a SQL Select, SQL Insert, SQL Delete, or SQL Update statement. The option is available from SQL Server 2005 onwards, helping the developers write complex and long queries involving many JOINs, aggregation, and …

The post Guide for CTE in SQL Server appeared first on {coding}Sight.

]]>
Understanding DROP TABLE IF EXISTS SQL Statement https://codingsight.com/understanding-drop-table-if-exists-sql-statement/ Mon, 26 Apr 2021 13:08:28 +0000 http://codingsight.com/?p=13128 The T SQL DROP TABLE IF EXISTS statement is used to drop existing database objects. In this article, we are going to study the various use cases for this command and illustrate them with practical examples. When we create a complex stored procedure, we might also make several intermediate tables (physical tables or temp tables) …

The post Understanding DROP TABLE IF EXISTS SQL Statement appeared first on {coding}Sight.

]]>
An Overview of the PRINT Statement in SQL Server https://codingsight.com/an-overview-of-the-print-statement-in-sql-server/ Tue, 02 Mar 2021 10:08:13 +0000 http://codingsight.com/?p=12268 The SQL PRINT statement serves to display the user-defined message. For example, you are developing a script with T-SQL Loops, and you want to display some specific message on each iteration of a loop. Then you can use the PRINT statement. Or, you can use it when developing a script with conditional statements. In that …

The post An Overview of the PRINT Statement in SQL Server appeared first on {coding}Sight.

]]>
How to Round (UP/DOWN) in SQL Server – 5 Useful Tips https://codingsight.com/sql-round-5-tips-to-save-your-sanity-from-rounding-digits/ Fri, 05 Feb 2021 13:15:37 +0000 http://codingsight.com/?p=11940 We’ve been taught to round numbers since we were kids. When you round off 1.15 to the nearest tenths, will it be 1.2 or 1.1? Using the SQL ROUND function to answer may confuse you. Later, you will see what I mean. Download your FREE PDF with useful tips below ???? Here’s another question. What’s …

The post How to Round (UP/DOWN) in SQL Server – 5 Useful Tips appeared first on {coding}Sight.

]]>
SQL Server Delete Statement: How to Remove One or Multiply Rows from the Table https://codingsight.com/sql-server-delete-removing-one-or-more-rows-from-table/ Mon, 01 Feb 2021 14:23:45 +0000 http://codingsight.com/?p=11854 The right application of the DELETE statement for data removal is crucial, and it involves lots of issues. Still, there are standard practices of the DELETE statement usage that simplify all such tasks. This article will explore some of the professional life scenarios to equip you with the most helpful tips to use the DELETE …

The post SQL Server Delete Statement: How to Remove One or Multiply Rows from the Table appeared first on {coding}Sight.

]]>
CREATE TABLE MySQL vs T-SQL with Syntax Examples https://codingsight.com/top-5-mysql-create-table-syntax-for-t-sql-developers/ Thu, 28 Jan 2021 08:43:14 +0000 http://codingsight.com/?p=11823 Are you a T-SQL developer learning the basics of MySQL? Then, one of the things you might want to learn is MySQL CREATE TABLE statement. Besides, the fastest way to learn a new SQL database platform is by comparing its common functionality and syntax. That’s what we are going to do today. But the full syntax is …

The post CREATE TABLE MySQL vs T-SQL with Syntax Examples appeared first on {coding}Sight.

]]>