August 21, 2003 at 10:27 pm
Hi All-
We need to internationlize our application. So we store the data only in ids. When the application needs to display the data, it joins the id with a languageid and gets the appropriate language text. I can think of 2 ways to read the data from the database. One way is to join the Values table in the query and retrive the text. The other option is to write a function that takes the id and the languageid and returns the text. I am wondering which is the better way. Your time and thoughts are greatly appreciated.
eg:
tblCustomer
-----------
CustomerId
CustomerNameEId
CustomerCityEId
CustomerZip
tblValues
---------
ValueId
LanguageId
Text
select cust.customerid,
val1.text as customerName,
val2.text as CustomerCity,
cust.zip as customerzip
from tblCustomer cust, tblValue val1, tblValue val2
where cust.customerNameEId = Val1.ValueId
and cust.customercityEId = Val2.ValueId
and Val1.Language = 'USEN'
and Val2.Language = 'USEN'
Or
SELECT customerId, dbo.gnGetText(CustomerNameEId, 'USEN') as CustomerName,
(CustomerCityEId, 'USEN') as CustomerCity,
customerzip as customerzip
from tblCustomer
If the performance difference will not be considerable, I would like to use the second option as this will save a lot of time writing the code and even makes the code more readable.
August 25, 2003 at 8:00 am
This was removed by the editor as SPAM
August 26, 2003 at 8:23 am
Unfortunatly the function based aproach will be much slower because your query will have to call a function for each and every rows.
And the function itself makes a query to the db as well.
I would definitly shoot for the set based solution.
The best is to try it out!
Bye
Gabor
Bye
Gabor
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply