Home >> Tutorials/FAQs

SQL Server DBA FAQs and Tips - 442 Questions/Tutorials

This is a collection of FAQ and tips for SQL Server DBA and developers. The clear answers and sample scripts provided can be used as learning tutorials or interview preparation guides.

It doesn't matter whether you are a beginner or an experienced SQL Server DBA or developer, browse through our SQL Server DBA FAQ and tips. They will always help you to improve your skills and find some good ideas to solve problems in your daily tasks.

So far, Our SQL Server developers have written 442 questions and answers to share with you. Each one of them answers one commonly asked SQL Server question with a short, but precise and clear SQL script. More questions will be available soon. Please come back to visit this page again.

Volume 1

SQL Server FAQs - Downloading and Installing SQL Server 2005 Express Edition

A collection of 14 FAQs on SQL Server 2005 Express Edition download and installation. Clear answers are provided with tutorial exercises on installing SQL Server 2005 Express Edition; installing .NET Framework Version 2.0; installing Management Studio Express Edition and Books Online.

  1. What is Microsoft SQL Server?
  2. How to download Microsoft SQL Server 2005 Express Edition?
  3. What are the requirements to install SQL Server 2005 Express Edition?
  4. Why I am getting "The Microsoft .Net Framework 2.0 in not installed" message?
  5. How to download and install Microsoft .NET Framework Version 2.0?
  6. What is mscorsvw.exe - Process - Microsoft .NET Framework NGEN?
  7. How to install SQL Server 2005 Express Edition?
  8. How do you know if SQL Server is running on your local system?
  9. What is sqlservr.exe - Process - SQL Server (SQLEX?PRESS)
  10. How to download and install Microsoft SQL Server Management Studio Express?
  11. How to connect SQL Server Management Studio Express to SQL Server 2005 Express?
  12. How to run Queries with SQL Server Management Studio Express?
  13. How to download and install SQL Server 2005 Books Online?
  14. How to run SQL Server 2005 Books Online on your local system?

More...

SQL Server Tutorials - Getting Started with Transact-SQL Statements

A collection of 10 tutorials for you to get started quickly with running Transact-SQL statements on SQL Server 2005. Clear examples are provided for running CREATE TABLE, INSERT, UPDATE, DELTE, SELECT, CREATE USER, GRANT EXECUTE statements.

  1. How to use Transact-SQL statements to access the database engine?
  2. How to create new databases with "CREATE DATABASE" statements?
  3. How to create new table with "CREATE TABLE" statements?
  4. How to insert and update data into a table with "INSERT" and "UPDATE" statements?
  5. How to read data in a table with "SELECT" statements?
  6. How to create a login to access the database engine using "CREATE LOGIN" statements?
  7. How to create a user to access a database using "CREATE USER" statements?
  8. How to create a view and a stored procedure using "CREATE VIEW/PROCEDURE" statements?
  9. How to grant a permission using "GRANT EXECUTE" statements?
  10. How to delete database objects with "DROP" statements?

More...

SQL Server FAQs - Creating and Managing Databases and Physical Files

A collection of 16 FAQs on creating and managing databases on SQL Server 2005. Clear answers are provided with tutorial exercises on creating, renaming, and deleting databases; setting current database; bringing databases offline and online; reviewing, moving and copy database physical files.

  1. What is a database?
  2. What is the simplest way to create a new database?
  3. How to set the current database?
  4. How to delete a database?
  5. Why I am getting this error when dropping a database?
  6. How to get a list all databases on the SQL server?
  7. Where is my database stored on the hard disk?
  8. How to create database with physical files specified?
  9. How to rename databases?
  10. Why I am getting this error when renaming a database?
  11. What are database states?
  12. How to set a database state to OFFLINE?
  13. How to move database physical files?
  14. How to set database to be READ_ONLY?
  15. How to set database to be SINGLE_USER?
  16. What are system databases?

More...

SQL Server FAQs - Creating/Managing Tables and Adding/Altering/Deleting Columns

A collection of 16 FAQs on creating and managing tables on SQL Server 2005. Clear answers are provided with tutorial exercises on creating, renaming, and deleting tables; reviewing, renaming, deleting and adding table columns; changing column data types.

  1. What is a table?
  2. What are DDL (Data Definition Language) statements for tables?
  3. How to create new tables with "CREATE TABLE" statements?
  4. How To Get a List of All Tables with "sys.tables" View?
  5. How To Get a List of Columns using the "sys.columns" View?
  6. How To Get a List of Columns using the "sp_columns" Stored Procedure?
  7. How To Get a List of Columns using the "sp_help" Stored Procedure?
  8. How To Generate CREATE TABLE Script on an Existing Table?
  9. How to create new tables with "SELECT ... INTO" statements?
  10. How To Add a New Column to an Existing Table with "ALTER TABLE ... ADD"?
  11. How To Delete an Existing Column in a Table with "ALTER TABLE ... DROP COLUMN"?
  12. How to rename an existing column with the "sp_rename" stored procedure?
  13. How to rename an existing column with SQL Server Management Studio?
  14. How to change the data type of an existing column with "ALTER TABLE" statements?
  15. How to rename an existing table with the "sp_rename" stored procedure?
  16. How To Drop an Existing Table with "DROP TABLE" Statements?

More...

SQL Server FAQs - Understanding INSERT, UPDATE and DELETE Statements

A collection of 18 FAQs on SQL INSERT, UPDATE and DELETE statements. Clear answers are provided with tutorial exercises on inserting, updating and deleting single and multiple rows; using column default values; using subqueries to INSERT and UPDATE statements.

  1. What Are DML (Data Manipulation Language) Statements?
  2. How To Create a Testing Table with Test Data?
  3. How To Insert a New Row into a Table with "INSERT INTO" Statements?
  4. How To Use Column Default Values in INSERT Statements?
  5. How to provide column names in INSERT Statements?
  6. What Happens If You Insert a Duplicate Key for the Primary Key Column?
  7. How To Insert Multiple Rows with One INSERT Statement?
  8. How To Update Values in a Table with UPDATE Statements?
  9. How To Update Multiple Rows with One UPDATE Statement?
  10. How to use old values to define new values in UPDATE statements?
  11. Is the Order of Columns in the SET Clause Important?
  12. How To Use Values from Other Tables in UPDATE Statements?
  13. What Happens If the UPDATE Subquery Returns No Rows?
  14. What Happens If the UPDATE Subquery Returns Multiple Rows?
  15. How To Delete an Existing Row with DELETE Statements?
  16. How To Delete Multiple Rows with One DELETE Statement?
  17. How To Delete All Rows with DELETE Statements?
  18. How To Delete All Rows with TRUNCATE TABLE Statement?

More...

SQL Server FAQs - Understanding SELECT Statements with Joins and Subqueries

A collection of 17 FAQs on SELECT statements with joins and subqueries. Clear answers are provided with tutorial exercises on joining multiple tables with inner and outer joins; using subqueries with IN, EXISTS, and FROM clauses; using UNION operations.

  1. How To Join Two Tables in a Single Query?
  2. How To Write a Query with an Inner Join?
  3. How To Define and Use Table Alias Names?
  4. How To Write a Query with a Left Outer Join?
  5. How To Write a Query with a Right Outer Join?
  6. How To Write a Query with a Full Outer Join?
  7. How To Write an Inner Join with the WHERE Clause?
  8. How To Name Query Output Columns?
  9. What Is a Subquery in a SELECT Query Statement?
  10. How To Use Subqueries with the IN Operators?
  11. How To Use Subqueries with the EXISTS Operators?
  12. How To Use Subqueries in the FROM Clause?
  13. How To Count Groups Returned with the GROUP BY Clause?
  14. How To Return the Top 5 Rows from a SELECT Query?
  15. How To Return the Second 5 Rows?
  16. How To Use UNION to Merge Outputs from Two Queries Together?
  17. How To Use ORDER BY with UNION Operators

More...

SQL Server FAQs - Understanding SELECT Statements and GROUP BY Clauses

A collection of 20 FAQs on SQL SELECT query statements. Clear answers are provided with tutorial exercises on simple SELECT query to select specific rows and returning specific columns; applying group aggregation functions on selected rows; dividing selected rows into multiple groups using GROUP BY and HAVING conditions; sorting selected rows and groups.

  1. What Is a SELECT Query Statement?
  2. How To Create a Testing Table with Test Data?
  3. How To Select All Columns of All Rows from a Table with a SELECT statement?
  4. How To Select Some Specific Columns from a Table in a Query?
  5. How To Select Some Specific Rows from a Table?
  6. How To Add More Data to the Testing Table?
  7. How To Sort the Query Output with ORDER BY Clauses?
  8. Can the Query Output Be Sorted by Multiple Columns?
  9. How To Sort Query Output in Descending Order?
  10. How To Count Rows with the COUNT(*) Function?
  11. Can SELECT Statements Be Used on Views?
  12. How To Filter Out Duplications in the Returning Rows?
  13. What Are Group Functions in Query Statements?
  14. How To Use Group Functions in the SELECT Clause?
  15. Can Group Functions Be Mixed with Non-group Selection Fields?
  16. How To Divide Query Output into Multiple Groups with the GROUP BY Clause?
  17. How To Apply Filtering Criteria at Group Level with The HAVING Clause?
  18. How To Count Duplicated Values in a Column?
  19. Can Multiple Columns Be Used in GROUP BY?
  20. Can Group Functions Be Used in the ORDER BY Clause?

