<< < 9 10 11 12 13 14 15 16 17 18 19 > >>   ∑:469  Sort:Date

Creating an Index for Multiple Columns in SQL Server
How To Create an Index for Multiple Columns in SQL Server? An index for multiple columns works similarly to a sorting process on multiple columns. If an index is defined for two columns, the index key is composed by values from those two columns. A multi-column index will be used to speed up the sea...
2016-11-13, 1413🔥, 0💬

CREATE CLUSTERED INDEX - Adding Clustered Indexes in SQL Server
How To Create a Clustered Index in SQL Server? If there is no primary key in a table, you can add one clustered index to that table with CREATE CLUSTERED INDEX statement. The tutorial exercise below shows you how to create a clustered index: USE FyiCenterData; GO -- Drop the old table, if needed DRO...
2016-11-13, 1411🔥, 0💬

UPDATE Subquery Returning No Rows in SQL Server
What Happens If the UPDATE Subquery Returns No Rows in SQL Server? If you use a subquery to assign new values in the SET clause in an UPDATE statement, and the subquery returns no rows for an outer row, SQL Server will provide a NULL value to the SET clause. The tutorial exercise below shows you a g...
2016-11-02, 1411🔥, 0💬

Performing Comparison on Character Strings in SQL Server
How To Perform Comparison on Character Strings in SQL Server Transact-SQL? Comparison operations on character strings are performed based on the associated collation. Each collation defines rules on how characters are ordered, how character cases and accents are treated, etc. The tutorial exercise b...
2017-01-21, 1410🔥, 0💬

Triggers with Multiple Affected Rows in SQL Server
What Happens to a Trigger with Multiple Affected Rows in SQL Server? If there is only one row affected by a DML statement, we know that the DML trigger will be executed once. But how many times the DML trigger will be executed if the DML statement resulted multiple affected rows? The answer is still...
2016-10-24, 1409🔥, 0💬

"RETURNS TABLE" - Creating Inline Table-Value Functions in SQL Server
How To Create an Inline Table-Valued Function in SQL Server Transact-SQL? To create an inline table-valued function, you need to use the "RETURNS TABLE" clause in the "CREATE FUNCTION" statement. There should be no function body, except for a RETURN statement with a SELECT subquery: An inline table-...
2016-12-18, 1408🔥, 0💬

UNIQUE Constraint Creating Default Index in SQL Server
Does the UNIQUE Constraint Create an Index in SQL Server? If you add the UNIQUE constraint on a column, SQL Server will automatically add a non-clustered index for that column. The tutorial exercise below shows you the index created as part of the UNIQUE column, "id", of "fyi_links": USE FyiCenterDa...
2016-11-13, 1407🔥, 0💬

Using ORDER BY with UNION Operators in SQL Server
How To Use ORDER BY with UNION Operators in SQL Server? If you need to sort the output from two queries grouped together with a UNION operator, you need to apply the ORDER BY clause at the group level, not at the subquery level. Note that SQL Server and MySQL react differently to the ORDER BY clause...
2016-10-26, 1406🔥, 0💬

Adding a New Index to a Large Table in SQL Server
What Happens If You Add a New Index to Large Table in SQL Server? An index can be added when you create a new table. New rows will be indexed as they are inserted into the table. But you can also add a new index to an existing table with the same CREATE INDEX statement. The existing rows will be ind...
2016-11-13, 1399🔥, 0💬

Returning the Second 5 Rows from a Query in SQL Server
How To Return the Second 5 Rows in SQL Server? If you want to display query output in multiple pages with 5 rows per page, and the visitor wants to see the output for the second page, you need to display query output from row 6 to row 10. If you are using MySQL server, you can use the "LIMIT startRo...
2016-10-29, 1398🔥, 0💬

System Databases Used by SQL Servers in SQL Server
What are system databases in SQL Server? System databases are created by the SQL Server itself during the installation process. System databases are used by the SQL server to help manage other user databases and client execution sessions. SQL Server 2005 Express Edition uses 4 system databases: mast...
2016-11-20, 1397🔥, 0💬

Sorting Query Output by Multiple Columns in SQL Server
Can the Query Output Be Sorted by Multiple Columns in SQL Server? You can specifying multiple columns in the ORDER BY clause as shown in the following example statement, which returns rows sorted by "tag" and "counts" values: SELECT tag, counts, url, created FROM fyi_links ORDER BY tag, counts GO ta...
2016-10-26, 1397🔥, 0💬

