Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase ««12

Maintaining the Value of My Primary Key Question Expand / Collapse
Author
Message
Posted Monday, November 25, 2013 3:21 PM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Tuesday, August 5, 2014 1:52 PM
Points: 143, Visits: 412
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.
Post #1517485
Posted Monday, November 25, 2013 4:06 PM
SSC-Addicted

SSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-Addicted

Group: General Forum Members
Last Login: Thursday, August 28, 2014 10:15 PM
Points: 404, Visits: 1,002
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.
Post #1517490
« Prev Topic | Next Topic »

Add to briefcase ««12

Permissions Expand / Collapse