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

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, 1361🔥, 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, 1361🔥, 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, 1360🔥, 0💬

Using Subqueries in the FROM Clause in SQL Server
How To Use Subqueries in the FROM Clause in SQL Server? If you have a query returning many rows of data, and you want to perform another query on those rows, you can put the first query as a subquery in the FROM clause of the second query. A subquery used in this way become a temporary table, and yo...
2016-10-29, 1358🔥, 0💬

"CREATE USER" - Creating a User Name in a Database in SQL Server
How To Create a User Name in a Database in SQL Server? User names are security principals at the database level. If you want to allow a login name to access a specific database, you need to create a user name in that database and link it to the login name. Creating a user name can be done by using t...
2016-10-19, 1358🔥, 0💬

Using Multiple Columns in the GROUP BY Clause in SQL Server
Can Multiple Columns Be Used in GROUP BY in SQL Server? If you want to break your output into smaller groups, you can specify multiple column names or expressions in the GROUP BY clause. Output in each group must satisfy a specific combination of the expressions listed in the GROUP BY clause. The mo...
2016-10-25, 1357🔥, 0💬

Installing SQL Server 2005 Express Edition in SQL Server
How to install SQL Server 2005 Express Edition in SQL Server? Once you have downloaded SQL Server 2005 Express Edition, you should follow this tutorial to install it on your system: 1. Double click SQLEXPR.EXE. The setup window shows up. 2. Click Next to let the setup program to unpack all files fro...
2016-12-08, 1355🔥, 0💬

What Is a Database in SQL Server
What is a database in SQL Server? A database is a logical container that contains a set of related database objects: Tables - Storages of structured data. Views - Queries to present data from tables. Indexes - Sorting indexes to speed up searches. Stored Procedures - Predefined SQL program units. Us...
2016-11-24, 1354🔥, 0💬

Providing Default Values to Procedure Parameters in SQL Server
How To Provide Default Values to Stored Procedure Parameters in SQL Server Transact-SQL? If you add a parameter when creating a stored procedure, you can provide a default value so that the execution statement is not required to pass input value to this parameter. To provide a default value to a par...
2016-12-28, 1353🔥, 0💬

"DROP DATABASE" - Deleting Databases in SQL Server
How to delete a database in SQL Server? If you created a database incorrectly, or you have a database that is not needed any more, you can delete it with the "DROP DATABASE" statement with this syntax: DROP DATABASE database_name For example, execute this statement: DROP DATABASE FyiCenterData GO Th...
2016-11-24, 1353🔥, 0💬

Updating Values with UPDATE Statements in SQL Server
How To Update Values in a Table with UPDATE Statements in SQL Server? If you want to update some values in one row or multiple rows in a table, you can use the UPDATE statement. The tutorial script below shows a good example: SELECT * FROM fyi_links WHERE id = 101 GO id url notes counts created 101 ...
2016-11-02, 1353🔥, 0💬

Defining and Using Table Alias Names in SQL Server
How To Define and Use Table Alias Names in SQL Server? When column names need to be prefixed with table names, you can define table alias name and use them to prefix column names. To define an alias for a table name, just enter the alias name right after the original table name in the FROM clause as...
2016-10-30, 1352🔥, 0💬

"INSERTED" - New Record of an DML Event Instance in SQL Server
How To Access the Inserted Record of an Event in SQL Server? When a DML event occurs, SQL Server will prepare a temporary table called "INSERTED", which contains the new record of the affected row, which is: A copy of the inserted row for an INSERT statement. A copy of the updated row for an UPDATE ...
2016-10-24, 1350🔥, 0💬

Sorting Query Output with ORDER BY Clauses in SQL Server
How To Sort the Query Output with ORDER BY Clauses in SQL Server? If you want the returning rows to be sorted, you can specify a sorting expression in the ORDER BY clause. The simplest sort expression is column name who's values will be sorted by. The following select statement returns rows sorted b...
2016-10-26, 1349🔥, 0💬

"SELECT" Statements - Reading the Data In a Table in SQL Server
How to read data in a table with "SELECT" statements in SQL Server? This is the fourth 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 tabl...
2016-12-02, 1348🔥, 0💬

Deleting All Rows with TRUNCATE TABLE Statement in SQL Server
How To Delete All Rows with TRUNCATE TABLE Statement in SQL Server? If you want to delete all rows from a table, you have two options: Use the DELETE statement with no WHERE clause. Use the TRUNCATE TABLE statement. The TRUNCATE statement is more efficient the DELETE statement. The tutorial exercise...
2016-10-30, 1348🔥, 0💬

IN - Testing Value in a Value List in SQL Server
What To Test Value Lists with the IN Operator in SQL Server Transact-SQL? Sometimes you want to test a given value against a list of values. You can do this in a loop with the regular "equal" operator. But you can also use the special comparison operator IN to get it done with the following syntaxes...
2017-01-21, 1347🔥, 0💬

UNION - Merging Outputs from Two Queries Together in SQL Server
How To Use UNION to Merge Outputs from Two Queries Together in SQL Server? If you have two queries that returns the same row fields, you can merge their outputs together with the UNION operator. The following tutorial exercise shows you how to use the UNION operator: SELECT * FROM fyi_links WHERE ta...
2016-10-26, 1344🔥, 0💬

Getting Month and Weekday Names from DATATIME Values in SQL Server
How To Get Month and Weekday Names from DATETIME Values in SQL Server Transact-SQL? In DATETIME values, the month part and weekday part have names. You can use the DATENAME() function to get the month name and weekday name from a DATETIME value in the following format: DATENAME(datepart, date) retur...
2017-02-14, 1338🔥, 0💬

Defragmenting Table Indexes in SQL Server
How To Defragment Table Indexes in SQL Server? When a table index is fragmented to a certain percentage, you need to defragment the index to maintain its performance level. There are 3 ways to defragment: 1. "ALTER INDEX index_name ON table_name REORGANIZE" - Defragmenting the specified index perfor...
2016-11-08, 1338🔥, 0💬

Categories of Functions Based on Return Modes in SQL Server
How Many Categories of Functions based Their Return Modes in SQL Server Transact-SQL? SQL Server supports 2 categories of user defined functions based on their return modes: 1. Scalar-valued Functions - A function that returns a single value. Scalar-valued functions can be used in scalar expressions...
2016-12-18, 1337🔥, 0💬

Deleting All Rows with DELETE Statements in SQL Server
How To Delete All Rows with DELETE Statements in SQL Server? If you want to delete all rows from a table, you have two options: Use the DELETE statement with no WHERE clause. Use the TRUNCATE TABLE statement. Here is an example of deleting all rows with a DELETE statement: SELECT COUNT(*) FROM fyi_l...
2016-10-30, 1337🔥, 0💬

Primary Key - Default Indexes of Tables in SQL Server
Is the PRIMARY KEY Column of a Table an Index in SQL Server? If you define a primary key on a table, an index for the primary key column will be created by default. The tutorial exercise below shows you the index created as part of the primary key column of "fyi_links": USE FyiCenterData; GO -- Drop...
2016-11-13, 1335🔥, 0💬

What Are Views in SQL Server
What Are Views in SQL Server? A view is a database object that represents the data in one or more tables in the same structure as a separate table. Here are some basic rules about views: Tables store real data. Views do not store real data. Views must have underlying tables to provide data. Each vie...
2016-11-08, 1335🔥, 0💬

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