<< < 1 2 3 4 5 6 7 8 > >>   ∑:464  Sort:Date

Counting Rows with the COUNT(*) Function in SQL Server
How To Count Rows with the COUNT(*) Function in SQL Server? If you want to count the number of rows, you can use the COUNT(*) function in the SELECT clause. The following tutorial exercise shows you some good examples: SELECT COUNT(*) FROM fyi_links GO 7 SELECT COUNT(*) FROM fyi_links WHERE url LIKE...
2016-10-26, 3309🔥, 0💬

Getting Year, Month and Day Out of DATETIME Values in SQL Server
How To Get Year, Month and Day Out of DATETIME Values in SQL Server Transact-SQL? You can use DATEPART() to get any part of the DATETIME value. But to get year, month and day, you can use 3 specific functions: YEAR(), MONTH() and DAY(). These functions are equivalent to DATEPART() as: YEAR(date) = D...
2017-02-14, 3291🔥, 0💬

Selecting All Columns of All Rows from a Table in SQL Server
How To Select All Columns of All Rows from a Table with a SELECT statement in SQL Server? The simplest query statement is the one that selects all columns of all rows from a single table: "SELECT * FROM tableName". The (*) in the SELECT clause tells the query to return all columns. The missing WHERE...
2016-10-26, 3268🔥, 0💬

CONVERT() - Converting Character Strings to Numeric Values in SQL Server
How To Convert Character Strings into Numeric Values in SQL Server Transact-SQL? Sometimes you need to convert numeric values enclosed in character strings back to numeric values by using the CONVERT() function. When converting character strings to values with CONVERT(), you need to remember two rul...
2017-03-22, 3262🔥, 0💬

Formatting Time Zone in +/-hh:mm Format in SQL Server
How To Format Time Zone in +/-hh:mm Format in SQL Server Transact-SQL? From the previous tutorial, you know how to calculate the time zone value by using GETDATE() and GETUTCDATE() functions. But how can you format that time zone value in a nice looking format like +05:45 or -04:00? Unfortunately, S...
2017-02-08, 3259🔥, 0💬

Updating Multiple Rows with One UPDATE Statement in SQL Server
How To Update Multiple Rows with One UPDATE Statement in SQL Server? If the WHERE clause in an UPDATE statement matches multiple rows, the SET clause will be applied to all matched rows. This rule allows you to update values on multiple rows in a single UPDATE statement. Here is a good example: SELE...
2016-11-02, 3238🔥, 0💬

IF ... ELSE Statement in SQL Server Transact-SQL
How to execute statements under given conditions in SQL Server Transact-SQL? How to use IF ... ELSE statements? You can use IF ... ELSE statements to execute statements under given conditions in Transact-SQL using these syntaxes: IF condition statement_1 IF condition statement_1 ELSE statement_2 IF ...
2017-01-11, 3220🔥, 0💬

DATEDIFF() - Calculating DATETIME Value Differences in SQL Server
How To Calculate DATETIME Value Differences Using the DATEDIFF() Function in SQL Server Transact-SQL? If you want to calculate the difference between two date and time values, you can use the DATEDIFF() function in the following format: DATEDIFF(datepart, startdate, enddate) returns INT: "startdate"...
2017-02-20, 3211🔥, 0💬

What Is SQL Server Transact-SQL (T-SQL)?
What is SQL Server Transact-SQL (T-SQL)? SQL Server Transact-SQL, also called T-SQL, is an extension of the standard SQL (Structured Query Language). Transact-SQL was developed by Microsoft and Sybase. Microsoft's implementation ships in the Microsoft SQL Server product. Sybase uses the language in ...
2017-06-16, 3190🔥, 0💬

"sys.tables" - Getting a List of All Tables in SQL Server
How To Get a List of All Tables with "sys.tables" View in SQL Server? If you want to see the table you have just created, you can use the "sys.tables" system view to get a list of all tables in the current database. The tutorial script gives you a good example: SELECT name, type_desc, create_date FR...
2018-03-29, 3179🔥, 1💬

💬 2018-03-29 Eric: That works. Thanks!

CHARINDEX() and SUBSTRING() - Locating and Taking Substrings in SQL Server
How To Locate and Take Substrings with CHARINDEX() and SUBSTRING() Functions in SQL Server Transact-SQL? Transact-SQL is not a language designed for manipulating strings, but it does have two simple functions to locate and take substrings: CHARINDEX() and SUBSTRING(). The tutorial exercise below ass...
2017-03-07, 3162🔥, 0💬

Downloading and Installing SQL Server Management Studio Express in SQL Server
How to download and install Microsoft SQL Server Management Studio Express in SQL Server? Microsoft SQL Server Management Studio Express (SSMSE) is a free, easy-to-use graphical management tool for managing SQL Server 2005 Express Edition and SQL Server 2005 Express Edition with Advanced Services. I...
2016-12-04, 3151🔥, 0💬

