Click here to Skip to main content
15,899,475 members
Home / Discussions / Database
   

Database

 
GeneralRe: sql server comparing two huge tables Pin
Blue_Boy4-Aug-09 4:46
Blue_Boy4-Aug-09 4:46 
GeneralRe: sql server comparing two huge tables Pin
ps_prakash024-Aug-09 21:52
ps_prakash024-Aug-09 21:52 
QuestionHow to check for a never populated table on sql server 2005 Pin
Roberto Mazzone3-Aug-09 6:34
Roberto Mazzone3-Aug-09 6:34 
AnswerRe: How to check for a never populated table on sql server 2005 Pin
David Mujica3-Aug-09 8:04
David Mujica3-Aug-09 8:04 
GeneralRe: How to check for a never populated table on sql server 2005 Pin
Roberto Mazzone3-Aug-09 20:00
Roberto Mazzone3-Aug-09 20:00 
AnswerRe: How to check for a never populated table on sql server 2005 Pin
leckey3-Aug-09 8:54
leckey3-Aug-09 8:54 
GeneralRe: How to check for a never populated table on sql server 2005 Pin
Roberto Mazzone3-Aug-09 21:25
Roberto Mazzone3-Aug-09 21:25 
AnswerRe: How to check for a never populated table on sql server 2005 Pin
David Skelly3-Aug-09 22:43
David Skelly3-Aug-09 22:43 
IDENT_CURRENT is not a reliable way of predicting the next identity. It can give you a probable value, but you can never be sure of what the next value will be in practice because of concurrent inserts, rollbacks, etc. It will only give you a "best guess" at what the next identity value is likely to be. The bottom line is that you can't predict the next identity, not reliably.

If you need to work around this bug, you could use an insert trigger to update a counter value in another table. That way you can tell how many inserts there have been on your main table. If the counter is 0, your next identity is 1. Otherwise, go and look at IDENT_CURRENT. It's a bit clunky but it's better than doing an insert then a delete.

If you really need 100% predictability of the next identity value, you will probably be better off not using IDENTITY but rolling your own solution (it's not hard - people used to do it all the time before IDENTITY came on the scene). That way you can be completely in control of what value gets allocated to each new insert.
GeneralBuild your own identity value Pin
David Mujica4-Aug-09 2:58
David Mujica4-Aug-09 2:58 
GeneralRe: Build your own identity value [modified] Pin
Roberto Mazzone4-Aug-09 22:48
Roberto Mazzone4-Aug-09 22:48 
GeneralRe: Build your own identity value Pin
David Mujica5-Aug-09 2:59
David Mujica5-Aug-09 2:59 
GeneralRe: Build your own identity value Pin
Roberto Mazzone5-Aug-09 22:11
Roberto Mazzone5-Aug-09 22:11 
AnswerRe: How to check for a never populated table on sql server 2005 Pin
Mike Ellison4-Aug-09 3:13
Mike Ellison4-Aug-09 3:13 
GeneralRe: How to check for a never populated table on sql server 2005 [modified] Pin
Roberto Mazzone4-Aug-09 22:51
Roberto Mazzone4-Aug-09 22:51 
GeneralRe: How to check for a never populated table on sql server 2005 Pin
Mike Ellison5-Aug-09 6:28
Mike Ellison5-Aug-09 6:28 
GeneralRe: How to check for a never populated table on sql server 2005 Pin
Roberto Mazzone5-Aug-09 22:08
Roberto Mazzone5-Aug-09 22:08 
QuestionNDoc to SQL scripts? Pin
devvvy3-Aug-09 5:43
devvvy3-Aug-09 5:43 
AnswerRe: NDoc to SQL scripts? Pin
leckey3-Aug-09 8:51
leckey3-Aug-09 8:51 
GeneralRe: NDoc to SQL scripts? Pin
devvvy3-Aug-09 14:51
devvvy3-Aug-09 14:51 
QuestionStored Procedure Pl/SQL Pin
Civic063-Aug-09 4:35
Civic063-Aug-09 4:35 
AnswerRe: Stored Procedure Pl/SQL Pin
Vimalsoft(Pty) Ltd3-Aug-09 4:47
professionalVimalsoft(Pty) Ltd3-Aug-09 4:47 
GeneralRe: Stored Procedure Pl/SQL Pin
Civic063-Aug-09 4:59
Civic063-Aug-09 4:59 
GeneralRe: Stored Procedure Pl/SQL Pin
Vimalsoft(Pty) Ltd3-Aug-09 5:06
professionalVimalsoft(Pty) Ltd3-Aug-09 5:06 
GeneralRe: Stored Procedure Pl/SQL Pin
Civic063-Aug-09 5:33
Civic063-Aug-09 5:33 
AnswerRe: Stored Procedure Pl/SQL Pin
David Skelly3-Aug-09 6:09
David Skelly3-Aug-09 6:09 

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.