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.
| Author |
Topic |
|
WJHamel
Aged Yak Warrior
651 Posts |
Posted - 2012-10-22 : 12:20:43
|
| I'm working on a data conversion, SQL to SQL. Using an Insert Into statement. One of the lines would normally use a Case Expression because the source has a number of options which will translate into a number of options in the selected table to which the data is being inserted. The problem with this one column is that the source (the column being selected from) as 137 different values, which would mean that my CE would have 137 When/Then statements.Seems excessive. Is there another process i can use within the insert statement which would get the job done more effectively?thanks |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-10-22 : 12:25:32
|
| yep. Create a mapping table with source value against mapped value, add a join to this table on sourcevalue column and replace case ...when expression with just the mappedcolumn in SELECT list------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
WJHamel
Aged Yak Warrior
651 Posts |
Posted - 2012-10-22 : 12:28:34
|
| Ah yes. that's what i used with the last conversion i did. the mapping table. Forgot about that. Thanks |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-10-22 : 12:33:39
|
| welcome------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
lile
Starting Member
1 Post |
Posted - 2012-10-22 : 12:41:05
|
| Hello! I am also new in this forum.Thanks for nice shearing....... unspammed |
 |
|
|
|
|
|