More...

SQL Server FAQs - Introduction To Transact-SQL Language Basics and Data Types

A collection of 19 FAQs on Transact-SQL language basics and data types. Clear answers are provided with tutorial exercises on writing Transact-SQL statements; entering comments; ending and running statement batches; GO and PRINT statements; exact and approximate numeric data types; data and time, Unicode character strings and binary strings.

  1. What Is SQL Language?
  2. What Is Transact-SQL Language?
  3. What Is a Transact-SQL Statement?
  4. How To Start and End Transact-SQL Statements?
  5. How To Enter Comments in Transact-SQL Statements?
  6. What Is a Transact-SQL Statement Batch?
  7. What Happens to a Statement Batch If There Is a Compilation Error?
  8. How To Use GO Command in "sqlcmd"?
  9. How To Create User Messages with PRINT Statements?
  10. How Many Categories of Data Types Used by SQL Server?
  11. What Are Exact Numeric Data Types?
  12. What Are Approximate Numeric Data Types?
  13. What Are Date and Time Data Types?
  14. What Are Character String Data Types?
  15. What Are Unicode Character String Data Types?
  16. What Are Binary String Data Types?
  17. What Are the Differences between CHAR and NCHAR?
  18. What Are the Differences between CHAR and VARCHAR?
  19. What Are the Differences between DECIMAL and FLOAT?

More...

SQL Server FAQs - Transact-SQL Constants/Literals and Value Ranges

A collection of 18 FAQs on Transact-SQL language data constants or literals and value ranges. Clear answers are provided with tutorial exercises on entering data constants or literals; quoted character strings; date and time formats and ranges; integer and exact number literals; floating number precisions and ranges.

  1. What Is a Constant or Literal?
  2. How To Write Character String Constants or Literals?
  3. What Is a Collation?
  4. How To Specify the Collation for a Character Data Type?
  5. What Happens If Strings Are Casted into Wrong Code Pages?
  6. How To Find Out What Is the Default Collation in a Database?
  7. How Fixed Length Strings Are Truncated and Padded?
  8. How To Enter Unicode Character String Literals?
  9. How To Enter Binary String Literals?
  10. How To Enter Date and Time Literals?
  11. Why I Can Not Enter 0.001 Second in Date and Time Literals?
  12. What Happens If Date-Only Values Are Provided as Date and Time Literals?
  13. What Happens If Time-Only Values Are Provided as Date and Time Literals?
  14. What Are Out-of-Range Errors with Date and Time Literals?
  15. What Happens If an Integer Is Too Big for INT Date Type?
  16. How Extra Digits Are Handled with NUMERIC Data Type Literals?
  17. How REAL and FLOAT Literal Values Are Rounded?
  18. What Are the Underflow and Overflow Behaviors on FLOAT Literals?

More...

SQL Server FAQs - Transact-SQL Numeric Expressions and Functions

A collection of 14 FAQs on Transact-SQL language numeric expressions and functions. Clear answers are provided with tutorial exercises on writing numeric expressions; arithmetic operations; implicit data type conversions; explicit data type conversions; mathematical functions, random number generations.

  1. What Is an Expression?
  2. What Are Arithmetic Operators?
  3. What Happens to an Arithmetic Operation with Two Different Data Types?
  4. How To Convert a Numeric Expression from One Data Type to Another?
  5. How To Convert Numeric Expression Data Types by Assignment Operations?
  6. How To Convert Numeric Expression Data Types using the CAST() Function?
  7. How To Convert Numeric Expression Data Types using the CONVERT() Function?
  8. How To Convert Character Strings into Numeric Values?
  9. What Happens When Converting Big Values to Integers?
  10. What Happens When Converting Big Values to NUMERIC Data Types?
  11. What Are the Mathematical Functions Supported by SQL Server 2005?
  12. How To Convert Numeric Values to Integers?
  13. How To Round a Numeric Value To a Specific Precision?
  14. How To Generate Random Numbers with the RAND() Function?

More...

SQL Server FAQs - Transact-SQL Managing Character Strings and Binary Strings

A collection of 14 FAQs on Transact-SQL language character string and binary string operations. Clear answers are provided with tutorial exercises on concatenating character/binary strings; converting Unicode character strings; converting binary strings; inserting new line characters; locating and taking substrings; bitwise operations.

  1. How To Concatenate Two Character Strings Together?
  2. What Happens When Unicode Strings Concatenate with Non-Unicode Strings?
  3. How To Convert a Unicode Strings to Non-Unicode Strings?
  4. What Are the Character String Functions Supported by SQL Server 2005?
  5. How To Insert New Line Characters into Strings?
  6. How To Locate and Take Substrings with CHARINDEX() and SUBSTRING() Functions?
  7. How To Concatenate Two Binary Strings Together?
  8. Can Binary Strings Be Used in Arithmetical Operations?
  9. How To Convert Binary Strings into Integers?
  10. Can Binary Strings Be Converted into NUMERIC or FLOAT Data Types?
  11. Can Binary Strings Be Converted into Character Strings?
  12. Can Binary Strings Be Converted into Unicode Character Strings?
  13. How To Convert Binary Strings into Hexadecimal Character Strings
  14. What Are Bitwise Operations?

More...

SQL Server FAQs - Transact-SQL Date and Time Operations and Functions

A collection of 18 FAQs on Transact-SQL language date and time operations and functions. Clear answers are provided with tutorial exercises on converting date and time values to integers or decimal values; incrementing and decrementing date parts; taking date differences; formatting dates to strings; getting GMT times.

  1. How To Add or Remove Days on Date and Time Values?
  2. Can Date and Time Values Be Converted into Integers?
  3. Can Integers Be Converted into Date and Time Values?
  4. Are DATETIME and NUMERIC Values Convertible?
  5. Can a DATETIME Value Be Subtracted from Another DATETIME Value?
  6. What Are the Date and Time Functions Supported by SQL Server 2005?
  7. How To Increment or Decrement Parts of DATETIME Values?
  8. How To Use DATEADD() Function?
  9. How To Calculate DATETIME Value Differences Using the DATEDIFF() Function?
  10. How To Calculate Age in Days, Hours and Minutes?
  11. How To Get Month and Weekday Names from DATETIME Values?
  12. How To Get Parts of DATETIME Values as Integers?
  13. How To Get Year, Month and Day Out of DATETIME Values?
  14. What Is the Difference Between GETDATE() and GETUTCDATE()?
  15. How To Format Time Zone in +/-hh:mm Format?
  16. How To Format DATETIME Values to Strings with the CONVERT() Function?
  17. How To Truncate DATETIME Values to Dates without Time?
  18. How To Set Different Parts of a DATETIME Value?

More...

SQL Server FAQs - Transact-SQL Boolean Values and Logical Operations

A collection of 14 FAQs on Transact-SQL language Boolean values and logical operations. Clear answers are provided with tutorial exercises on getting Boolean values with comparison operations; CASE expressions; BETWEEN and IN comparisons; pattern match with LIKE operator; EXISTS and IN subquery expressions; AND and OR logical operations.

  1. What Is a Boolean Value?
  2. What Are Conditional Expressions?
  3. What Are Comparison Operations?
  4. How To Perform Comparison on Exact Numbers?
  5. How To Perform Comparison on Floating Point Numbers?
  6. How To Perform Comparison on Date and Time Values?
  7. How To Perform Comparison on Character Strings?
  8. What To Test Value Ranges with the BETWEEN Operator?
  9. What To Test Value Lists with the IN Operator?
  10. What To Perform Pattern Match with the LIKE Operator?
  11. How To Use Wildcard Characters in LIKE Operations?
  12. How To Test Subquery Results with the EXISTS Operator?
  13. How To Test Values Returned by a Subquery with the IN Operator?
  14. What Are Logical/Boolean Operations?

More...

SQL Server FAQs - Transact-SQL Conditional Statements and Loops

A collection of 5 FAQs on Transact-SQL language conditional statements and loops. Clear answers are provided with tutorial exercises on IF ... ELSE statements; WHILE loops; statement blocks; BREAK and CONTINUE statements.

  1. How To Use "IF ... ELSE IF ... ELSE ..." Statement Structures?
  2. How To Use "BEGIN ... END" Statement Structures?
  3. How To Use WHILE Loops?
  4. How To Stop a Loop Early with BREAK Statements?
  5. How To Skip Remaining Statements in a Loop Block Using CONTINUE Statements?

More...

SQL Server FAQs - Downloading and Installing Sample Scripts and Databases

A collection of 6 FAQs on download and installing SQL Server sample scripts and sample databases. Clear answers are provided with tutorial exercises on downloading and installing AdventureWorksLT; attaching AdventureWorksLT to SQL Server.

  1. What Samples and Sample Databases Are Provided by Microsoft?
  2. How to download and install SQL Server 2005 Sample Scripts?
  3. How to download and install the scaled-down database AdventureWorksLT?
  4. How to attach AdventureWorksLT physical files to the server?
  5. How AdventureWorksLT tables are related?
  6. How to add an address record into AdventureWorksLT?

More...

SQL Server FAQs - Understanding and Managing Indexes

A collection of 23 FAQs on SQL Server database indexes. Clear answers are provided with tutorial exercises on creating and dropping indexes; clustered and non-clustered indexes; indexes created by primary key and unique constraints; index fragmentation and rebuilding.

  1. What Are Indexes?
  2. How To Create an Index on an Existing Table?
  3. How To View Existing Indexes on an Given Table using SP_HELP?
  4. How To View Existing Indexes on an Given Table using sys.indexes?
  5. How To Drop Existing Indexes?
  6. Is the PRIMARY KEY Column of a Table an Index?
  7. Does the UNIQUE Constraint Create an Index?
  8. What Is the Difference Between Clustered and Non-Clustered Indexes?
  9. How To Create a Clustered Index?
  10. How To Create an Index for Multiple Columns?
  11. How To Create a Large Table with Random Data for Index Testing?
  12. How To Measure Performance of INSERT Statements?
  13. Does Index Slows Down INSERT Statements?
  14. Does Index Speed Up SELECT Statements?
  15. What Happens If You Add a New Index to Large Table?
  16. What Is the Impact on Other User Sessions When Creating Indexes?
  17. What Is Index Fragmentation?
  18. What Causes Index Fragmentation?
  19. How To Defragment Table Indexes?
  20. How To Defragment Indexes with ALTER INDEX ... REORGANIZE?
  21. How To Rebuild Indexes with ALTER INDEX ... REBUILD?
  22. How To Rebuild All Indexes on a Single Table?
  23. How To Recreate an Existing Index?

More...

SQL Server FAQs - Understanding and Managing Views

A collection of 21 FAQs on SQL Server database views. Clear answers are provided with tutorial exercises on creating and dropping views; defining and viewing view columns; creating views from multiple tables; inserting, updating and deleting data in underlying tables; creating schema binding view; creating indexes on views.

  1. What Are Views?
  2. How To Create a View on an Existing Table?
  3. How To See Existing Views?
  4. How To Drop Existing Views from a Database?
  5. How To Get a List of Columns in a View using "sys.columns"?
  6. How To Get a List of Columns in a View using the "sp_columns" Stored Procedure?
  7. How To Get a List of Columns in a View using the "sp_help" Stored Procedure?
  8. How To Generate CREATE VIEW Script on an Existing View?
  9. How To Get the Definition of a View Out of the SQL Server?
  10. Can You Create a View with Data from Multiple Tables?
  11. Can You Create a View using Data from Another View?
  12. What Happens If You Delete a Table That Is Used by a View?
  13. Can You Use ORDER BY When Defining a View?
  14. How To Modify the Underlying Query of an Existing View?
  15. Can You Insert Data into a View?
  16. Can You Update Data in a View?
  17. Can You Delete Data from a View?
  18. How To Assign New Column Names in a View?
  19. How Column Data Types Are Determined in a View?
  20. How To Bind a View to the Schema of the Underlying Tables?
  21. How To Create an Index on a View?

More...

Volume 2

SQL Server FAQs - Transact-SQL Understanding Stored Procedures

A collection of 19 FAQs on SQL Server Transact-SQL stored procedures. Clear answers are provided with tutorial exercises on creating and dropping stored procedures; retrieving and modifying stored procedures; ending stored procedures properly; defining and passing values through input and output parameters; temporary and permanent stored procedures.

  1. What Are Stored Procedures?
  2. How To Create a Simple Stored Procedure?
  3. How To Execute a Stored Procedure?
  4. How To List All Stored Procedures in the Current Database?
  5. How To Drop an Existing Stored Procedure?
  6. How To Create a Stored Procedure with a Statement Block?
  7. How To End a Stored Procedure Properly?
  8. How To Generate CREATE PROCEDURE Script on an Existing Stored Procedure?
  9. How To Get the Definition of a Stored Procedure Back?
  10. How To Modify an Existing Stored Procedure?
  11. How To Create Stored Procedures with Parameters?
  12. How To Provide Values to Stored Procedure Parameters?
  13. What Are the Advantages of Passing Name-Value Pairs as Parameters?
  14. Can You Pass Expressions to Stored Procedure Parameters?
  15. How To Provide Default Values to Stored Procedure Parameters?
  16. How To Define Output Parameters in Stored Procedures?
  17. How To Receive Output Values from Stored Procedures?
  18. How To Create a Local Temporary Stored Procedure?
  19. Can Another User Execute Your Local Temporary Stored Procedures?

More...

SQL Server FAQs - Transact-SQL Understanding User_Defined_Functions

A collection of 17 FAQs on SQL Server Transact-SQL user defined functions. Clear answers are provided with tutorial exercises on creating and dropping user defined functions; defining and passing parameters into functions; providing and using parameter default values; defining and using table-valued functions.

  1. What Are User Defined Functions?
  2. What Are the Differences between User Defined Functions and Stored Procedures?
  3. How To Create a Simple User Defined Function?
  4. How To Use User Defined Functions in Expressions?
  5. How To List All User Defined Functions in the Current Database?
  6. How To Drop an Existing User Defined Function?
  7. How To Generate CREATE FUNCTION Script on an Existing Function?
  8. How To Get the Definition of a User Defined Function Back?
  9. How To Modify an Existing User Defined Function?
  10. How To Create User Defined Functions with Parameters?
  11. How To Provide Values to User Defined Function Parameters?
  12. Can You Pass Expressions to Function Parameters?
  13. How To Provide Default Values to Function Parameters?
  14. How Many Categories of Functions based Their Return Modes?
  15. How Many Ways to Create Table-Valued Functions?
  16. How To Create an Inline Table-Valued Function?
  17. How To Create an Multi-Statement Table-Valued Function?

More...

SQL Server FAQs - Creating and Managing Schemas

A collection of 11 FAQs on SQL Server on creating and managing schemas. Clear answers are provided with tutorial exercises on listing all schemas and all objects in a schema; transferring tables from one schema to another schema; changing ownership of a schema.

  1. What Is a Schema in SQL Server 2005?
  2. How To Create a New Schema in a Database?
  3. How To List All Schemas in a Database?
  4. How To Create a New Table in a Given Schema?
  5. How To Transfer an Existing Table from One Schema to Another Schema?
  6. How To List All Objects in a Given Schema?
  7. What Is the Default Schema of Your Login Session?
  8. Who Is the Owner of a Schema?
  9. How To Change the Ownership of a Schema?
  10. What Happens If You Are Trying to Access a Schema Not Owned by You?
  11. How To Drop an Existing Schema?

More...

SQL Server FAQs - Introduction to Triggers

A collection of 20 FAQs on creating and managing triggers. Clear explanations and tutorial exercises are provided on creating DML and DDL triggers; altering, dropping, enabling and disabling triggers; accessing inserted and deleted records; overriding DML statements.

  1. What Are Triggers?
  2. What Are the Basic Features of a Trigger?
  3. How To Create a Simple Table to Test Triggers?
  4. How To Create a DML Trigger using CREATE TRIGGER Statements?
  5. How To Test a DML Trigger?
  6. How To List All Triggers in the Database with sys.triggers?
  7. How To Modify Existing Triggers using "ALTER TRIGGER"?
  8. How To Delete Existing Triggers using "DROP TRIGGER"?
  9. How To Get the Definition of a Trigger Back?
  10. How To Disable Triggers using "DISABLE TRIGGER"?
  11. How To Create a Trigger for INSERT Only?
  12. How To See the Event List of an Existing Trigger using sys.trigger_events?
  13. How To Access the Inserted Record of an Event?
  14. How To Access the Deleted Record of an Event?
  15. How To Improve the Trigger to Handle NULL Values?
  16. What Happens to a Trigger with Multiple Affected Rows?
  17. How To Override DML Statements with Triggers?
  18. How To Create a DDL Trigger using "CREATE TRIGGER" Statements?
  19. Can You Roll Back the DDL Statement in a Trigger?
  20. Can You Create a Logon Trigger in SQL Server 2005 Express Edition?

More...

SQL Server FAQs - Introduction to Cursors

A collection of 9 FAQs on working with cursors. Clear explanations and tutorial exercises are provided on declaring cursor names and cursor variables; open and close cursors; looping through cursor result set; backward scrolling; dynamic cursors.

  1. What Are Cursors?
  2. How To Declare a Cursor with "DECLARE ... CURSOR"?
  3. How To Execute the Cursor Queries with "OPEN" Statements?
  4. How To Fetch the Next Row from a Cursor with a "FETCH" Statement?
  5. How To Transfer Data from a Cursor to Variables with a "FETCH" Statement?
  6. How To Loop through the Result Set with @@FETCH_STATUS?
  7. How To Declare and Use Cursor Variables?
  8. How To Create a Scrollable Cursor with the SCROLL Option?
  9. How To Create a Dynamic Cursor with the DYNAMIC Option?

More...

SQL Server FAQs - Introduction to NULL Values

A collection of 11 FAQs on working with NULL values. Clear explanations and tutorial exercises are provided on assigning NULL values to columns, variables and parameters; evaluating expressions with NULL values; testing NULL values; ISNULL() and NULLIF() functions.

  1. What Are NULL Values?
  2. How To Assign NULL Values to Variables or Columns?
  3. What Happens If NULL Values Are Involved in Arithmetic Operations?
  4. What Happens If NULL Values Are Involved in String Operations?
  5. What Happens If NULL Values Are Involved in Datetime Operations?
  6. What Happens If NULL Values Are Involved in Bitwise Operations?
  7. What Happens If NULL Values Are Involved in Comparison Operations?
  8. What Happens If NULL Values Are Involved in Boolean Operations?
  9. How To Test NULL Values Properly?
  10. How To Replace NULL Values in Expressions using ISNULL()?
  11. How To Replace Given Values with NULL using NULLIF()?

More...

SQL Server FAQs - Security - Server Login and Database User

A collection of 17 FAQs on SQL Server logins and users. Clear answers are provided with tutorial exercises on security model; security principals, securables and permissions; creating, changing and dropping login names; linking users with logins.

  1. What Is the Security Model Used in SQL Server 2005?
  2. What Are Security Principals Used in SQL Server 2005?
  3. What Is the Security Principal at the Server Level That Represents Your Session?
  4. What Is the Security Principal at the Database Level That Represents Your Session?
  5. How To Create a New Login Name in SQL Server?
  6. How To Verify a Login name with SQLCMD Tool?
  7. How To List All Login Names on the Server?
  8. How To Change the Password of a Login Name?
  9. How To Change a Login Name?
  10. How To Disable a Login Name?
  11. How To Delete a Login Name?
  12. How To Create a User Name in a Database?
  13. How To List All User Names in a Database?
  14. How To Find the Login Name Linked to a Given User Name?
  15. How To Verify a User name with SQLCMD Tool?
  16. How To Change the Name of a Database User?
  17. How To Delete an Existing Database User?

More...

SQL Server FAQs - Configuring ODBC Connection and DSN for SQL Servers

A collection of 13 FAQs on connecting SQL Server via an ODBC DSN setting. Clear explanations and tutorial exercises are provided on creating new DSN with the SQL Server ODBC driver; starting SQL Server Browser Service; enabling TCP/IP protocol on SQL Server; verifying TCP/IP port numbers; testing ODBC DSN settings with MS Access.

  1. What Is Open Database Communication (ODBC)?
  2. How To Add a New DSN with the ODBC Driver for SQL Server?
  3. How To Define the Name and Server for a new DSN?
  4. How To Provide Login Information for a New ODBC DSN?
  5. Why Are You Getting Errors When Creating a New ODBC DSN?
  6. What Are the Requirements on SQL Server Network Connections?
  7. How To Start SQL Server Browser Service?
  8. How To Enable TCP/IP Protocol on a SQL Server?
  9. How To Verify the Port Number of the SQL Server?
  10. How To Configure ODBC DSN with Different Port Numbers?
  11. How To Configure and Test ODBC DSN Settings?
  12. How To Connect MS Access to SQL Servers through ODBC?
  13. How Can Windows Applications Connect to SQL Servers via ODBC?

More...

SQL Server FAQs - PHP ODBC Functions - Connection and Query Execution

A collection of 14 FAQs on using PHP ODBC functions to connect to SQL Server databases. Clear explanations and tutorial exercises are provided on testing ODBC DSN settings; creating connection to a SQL Server through a DSN; executing SQL statements; looping through result set; Executing prepared statements.

  1. What Are the Requirements to Use ODBC Connections in PHP Scripts?
  2. What Are Commonly Used ODBC Functions in PHP?
  3. How To Test ODBC DSN Connection Settings?
  4. How To Connect to a SQL Server using odbc_connect()?
  5. How To List All DSN Entries on Your Local Machine using odbc_data_source()?
  6. How To Execute a SQL Statement using odbc_exec()?
  7. How To Retrieve Error Messages using odbc_errormsg()?
  8. How To Turn Off Warning Messages during PHP Execution?
  9. How To Receive Returning Result from a Query?
  10. How To Loop through Result Set Objects using odbc_fetch_row()?
  11. How To Retrieve Field Values using odbc_result()?
  12. How To List All Tables in the Database using odbc_tables()?
  13. How To List All Columns in a Table using odbc_columns()?
  14. How To Create Prepared Statements using odbc_prepare()?

