Click here to Skip to main content
16,006,348 members
Home / Discussions / Database
   

Database

 
AnswerRe: unable to Access complete database features Pin
Pete O'Hanlon16-Sep-10 8:08
mvePete O'Hanlon16-Sep-10 8:08 
QuestionSET XACT_ABORT ON Pin
eraser95015-Sep-10 21:03
eraser95015-Sep-10 21:03 
AnswerRe: SET XACT_ABORT ON Pin
Mycroft Holmes15-Sep-10 23:03
professionalMycroft Holmes15-Sep-10 23:03 
AnswerRe: SET XACT_ABORT ON Pin
Pete O'Hanlon16-Sep-10 8:07
mvePete O'Hanlon16-Sep-10 8:07 
GeneralRe: SET XACT_ABORT ON Pin
eraser95019-Sep-10 21:23
eraser95019-Sep-10 21:23 
QuestionProblem in restoring SQL Server MDF File database Pin
kirankkk200915-Sep-10 20:06
kirankkk200915-Sep-10 20:06 
AnswerRe: Problem in restoring SQL Server MDF File database Pin
Mycroft Holmes15-Sep-10 22:59
professionalMycroft Holmes15-Sep-10 22:59 
QuestionIs this unique ID generation procedure correct ? Pin
virang_2115-Sep-10 19:11
virang_2115-Sep-10 19:11 
After 1000 this will reset counter for specific term to 1 again. Will this stored procedure be 100% reliable to give unique id every time. There are multiple users accessing the web application that may call this stored procedure.


ALTER PROCEDURE [dbo].[get_next_id](@Term int,@ID INT OUTPUT) AS
SET NOCOUNT ON
DECLARE @Current int;
SELECT @Current=[ID] FROM [IdGenerator] where Term = @Term;
IF @Current<1000
BEGIN
	update IdGenerator SET @ID = ID, ID = ID + 1 where Term=@Term
END
ELSE
BEGIN
	update IdGenerator SET @ID =1,ID = 2 where Term=@Term 
END




One option is to use identity column but that is out of question as to generate unique Id I have to add certain text to each number as that is the part of business requirement. Like add 1001 or 1002 or 1003 etc. in front of numbers. This stored procedure will give me the unique number.

Criticize it / Suggest any alternative .
AnswerRe: Is this unique ID generation procedure correct ? Pin
Mycroft Holmes15-Sep-10 19:55
professionalMycroft Holmes15-Sep-10 19:55 
AnswerRe: Is this unique ID generation procedure correct ? Pin
David Skelly15-Sep-10 22:52
David Skelly15-Sep-10 22:52 
QuestionT-SQL 2005 Inner join data from a view to the resultset of a stored procedure. Pin
Steven J Jowett13-Sep-10 5:54
Steven J Jowett13-Sep-10 5:54 
AnswerRe: T-SQL 2005 Inner join data from a view to the resultset of a stored procedure. Pin
Stryder_113-Sep-10 8:00
Stryder_113-Sep-10 8:00 
AnswerRe: T-SQL 2005 Inner join data from a view to the resultset of a stored procedure. Pin
David Mujica13-Sep-10 8:06
David Mujica13-Sep-10 8:06 
GeneralRe: T-SQL 2005 Inner join data from a view to the resultset of a stored procedure. Pin
Steven J Jowett13-Sep-10 12:08
Steven J Jowett13-Sep-10 12:08 
AnswerRe: T-SQL 2005 Inner join data from a view to the resultset of a stored procedure. Pin
Mycroft Holmes13-Sep-10 12:34
professionalMycroft Holmes13-Sep-10 12:34 
AnswerRe: T-SQL 2005 Inner join data from a view to the resultset of a stored procedure. Pin
PIEBALDconsult13-Sep-10 17:01
mvePIEBALDconsult13-Sep-10 17:01 
QuestionDB architecture Pin
adilsardar13-Sep-10 2:46
adilsardar13-Sep-10 2:46 
AnswerRe: DB architecture Pin
R. Giskard Reventlov13-Sep-10 3:38
R. Giskard Reventlov13-Sep-10 3:38 
AnswerCentralized DB Pin
David Mujica13-Sep-10 4:13
David Mujica13-Sep-10 4:13 
GeneralRe: Centralized DB Pin
adilsardar14-Sep-10 0:03
adilsardar14-Sep-10 0:03 
AnswerRe: DB architecture Pin
Luc Pattyn13-Sep-10 4:32
sitebuilderLuc Pattyn13-Sep-10 4:32 
AnswerRe: DB architecture Pin
Eddy Vluggen13-Sep-10 10:11
professionalEddy Vluggen13-Sep-10 10:11 
GeneralRe: DB architecture Pin
adilsardar14-Sep-10 0:06
adilsardar14-Sep-10 0:06 
GeneralRe: DB architecture Pin
Eddy Vluggen14-Sep-10 7:36
professionalEddy Vluggen14-Sep-10 7:36 
AnswerRe: DB architecture Pin
PIEBALDconsult13-Sep-10 15:13
mvePIEBALDconsult13-Sep-10 15:13 

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.