Click here to Skip to main content
15,921,113 members
Home / Discussions / Database
   

Database

 
AnswerRe: Display SQL query results in Windows Form Pin
Paddy Boyd22-Oct-07 5:01
Paddy Boyd22-Oct-07 5:01 
QuestionConvert comma separated text file (.csv) file into access .mdb file Pin
shyamts22-Oct-07 1:41
shyamts22-Oct-07 1:41 
AnswerRe: Convert comma separated text file (.csv) file into access .mdb file Pin
_Damian S_22-Oct-07 17:21
professional_Damian S_22-Oct-07 17:21 
Question[Solved]Insert statement against a FoxPro database isn't commited using ODBCConnection in C# Pin
Larantz21-Oct-07 22:49
Larantz21-Oct-07 22:49 
QuestionRead binary data from SQL Server Pin
Eusebiu Marcu21-Oct-07 22:11
Eusebiu Marcu21-Oct-07 22:11 
AnswerRe: Read binary data from SQL Server Pin
Eusebiu Marcu21-Oct-07 23:44
Eusebiu Marcu21-Oct-07 23:44 
QuestionSqlQueries Pin
SreejithAchutan21-Oct-07 22:06
SreejithAchutan21-Oct-07 22:06 
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.

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.