Click here to Skip to main content
15,896,154 members
Home / Discussions / Database
   

Database

 
AnswerRe: SqlQueries Pin
Colin Angus Mackay21-Oct-07 23:04
Colin Angus Mackay21-Oct-07 23:04 
AnswerRe: SqlQueries Pin
John-ph22-Oct-07 0:48
John-ph22-Oct-07 0:48 
AnswerRe: SqlQueries Pin
Abhijit Jana22-Oct-07 6:38
professionalAbhijit Jana22-Oct-07 6:38 
AnswerRe: SqlQueries Pin
PavanPareta25-Oct-07 3:56
PavanPareta25-Oct-07 3:56 
QuestionHelp!! error message "Data provider or other service returned an E_FAIL status" Pin
anthoy21-Oct-07 21:56
anthoy21-Oct-07 21:56 
AnswerRe: Help!! error message "Data provider or other service returned an E_FAIL status" Pin
Chetan Patel21-Oct-07 23:22
Chetan Patel21-Oct-07 23:22 
GeneralRe: Help!! error message "Data provider or other service returned an E_FAIL status" Pin
anthoy21-Oct-07 23:33
anthoy21-Oct-07 23:33 
QuestionTransaction , rollback ..??? Pin
devboycpp21-Oct-07 21:56
devboycpp21-Oct-07 21:56 
AnswerRe: Transaction , rollback ..??? Pin
squattyarun22-Oct-07 3:04
squattyarun22-Oct-07 3:04 
GeneralRe: Transaction , rollback ..??? Pin
devboycpp22-Oct-07 5:04
devboycpp22-Oct-07 5:04 
AnswerRe: Transaction , rollback ..??? Pin
Elina Blank22-Oct-07 8:07
sitebuilderElina Blank22-Oct-07 8:07 
QuestionSearch Engine Pin
Sandep H S21-Oct-07 21:22
Sandep H S21-Oct-07 21:22 
AnswerRe: Search Engine Pin
Abhijit Jana22-Oct-07 6:41
professionalAbhijit Jana22-Oct-07 6:41 
Questionselect last insert ID Pin
briogene21-Oct-07 21:20
briogene21-Oct-07 21:20 
AnswerRe: select last insert ID Pin
Aavesh Agarwal21-Oct-07 21:26
Aavesh Agarwal21-Oct-07 21:26 
GeneralRe: select last insert ID Pin
briogene21-Oct-07 22:32
briogene21-Oct-07 22:32 
GeneralRe: select last insert ID Pin
Aavesh Agarwal22-Oct-07 0:45
Aavesh Agarwal22-Oct-07 0:45 
GeneralRe: select last insert ID Pin
Pete O'Hanlon22-Oct-07 1:44
mvePete O'Hanlon22-Oct-07 1:44 
You really shouldn't do either of these, as they are both pretty bad practice. If you do a select on @@identity, you get the last inserted identity column regardless of scope. So, suppose you insert a record into your table and there is a trigger behind there that inserts into another table with an identity column on it, @@identity returns the id of the trigger insert and not the main table.

SELECT max(id) only works if there aren't multiple people posting into your tables at the same time.

The simple solution is to use:
SELECT @ID = SCOPE_IDENTITY()
This returns the identity of the inserted item on the main table, even if you have lots and lots of trigger inserts going on.

Deja View - the feeling that you've seen this post before.

AnswerRe: select last insert ID [modified] Pin
Chetan Patel21-Oct-07 23:25
Chetan Patel21-Oct-07 23:25 
QuestionHow to access network file using SQL Server 2000 Pin
Kumaran21cen21-Oct-07 21:04
Kumaran21cen21-Oct-07 21:04 
AnswerRe: How to access network file using SQL Server 2000 Pin
Ghazi H. Wadi3-Nov-07 23:19
Ghazi H. Wadi3-Nov-07 23:19 
QuestionSQL to return only first few records? Pin
jensenx21-Oct-07 17:50
jensenx21-Oct-07 17:50 
AnswerRe: SQL to return only first few records? Pin
N a v a n e e t h21-Oct-07 18:38
N a v a n e e t h21-Oct-07 18:38 
GeneralRe: SQL to return only first few records? Pin
jensenx21-Oct-07 21:10
jensenx21-Oct-07 21:10 
GeneralRe: SQL to return only first few records? [modified] Pin
GuyThiebaut22-Oct-07 1:28
professionalGuyThiebaut22-Oct-07 1:28 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.