September 16, 2008 at 9:11 am
I'm modifying a table that already has an identity column and a uniqueidentifier column. I would like to be able to generate a number for each record (that clients can use to refer to the record), and I don't want to give them either of the two previously mentioned values. Is there anything I can do? You can't have more than one identity column in table, right? If not, is there no way for me to have this number automatically generated by Sql Server? I know that I could create this in the application and save it to the db, but I was hoping to avoid that if possible. Thanks.
September 16, 2008 at 9:14 am
You could create a computed column and do something like identity + 1. Why can't they see the identity?
September 16, 2008 at 9:24 am
There isn't really a good reason to not show the client the identity, other than personal preference. A computed column should do well, though. Thanks.
September 19, 2008 at 2:04 pm
How is the data entered into the database?
September 19, 2008 at 5:09 pm
Heh... just reverse the IDENTITY number...
--Jeff Moden
Change is inevitable... Change for the better is not.
September 20, 2008 at 12:51 am
If you dont want to show Identity column in table, According to me you have two options:
a) As mentioned in other's reply use computed column
b) Create a table for each identity column, first insert value in that, then refer that value and use for your main table.
Like in Oracle you dont have auto-number, but you have sequence. Sequence generate value for you, which can be used for your custom table.
Hope it will help you
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy