Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Sql query on oscommerce database?

Author  Topic 

Nathali
Starting Member

3 Posts

Posted - 2007-11-20 : 05:27:11
Hi,

I have an oscommerce database.
I uploaded my categories and products in english language.
I would like to write an SQL query that will copy all my categories (only the categories) from english to my other language.

Could someone help me please to do that??

Thanks a lot for your kind attention !

Best Regards & Great day,
Nathali

georgev
Posting Yak Master

122 Posts

Posted - 2007-11-20 : 06:34:13
Are you asking if SQL can translate the values into a different language?
I'm sorry, I don't follow the question...


George
<3Engaged!
Go to Top of Page

Nathali
Starting Member

3 Posts

Posted - 2007-11-20 : 07:10:45
Thank you very much for your reply !

I wanted to write SQL query that will copy only the Categories names from my English language and enter it to my other language (Hebrew).

I need to do that since the PHP code that I use to upload my products and categories doesn't know how to update the Hebrew language categories names without losing the categories ID.
because of that when I switch between the languages I do not get the right categories on both languages.

I hope you understand me..

Thanks a lot for your help !!!


Best Regards & Great day,
Nathali
Go to Top of Page

georgev
Posting Yak Master

122 Posts

Posted - 2007-11-20 : 08:53:39
If I'm following correctly then the answer is that SQL cannot translate languages...
However, it can copy data...
[CODE]
INSERT INTO myHebrewTable (code, description)
SELECT code
, description
FROM myEnglishTable
[/CODE]
If you are using an identity (auto generated, abitrary integer) as the categoryID then there are still ways round this, but they're a bit flakey...
I suggest that you treat one as your "master" table and the other as the "slave" - the slave will simply hold non-constrained integers for the ID.

Hope this makes sense


George
<3Engaged!
Go to Top of Page

Nathali
Starting Member

3 Posts

Posted - 2007-11-20 : 10:40:58
Hi georgev !

Thank you so much for your reply !

As you said, first, I can upload the products and their categories in the English language, and treat it as a "MASTER" then to use the SQL to copy it to my Hebrew language.

I noticed in the database that I have:
Categories_description field that includes Categories_id & Language_id & Categories_name.
For example:
Categories_id=32, Language_id=4, Categories_name=memory for apple
Categories_id=32, Language_id=1, Categories_name=memory for apple
and so on...

My English language_id=1 and Hebrew id=4

I also have a Categories field that include Categories_id & parent_id

and products_to_categories that includes product_id & categories_id

So after I will upload the products and the categories in English, what SQL sentence I should write to copy all the categories name to the Hebrew language ??

Thanks for your help again !


Best Regards & Great day,
Nathali
Go to Top of Page

georgev
Posting Yak Master

122 Posts

Posted - 2007-11-20 : 13:09:28
Err, not entirely sure of what your asking, but here's a stab at the answer anyway...
[CODE]
INSERT INTO categories(categories_id, language_id, categories_name)
SELECT categories_id
, 4
, categories_name
FROM categories
WHERE language_id = 1
[/CODE]
This, in effect, will duplicate all english values but give them the language_id of 4 (for Hebrew)...

That what you want?


George
<3Engaged!
Go to Top of Page
   

- Advertisement -