<< < 15 16 17 18 19 20 21 22 > >>   ∑:509  Sort:Rank

Basic Features of a Trigger in SQL Server
What Are the Basic Features of a Trigger in SQL Server? Since a SQL Server trigger is a really an event handler, it has the following basic features similar to event handlers in other programming languages: Event Type - It must be declared to handle a specific event, like a DELETE event. Object Scop...
2016-10-25, 1375🔥, 0💬

HAVING - Apply Filtering Criteria at Group Level in SQL Server
How To Apply Filtering Criteria at Group Level with The HAVING Clause in SQL Server? Let's say you have divided the query output into multiple groups with the GROUP BY clause. Now you are only interested in some of the groups, not all the groups. If you want to filter out some groups from the query,...
2016-10-25, 1369🔥, 0💬

sys.trigger_events - Event List of an Existing Trigger in SQL Server
How To See the Event List of an Existing Trigger using sys.trigger_events in SQL Server? If what are the DML events an existing trigger is handling, you can use the catalog view, sys.trigger_events. You need to join sys.trigger_events and sys.triggers to get a better list as shown in this tutorial e...
2016-10-24, 2377🔥, 0💬

sys.sql_modules - Getting Trigger Definitions Back in SQL Server
How To Get the Definition of a Trigger Back in SQL Server? If you want get the definition of an existing trigger back from the SQL Server, you can use the catalog view called sys.sql_modules, which stores definitions of views, stored procedures, and triggers. The sys.sql_modules holds trigger defini...
2016-10-24, 2245🔥, 0💬

"DISABLE TRIGGER" - Disabling Triggers in SQL Server
How To Disable Triggers using "DISABLE TRIGGER" in SQL Server? If want to stop the execution of an existing trigger temporarily, you can use the "DISABLE TRIGGER" statement to disable it. The disabled trigger will be kept in the database. If you want to resume the execution of a disabled trigger, yo...
2016-10-24, 2150🔥, 0💬

Improving the Trigger to Handle NULL Values in SQL Server
How To Improve the Trigger to Handle NULL Values in SQL Server? When a NULL value is concatenated with a string, the result will be a null value. So if you want the trigger to properly report NULL values, you need to enhance the trigger as shown in the following tutorial example: USE FyiCenterData; ...
2016-10-24, 1966🔥, 0💬

Creating Triggers for INSERT Statements Only in SQL Server
How To Create a Trigger for INSERT Only in SQL Server? The trigger, dml_message, provided in previous tutorials was defined to handle all 3 types of DML statements, INSERT, UPDATE, and DELETE. If you do not want the trigger to handle all 3 types of DML statements, you can list only 1 or 2 of the sta...
2016-10-24, 1776🔥, 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, 1564🔥, 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, 1500🔥, 0💬

"DELETED" - Old Record of an DML Event Instance in SQL Server
How To Access the Deleted Record of an Event in SQL Server? When a DML event occurs, SQL Server will prepare a temporary table called "DELETED", which contains the old record of the affected row, which is: A copy of the deleted row for a DELETE statement. A copy of the row to be updated for an UPDAT...
2016-10-24, 1424🔥, 0💬

"ALTER TRIGGER" - Modifying Existing Triggers in SQL Server
How To Modify Existing Triggers using "ALTER TRIGGER" in SQL Server? If you want to make changes to an existing trigger, you could use the "ALTER TRIGGER" statements to refine the trigger again. The tutorial exercise below shows you how to modify the trigger defined in a previous tutorial: USE FyiCe...
2016-10-24, 1350🔥, 0💬

"DROP TRIGGER" - Deleting Existing Triggers in SQL Server
How To Delete Existing Triggers using "DROP TRIGGER" in SQL Server? If you don't want to use a trigger any more, you should delete it from the database by using the "DROP TRIGGER" statement as shown in tutorial example: USE FyiCenterData; GO DROP TRIGGER new_user; GO SELECT * FROM sys.triggers GO na...
2016-10-24, 1342🔥, 0💬

Rolling Back the DDL Statement in a Trigger in SQL Server
Can You Roll Back the DDL Statement in a Trigger in SQL Server? Can you roll back the DDL statement in a trigger? The answer is yes. Since the DDL statement that fires the trigger and the statements defined inside the trigger are all executed as a single statement batch, you can add a ROLLBACK state...
2016-10-22, 2782🔥, 0💬

sys.schemas - Listing All Schemas in a Database in SQL Server
How To List All Schemas in a Database in SQL Server? If you want see all existing schemas in the current database, you can use view sys.schemas as shown in the example below: USE FyiCenterData; GO SELECT * FROM sys.schemas; GO name schema_id principal_id -------------------- ----------- ------------...
2016-10-22, 2449🔥, 0💬

"sys.objects" - Listing All Objects in a Given Schema in SQL Server
How To List All Objects in a Given Schema in SQL Server? If you are wonder what objects are stored in a given schema as an object container, you can use view "sys.objects" to get a list of all objects in a schema. The tutorial exercise shows you how to list all objects in schema "fyi" and "dbo": -- ...
2016-10-22, 2213🔥, 0💬

Creating a Logon Trigger in Express Edition in SQL Server
Can You Create a Logon Trigger in SQL Server 2005 Express Edition in SQL Server? Can you create a logon trigger in SQL Server 2005 Express Edition? The answer is no. LOGON is not a supported event type in Express Edition. The script below shows you the error message when you try to create a logon tr...
2016-10-22, 1925🔥, 0💬

"ALTER AUTHORIZATION" - Changing the Ownership of a Schema in SQL Server
How To Change the Ownership of a Schema in SQL Server? If you want to change the owner of a schema, you can use the "ALTER AUTHORIZATION" statement using the following syntax: ALTER AUTHORIZATION ON SCHEMA::schema_name TO user_name The following tutorial example shows you how to change ownership of ...
2016-10-22, 1784🔥, 0💬

Default Schema of Your Login Session in SQL Server
What Is the Default Schema of Your Login Session in SQL Server? When you login to a SQL Server and select a database to use, SQL Server will assign your login session a default schema. The schema name can be omitted when you refer to objects in the default schema. Here is what you should remember ab...
2016-10-22, 1670🔥, 0💬

"CREATE TRIGGER" - Creating a DDL Trigger in SQL Server
How To Create a DDL Trigger using "CREATE TRIGGER" Statements in SQL Server? A DDL trigger is defined to handle a DDL statement event, like create, alter and drop tables, views, indexes, etc. DDL triggers can be used to generate warning messages on database object changes. The format of creating a D...
2016-10-22, 1631🔥, 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, 1522🔥, 0💬

Who Is the Owner of a Schema in SQL Server
Who Is the Owner of a Schema in SQL Server? When you create a schema in a database, SQL Server will assign a owner (a database user) to this schema. If your login name is mapped to the owner of a schema at the database level, you have the full permission on all objects in this schema. The following ...
2016-10-22, 1513🔥, 0💬

Accessing a Schema Not Owned by You in SQL Server
What Happens If You Are Trying to Access a Schema Not Owned by You in SQL Server? In general, if you are trying to access an object in schema owned by another database user, you will get a "permission denied" error, unless that you have been granted access permission to that object explicitly. Here ...
2016-10-22, 1469🔥, 0💬

Creating and Managing Schemas in SQL Server
Where to find answers to frequently asked questions on Creating and Managing Schemas in SQL Server? Here is a list of frequently asked questions and their answers compiled by FYIcenter.com DBA team on Creating and Managing Schemas in SQL Server. Clear answers are provided with tutorial exercises on ...
2016-10-22, 1455🔥, 0💬

Creating a New Table in a Given Schema in SQL Server
How To Create a New Table in a Given Schema in SQL Server? When you create a new table, you can specify in which schema you want this table to be located by prefixing the table name with the schema name. In the tutorial example below, a new table "test" is created in schema "fyi": USE FyiCenterData;...
2016-10-22, 1425🔥, 0💬

<< < 15 16 17 18 19 20 21 22 > >>   ∑:509  Sort:Rank