On Saturday, March 24, 2012 7:17:20 PM UTC-7, Adam Perkins wrote:
>
> Thank you so much!
>
> Along with that the program I'm working on needs to do a lot of data
> transformations.. IE. Change field1 into field1+field2 or map a value
> from A to Apple. Also much more complex operations on many different
> fields. I might normally accomplish this using the case statement in
> SQL or using mapping tables to find values. I worry that the size and
> complexity of the Sequel statement would become extremely long and
> difficult to control.
>
> Does anyone know of examples of code where this has been done using
> Sequel or have any recommendations for doing field by field mappings?
>
>
Most of your SQL could be translated to use the Sequel DSL using virtual
rows, but I don't see the point of doing so. For example, the first part
could be:
select do [
{'USA'=>LTRIM(RTRIM(:National_ID))}.case('**Foreign ID**',
:ps_pers_nid__country),
REPLICATE('0', 6.sql_expr - LEN(convert('varchar'.lit, :J1__Emplid))) +
convert('varchar'.lit, :J1__Emplid))),
]}
That's probably less readable than the corresponding SQL, though.
If you have working a working SQL query that you want to use as the dataset
to select from:
DB[:to_table].insert([:to_column1, ...], DB['sql string'])
Jeremy
--
You received this message because you are subscribed to the Google Groups
"sequel-talk" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/sequel-talk/-/XgQpgZebYSgJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sequel-talk?hl=en.