Database Journal
MS SQL Oracle DB2 Access MySQL PostgreSQL Sybase PHP SQL Etc SQL Scripts & Samples Tips Database Forum Rss Feed

» Database Journal Home
» Database Articles
» Database Tutorials
MS Access
SQL Scripts & Samples
» Database Forum
» Slideshows
Free Newsletters:

News Via RSS Feed

Rss Feed

Database Journal |DBA Support |SQLCourse |SQLCourse2

Featured Database Articles

Database News

Posted Jan 6, 2006

SQL Server 2005 T-SQL New Features: OUTPUT

By DatabaseJournal.com Staff

[From DBAzine]

While it is convenient to have SQL statements generate values, it can be problematic if the generated values need to be known and used. For example, it is a widespread and common practice to define a table using IDENTITY to populate primary key values during INSERT statements. Sometimes, there is a need to know the IDENTITY value immediately after an INSERT statement is completed — perhaps, to do INSERTs into child tables. Additionally, when tables have default values set by functions such as GETDATE(), there are times when these values need to be known after the INSERT. Similarly, an UPDATE statement can explicitly set a column’s new value to a value known only at execution time (e.g., setting the current date and time to GETDATE() or calculating the value of a computed column).

The article continues at http://www.dbazine.com/sql/sql-articles/cook18/

Database News Archives

Latest Forum Threads
Database News Forum
Topic By Replies Updated
Efficient SQL Server Indexing by Design lcole 0 April 30th, 12:38 PM
Mine Oracle Database, SQL Server and Other Databases with Monarch Data Pump Pro V10.5 lcole 0 April 30th, 12:37 PM
Oracle Database and Oracle Fusion Middleware for Private Social Network Application lcole 0 April 30th, 12:31 PM
Oracle Database Maintains a Stronghold in the DBMS Market lcole 0 April 30th, 12:30 PM