GO - Sending a Statement Batch from "sqlcmd" in SQL Server
How To Use GO Command in "sqlcmd" in SQL Server? "sqlcmd" is a command line client application to run Transact-SQL statements on a target SQL Server. When "sqlcmd" is started and connected to a SQL Server, it will start a new batch and prompt you to enter the first statement of the batch. You can en...
2016-12-04, 3149🔥, 0💬

Running Queries with SQL Server Management Studio Express in SQL Server
How to run Queries with SQL Server Management Studio Express in SQL Server? 1. Launch and connect SQL Server Management Studio Express to the local SQL Server 2005 Express. 2. Click on the "New Query" button below the menu line. Enter the following SQL statement in the query window: SELECT 'Welcome ...
2016-12-04, 3133🔥, 0💬

CAST() - Converting Numeric Expression Data Types in SQL Server
How To Convert Numeric Expression Data Types using the CAST() Function in SQL Server Transact-SQL? If you want to convert the data type of a numeric expression to a new data type, you can use the CAST(expression AS data_type) function. The tutorial exercise below shows you how to use the CAST() func...
2017-03-27, 3131🔥, 0💬

sys.sql_modules - Getting User Defined Function Definitions Back in SQL Server
How To Get the Definition of a User Defined Function Back in SQL Server Transact-SQL? If you want get the definition of an existing user defined function back from the SQL Server, you can use the system view called sys.sql_modules, which stores definitions of functions, stored procedures, and views....
2016-12-18, 3094🔥, 0💬

Is SQL Server Transact-SQL Case Sensitive?
Is SQL Server Transact-SQL case sensitive? No. Transact-SQL is not case sensitive. Like the standard SQL, you can type in your Transact-SQL statement in upper case or lower case. However, you should use upper case for all key words in Transact-SQL statements as a best practice. The following example...
2017-06-16, 3088🔥, 0💬

CONVERT() - Converting Numeric Expression Data Types in SQL Server
How To Convert Numeric Expression Data Types using the CONVERT() Function in SQL Server Transact-SQL? If you want to convert the data type of a numeric expression to a new data type, you can use the CONVERT(data_type, expression) function. The tutorial exercise below shows you how to use the CONVERT...
2017-03-27, 3086🔥, 0💬

Generating CREATE VIEW Scripts on Existing Views in SQL Server
How To Generate CREATE VIEW Script on an Existing View in SQL Server? If you want to know how an existing view was created, you can use SQL Server Management Studio to automatically generate a "CREATE VIEW" script The following tutorial shows you how to do this: 1. Run SQL Server Management Studio a...
2016-11-05, 3036🔥, 0💬

UPDATE Subquery Returning Multiple Rows in SQL Server
What Happens If the UPDATE Subquery Returns Multiple Rows in SQL Server? If a subquery is used in a UPDATE statement, it must return exactly one row for each row in the update table that matches the WHERE clause. If it returns multiple rows, SQL Server will give you an error message. To test this ou...
2016-11-02, 3029🔥, 0💬

SQL Server Transact-SQL Language References
Where to find SQL Server Transact-SQL language references? You can find SQL Server Transact-SQL language references on Microsoft Website: Transact-SQL Reference for SQL Server 2016 Transact-SQL Reference for SQL Server 2014 Transact-SQL Reference for SQL Server 2012 Transact-SQL Reference for SQL Se...
2017-05-20, 3003🔥, 0💬

"ALTER TABLE ... ALTER COLUMN" - Changing Column Data Type in SQL Server
How to change the data type of an existing column with "ALTER TABLE" statements in SQL Server? Sometimes, you may need to change the data type of an existing column. For example, you want increase the string length of a column. You can use the "ALTER TABLE ... ALTER COLUMN" statements in the followi...
2016-11-15, 2990🔥, 0💬

Generating CREATE TABLE Script on Existing Tables in SQL Server
How To Generate CREATE TABLE Script on an Existing Table in SQL Server? If you want to know how an existing table was created, you can use SQL Server Management Studio to automatically generate a "CREATE TABLE" script The following tutorial shows you how to do this: 1. Run SQL Server Management Stud...
2016-11-17, 2988🔥, 0💬

"GROUP BY" - Dividing Query Output into Multiple Groups in SQL Server
How To Divide Query Output into Multiple Groups with the GROUP BY Clause in SQL Server? Sometimes, you want to divide the query output into multiple groups, and apply group functions on each individual groups. Dividing query output into multiple groups can be done with the GROUP BY clause. Here is t...
2016-10-25, 2952🔥, 0💬

<< < 1 2 3 4 5 6 7 8 > >>   ∑:464  Sort:Date