Results 1 to 2 of 2
- 12-10-2007, 06:00 PM #1
Member
- Join Date
- Dec 2007
- Posts
- 1
- Rep Power
- 0
Database Column vs String Concatenation
Hello freinds.....
Please tell me which out of the 2 solutions is a better solution and why?
PROBLEM
-----------
I need to store 2 values of String type in the database
Value1 - GUID
Value2 - Reference Number
Examples
Record1 : asdasdsadsa12345
Record2 : dggtghknklkll12345
where 12345 is the reference number and the remaining part of the value is the GUID.
Solution 1
-----------
I can concatenate both the strings and store that in one column in the database and make it the primary key.
Solution 2
------------
I can create 2 columns in the database and store both the values differently
Make GUID the primary key column and use the other column to store the Reference Number.
I feel solution 2 is better as solution 1 will force to concatenate string while creating a record and while retrieving a record substring will be required , which does not represent a good design.
Also, solution 2 will enable us to query the second column to retrive records efficiently.
- 12-11-2007, 04:14 PM #2
Member
- Join Date
- Dec 2007
- Location
- New Delhi, India
- Posts
- 1
- Rep Power
- 0
Solution 2 is better than solution 1. String operations are usually heavy for performance issues. Moreover if you want the combination as a primary key than you can make the primary key including both the columns. Moreover if you find at later stage that you need the combined string then also thr are queries which will return the results in appended form. Undoubtly go for solution 2.
Similar Threads
-
insert row and column and delete row and column
By daredavil82 in forum New To JavaReplies: 13Last Post: 09-22-2011, 06:10 PM -
Excel Column
By Gajesh Tripathi in forum New To JavaReplies: 2Last Post: 04-13-2008, 02:26 PM -
Concatenation file contents
By Java Tip in forum Java TipReplies: 1Last Post: 02-07-2008, 01:29 PM -
Inserting string with slash character into database
By Java Tip in forum Java TipReplies: 0Last Post: 02-07-2008, 08:57 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks