Hi,
I'm trying to insert some values into a SQL server 2005 db & I'm aware that it doesn't support arrays. However it would make my life a lot easier if it did. I'm inserting some translated words into the language table, but was hoping I could have a list of the translations & a list of the id's & import these using a stored procedure or insert statement.
I was hoping not to have a mass of these insert statements & just have a list of the translations (LOCname or folderid & German), which I could parse to a stored procedure.
I hope I've made myself clear in my explanation. If not I'll attempt to rephrase.
Thanks,
Craig
I'm trying to insert some values into a SQL server 2005 db & I'm aware that it doesn't support arrays. However it would make my life a lot easier if it did. I'm inserting some translated words into the language table, but was hoping I could have a list of the translations & a list of the id's & import these using a stored procedure or insert statement.
Code:
declare @locale as nvarchar(5)
declare @LOCname as nvarchar(25)
set @locale = 'de_DE'
set @ENGname = 'Performance'
SET @LOCname = 'Performance in german'
INSERT INTO translation (Id, Name, Locale, Category) SELECT itemid,@LOCName,@locale,'item' from items where itemname = @engname
UPDATE tl SET tl.name = @LOCName FROM items it INNER JOIN translation tl ON CAST(it.itemid AS NVARCHAR(5))= tl.id WHERE tl.locale = @locale AND it.itemname = @ENGName
set @ENGname = 'Users'
SET @LOCname = 'users in german'
INSERT INTO translation (Id, Name, Locale, Category) SELECT itemid,@LOCName,@locale,'item' from items where itemname = @engname
UPDATE tl SET tl.name = @LOCName FROM items it INNER JOIN translation tl ON CAST(it.itemid AS NVARCHAR(5))= tl.id WHERE tl.locale = @locale AND it.itemname = @ENGName
DECLARE @folderid AS NVARCHAR(25)
set @folderid = 'home' --for folders we use ID not the english name
SET @LOCname = 'home in german'
INSERT INTO translation (Id, Name, Locale, Category) VALUES (@folderid,@LOCname,@locale,'folder')
UPDATE translation SET name = @LOCname WHERE locale = @locale AND id = @folderid
I was hoping not to have a mass of these insert statements & just have a list of the translations (LOCname or folderid & German), which I could parse to a stored procedure.
I hope I've made myself clear in my explanation. If not I'll attempt to rephrase.
Thanks,
Craig