More...

SQL Server FAQs - PHP ODBC Functions - Managing Tables and Data Rows

A collection of 14 FAQs on using PHP ODBC functions to connect to manage tables and data rows. Clear explanations and tutorial exercises are provided on creating tables; inserting multiple data rows; updating and deleting data rows; searching data from multiple tables; looping through result sets; working with dates.

  1. PHP ODBC - How To Create a New Table?
  2. PHP ODBC - How To Insert Data into an Existing Table?
  3. PHP ODBC - How To Insert Multiple Rows with a subquery?
  4. PHP ODBC - How To Get the Number of Affected Rows?
  5. PHP ODBC - What Is a Result Set Object Returned by odbc_exec()?
  6. PHP ODBC - How To Loop through Returning Rows?
  7. PHP ODBC - How To Update Existing Rows in a Table?
  8. PHP ODBC - How To Delete Existing Rows in a Table?
  9. PHP ODBC - How To Include Text Values in SQL Statements?
  10. PHP ODBC - How To Include Date and Time Values in SQL Statements?
  11. PHP ODBC - How To Display a Past Time in Days, Hours and Minutes?
  12. PHP ODBC - How To Perform Key Word Search in Tables?
  13. PHP ODBC - How To Query Multiple Tables Jointly?
  14. PHP ODBC - How To Create an Identity Column?

More...

SQL Server FAQs - PHP MSSQL Functions - Connections and Query Execution

A collection of 18 FAQs on connecting to MS SQL Server with PHP scripts. Clear explanations and tutorial exercises are provided on SQL Server connection; providing port number; selecting database; running SQL statements; checking execution errors; looping through query result; looping through result fields.

  1. How To Download and Install PHP on Windows?
  2. How To Check Your PHP Installation?
  3. What Do You Need to Connect PHP to SQL Server?
  4. How to Turn on the MSSQL API Module?
  5. What Is Wrong with SQL Server Client Libarary DLL, ntwdblib.dll?
  6. What Happens If ntwdblib.dll Is Missing on Your Machine?
  7. Where to Find ntwdblib.dll Version 2000.80.194.0?
  8. How To Connect with Different Port Numbers?
  9. What Are Commonly Used MSSQL Functions in PHP?
  10. How To Disconnect from a SQL Server using mssql_close()?
  11. How To Select an Exiting Database using mssql_select_db()?
  12. How To Execute a SQL Statement using mssql_query()?
  13. How To Retrieve Error Messages using mssql_get_last_message()?
  14. How To Turn Off Warning Messages during PHP Execution?
  15. How To Receive Returning Result from a Query?
  16. How To Loop through Result Set Objects using mssql_fetch_array()?
  17. How To Retrieve Field Values using mssql_result()?
  18. How To List All Field Names in the Result Set using mssql_field_name()?

More...

SQL Server FAQs - PHP MSSQL Functions - Managing Tables and Data Rows

A collection of 17 FAQs on using PHP MSSQL functions to connect to manage tables and data rows. Clear explanations and tutorial exercises are provided on creating tables; inserting multiple data rows; updating and deleting data rows; searching data from multiple tables; looping through result sets; working with dates.

  1. PHP MSSQL - How To Create a New Table?
  2. PHP MSSQL - How To Drop an Existing Table?
  3. PHP MSSQL - How To Insert Data into an Existing Table?
  4. PHP MSSQL - How To Make a Column Nullable?
  5. PHP MSSQL - How To Insert Data with NULL Values?
  6. PHP MSSQL - How To Insert Multiple Rows with a subquery?
  7. PHP MSSQL - How To Get the Number of Affected Rows?
  8. PHP MSSQL - What Is a Result Set Object Returned by mssql_query()?
  9. PHP MSSQL - How To Loop through Returning Rows?
  10. PHP MSSQL - How To Update Existing Rows in a Table?
  11. PHP MSSQL - How To Delete Existing Rows in a Table?
  12. PHP MSSQL - How To Include Text Values in SQL Statements?
  13. PHP MSSQL - How To Include Date and Time Values in SQL Statements?
  14. PHP MSSQL - How To Display a Past Time in Days, Hours and Minutes?
  15. PHP MSSQL - How To Perform Key Word Search in Tables?
  16. PHP MSSQL - How To Query Multiple Tables Jointly?
  17. PHP MSSQL - How To Create an Identity Column?

More...

Related Articles:

More...


Other Tutorials/FAQs:

more...


Related Resources:

More...


Selected Jobs:

More...