Hi,
In SQL server 2008, I have two tables emp1 and emp2, both with columns Name, Lastname, Language. I have to import from table1 to table 2, only that in Table1 the value of Language is 'E', 'S', 'F' and when I import it to Table2 it has to be converted to 'English', 'Spanish, 'French'.
What is the SQL statement for that?
Thanks
Loading
Jignesh TrivediPosted Feb 29, 2012, 3:17 AM
Just want to do some modification on above query.
INSERT INTO table2(Name, Lastname, Language)
SELECT DISTINCT Name, Lastname, Case Language when 'E' then 'English' when 'S' then 'Spanish' when 'F' then 'French' end as Language
FROM table1 WHERE Language IN ( 'E', 'S', 'F')
hope this help.
SenthilkumarPosted Feb 29, 2012, 1:01 AM
INSERT INTO table2(Name, Lastname, Language)
SELECT DISTINCT Name, Lastname, Language FROM table1 WHERE Language IN ( 'E', 'S', 'F')