View Single Post
  #1 (permalink)  
Old 12-10-2007, 08:00 PM
varun_33 varun_33 is offline
Member
 
Join Date: Dec 2007
Posts: 1
varun_33 is on a distinguished road
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.
Reply With Quote
Sponsored Links