<< < 44 45 46 47 48 49 50 51 52 > >>   ∑:1243  Sort:Rank

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, 1401🔥, 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, 1371🔥, 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, 1300🔥, 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, 1236🔥, 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, 1229🔥, 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, 2589🔥, 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, 2253🔥, 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, 2044🔥, 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, 1732🔥, 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, 1587🔥, 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, 1535🔥, 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, 1485🔥, 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, 1379🔥, 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, 1346🔥, 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, 1334🔥, 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, 1328🔥, 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, 1285🔥, 0💬

What Is a Schema in SQL Server 2005 in SQL Server
What Is a Schema in SQL Server 2005 in SQL Server? A schema is a container of database objects with the following interesting related rules: A schema may contain different object types, like tables, indexes, views, procedures, functions, etc. A database user can be assigned with a default schema. Ob...
2016-10-22, 1277🔥, 0💬

Transferring Tables from One Schema to Another in SQL Server
How To Transfer an Existing Table from One Schema to Another Schema in SQL Server? If you want to move an existing table from one schema to another schema, you can use the "ALTER SCHEMA ... TRANSFER ..." statement as shown in the tutorial exercise below: -- Login with "sa" USE FyiCenterData; GO -- C...
2016-10-22, 1270🔥, 0💬

"CREATE SCHEMA" - Creating a New Schema in a Database in SQL Server
How To Create a New Schema in a Database in SQL Server? If you want to create a new schema in an existing database, you can use the "CREATE SCHEMA" statement as shown in the tutorial example below: USE FyiCenterData; GO CREATE SCHEMA fyi; GO Command(s) completed successfully. A new schema called "fy...
2016-10-22, 1250🔥, 0💬

sys.server_principals - Listing All Login Names in SQL Server
How To List All Login Names on the Server in SQL Server? If you want to see a list of all login names defined on the server, you can use the system view, sys.server_principals as shown in this tutorial exercise: -- Login with sa SELECT name, sid, type, type_desc FROM sys.server_principals WHERE type...
2016-10-20, 4977🔥, 0💬

Managing Security, Login and User in SQL Server
Where to find answers to frequently asked questions on Managing Security, Login and User in SQL Server? Here is a list of frequently asked questions and their answers compiled by FYIcenter.com DBA team on Managing Security, Login and User in SQL Server. Clear answers are provided with tutorial exerc...
2016-10-20, 3350🔥, 0💬

Suser_Sname() - Sever Level Security Principal of Your Session in SQL Server
What Is the Security Principal at the Server Level That Represents Your Session in SQL Server? Security principal identifies who you are when you interact with the SQL Server. What can do you at the server level solely depends on the security principal that represents you. So it is very important to...
2016-10-20, 2257🔥, 0💬

User_Name() - Database Level Security Principal of Your Session in SQL Server
What Is the Security Principal at the Database Level That Represents Your Session in SQL Server? Security principal identifies who you are when you interact with the SQL Server. What can do you at the database solely depends on the security principal that represents you. So it is very important to k...
2016-10-20, 2133🔥, 0💬

<< < 44 45 46 47 48 49 50 51 52 > >>   ∑:1243  Sort:Rank