Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Maintaining the Value of My Primary Key Question


Maintaining the Value of My Primary Key Question

Author
Message
adams.squared
adams.squared
SSC-Enthusiastic
SSC-Enthusiastic (153 reputation)SSC-Enthusiastic (153 reputation)SSC-Enthusiastic (153 reputation)SSC-Enthusiastic (153 reputation)SSC-Enthusiastic (153 reputation)SSC-Enthusiastic (153 reputation)SSC-Enthusiastic (153 reputation)SSC-Enthusiastic (153 reputation)

Group: General Forum Members
Points: 153 Visits: 441
Scott's suggestion looks good.

What I was looking for, and I am probably not drawing a decent picture, is a way to get a value out of multiple columns so that I will have a distinct value for each field and if I have to reload the data, the values will not change.

What I started playing with is concatenating the four columns and converting them to varbinary and then converting that to varchar(36) with style 2.
I'm at home now so I don't have the script I was working with. I'll update the post tomorrow with what I wrote.
Anways, That gives me a value that is based off of the four columns. I was able to do it on the 1.8 million record table I was working with and then assigned that column as the PK. I did not have any PK violations, so I am getting a unique value. I still have some more playing around with it to see if this method is of any value.
John Hanrahan
John Hanrahan
Say Hey Kid
Say Hey Kid (672 reputation)Say Hey Kid (672 reputation)Say Hey Kid (672 reputation)Say Hey Kid (672 reputation)Say Hey Kid (672 reputation)Say Hey Kid (672 reputation)Say Hey Kid (672 reputation)Say Hey Kid (672 reputation)

Group: General Forum Members
Points: 672 Visits: 1449
I think Scott's suggestion is the best. It's similar in concept to what we do in our accounting software. Another option would be some sort of hashing routine but with up to 80 chars seems like it would be problematic at best.
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search