How to update a unique id
-
Im writing a small news posting system for my site and I've run into a small snag. I want each post to have a unique id but im not sure how to keep it unique. Is there an easy to find out what the last postid entered into my table was? That way I can just add 1 to the number when I go to store a new post. Also, is there another way to do this? Am I missing something? -- modified at 15:34 Friday 9th June, 2006
-
Im writing a small news posting system for my site and I've run into a small snag. I want each post to have a unique id but im not sure how to keep it unique. Is there an easy to find out what the last postid entered into my table was? That way I can just add 1 to the number when I go to store a new post. Also, is there another way to do this? Am I missing something? -- modified at 15:34 Friday 9th June, 2006
Why not make the ID column an IDENTITY column, that was the database will automatically create an id for you.
"On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question." --Charles Babbage (1791-1871) My: Website | Blog
-
Why not make the ID column an IDENTITY column, that was the database will automatically create an id for you.
"On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question." --Charles Babbage (1791-1871) My: Website | Blog