"DROP SCHEMA" - Dropping an Existing Schema in SQL Server
How To Drop an Existing Schema in SQL Server? If you want to delete a schema, you need to move all objects out of that schema, then use the "DROP SCHEMA" statement to delete the schema. The tutorial exercise below shows you how to drop schema "fyi": -- Login with "sa" USE FyiCenterData; GO -- Drop f...
2016-10-20, 1397🔥, 0💬

Creating a View with Data from Another View in SQL Server
Can You Create a View using Data from Another View in SQL Server? Can You Create a View with Data from Another View? The answer is yes. A view can be used as a table to build other views. The tutorial exercise below shows you how to create a view using data from another view: USE AdventureWorksLT; G...
2016-11-05, 1394🔥, 0💬

What Is a SELECT Query Statement in SQL Server
What Is a SELECT Query Statement in SQL Server? The SELECT statement is also called the query statement. It is the most frequently used SQL statement in any database application. SELECT statements allows you to retrieve data from one or more tables or views, with different selection criteria, groupi...
2016-10-26, 1394🔥, 0💬

NULL Values Involved in Datetime Operations in SQL Server
What Happens If NULL Values Are Involved in Datetime Operations in SQL Server Transact-SQL? If NULL values are involved in datetime operations, the result will be datetime NULL values. The following tutorial script shows you some good examples: USE FyiCenterData; GO SELECT GETDATE()+NULL; GO -------...
2017-02-05, 1393🔥, 0💬

Using SELECT Statements with Joins and Subqueries in SQL Server
Where to find answers to frequently asked questions on Using SELECT Statements with Joins and Subqueries in SQL Server? Here is a list of frequently asked questions and their answers compiled by FYIcenter.com DBA team on Using SELECT Statements with Joins and Subqueries in SQL Server. Clear answers ...
2016-10-30, 1393🔥, 0💬

"CREATE TABLE" Statement - Creating New Tables in SQL Server
How to create new table with "CREATE TABLE" statements in SQL Server? This is the second tutorial of a quick lesson on creating database objects with Transact-SQL statements. This lesson shows you how to create a database, create a table in the database, and then access and change the data in the ta...
2016-12-02, 1392🔥, 0💬

What Is a Table in SQL Server
What is a table in SQL Server? A table in database is a data object used to store data. Tables have the following features: Data is stored in a table with a structure of rows and columns. Columns must be pre-defined with names, types and constrains. A table object may have other associated data obje...
2016-11-20, 1392🔥, 0💬

Getting Parts of DATETIME Values as Integers in SQL Server
How To Get Parts of DATETIME Values as Integers in SQL Server Transact-SQL? Sometimes, you want to one specific part of a DATETIME value as an integer to be used in your own date and time calculations. This can be done by using the DATEPART() function in the following format: DATENAME(datepart, date...
2017-02-14, 1386🔥, 0💬

What Are User Defined Functions in SQL Server
What Are User Defined Functions in SQL Server Transact-SQL? A user defined function is a collection of Transact-SQL statements that stored in the SQL Server. A user defined function will return data when executed. A user defined function works in the same way as a system function. It can be used as ...
2016-12-28, 1386🔥, 0💬

Renaming Database Names in SQL Server
How to rename databases in SQL Server? If don't like the name of a database, you can change it by using the "ALTER DATABASE" statement with the following syntax: ALTER DATABASE database_name MODIFY NAME = new_database_name The tutorial example below shows you how change the database name from "FyiCe...
2016-11-24, 1386🔥, 0💬

CREATE INDEX - Adding an Index on an Existing Table in SQL Server
How To Create an Index on an Existing Table in SQL Server? If you want to an index on an existing table, you can use the CREATE INDEX statement in a simple syntax: CREATE INDEX index_name ON table_name (column_name) The tutorial exercise below shows you how to add an index for the "in" column of the...
2016-11-15, 1386🔥, 0💬

"INSTEAD OF" - Overriding DML Statements with Triggers in SQL Server
How To Override DML Statements with Triggers in SQL Server? Sometime, you may want to implement some business logics in a DML trigger to cancel the DML statement. For example, you may want to check the new email address format provided by the UPDATE statement. If the email address is invalid, you to...
2016-10-22, 1386🔥, 0💬

<< < 9 10 11 12 13 14 15 16 17 18 19 > >>   ∑:469  Sort:Date