# Changing values and type of JuliaDB column

**URL:** <https://discourse.julialang.org/t/changing-values-and-type-of-juliadb-column/43921>\
**Category:** General Usage\
**Tags:** juliadb\
**Created:** [July 29, 2020, 8:46pm UTC](https://discourse.julialang.org/t/changing-values-and-type-of-juliadb-column/43921 "2020-07-29T20:46:06Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![john\_b](https://avatars.discourse-cdn.com/v4/letter/j/5fc32e/32.png) [@john\_b](https://discourse.julialang.org/u/john_b)\
**Post date:** [July 29, 2020, 8:46pm UTC](https://discourse.julialang.org/t/changing-values-and-type-of-juliadb-column/43921/1 "2020-07-29T20:46:06Z")

</div>

As a newcomer to Julia and JuliaDB, I have a simple question. Given a JuliaDB table, how would I map a function to a column that changes the column values and type? For example:

```julia
import JuliaDB
import Dates

function col_to_dt(val)
        dt = Dates.Date(replace(val, "|" => "-"))
end 

t = JuliaDB.table(["2015|03|01", "2016|02|05"]; names = [:dt])
JuliaDB.select(t, :dt => x -> col_to_dt(x))

```

The above code does not change t.dt. It remains a string. Also, in this example, how would you use `JuliaDBMeta.@apply` to conduct a series of steps to alter a column’s values and type?

Added Later:  
I see that the following creates a new table and saves it under the same name:  
`t = JuliaDB.transform(t, :dt => JuliaDB.select(t, :dt => col_to_dt))`

Would this be the recommended approach?

Still, how could this be arranged within a `JuliaDBMeta.@apply` call? The following does not work:

```julia
import JuliaDBMeta
import JuliaDB
import Dates

t = JuliaDB.table(["2015|03|01", "2016|02|05"], [2,4]; names = [:dt, :num])
t = JuliaDBMeta.@apply t begin
        JuliaDBMeta.@transform(dt = JuliaDBMeta.@select(t, :dt => col_to_dt))
      end

```

It gives the error:  
`ERROR: LoadError: LoadError: column 2015|03|01 not found.`
