# Unable to use (save) "modified" column value as sql\_last\_value

**URL:** <https://discuss.elastic.co/t/unable-to-use-save-modified-column-value-as-sql-last-value/179427>\
**Category:** Logstash\
**Created:** [May 2, 2019, 6:57pm UTC](https://discuss.elastic.co/t/unable-to-use-save-modified-column-value-as-sql-last-value/179427 "2019-05-02T18:57:37Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ParitoshBh](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/paritoshbh/32/22487_2.png) [@ParitoshBh](https://discuss.elastic.co/u/ParitoshBh)\
**Post date:** [May 2, 2019, 6:57pm UTC](https://discuss.elastic.co/t/unable-to-use-save-modified-column-value-as-sql-last-value/179427/1 "2019-05-02T18:57:38Z")

</div>

Among other things, following is an input which worked without any issue in version 5.6.5,

```auto
  jdbc {
    jdbc_driver_library => "/etc/logstash/mssql-jdbc-6.2.2.jre8.jar"
    jdbc_driver_class => "com.microsoft.sqlserver.jdbc.SQLServerDriver"
    jdbc_connection_string => "jdbc:sqlserver://DB_IP:PORT"
    jdbc_user => "user_name"
    jdbc_password => "password"

    schedule => "*/5 * * * *"

    statement => "SELECT * FROM db.table WHERE modified > :sql_last_value"

    use_column_value => true
    tracking_column => "modified"

    jdbc_fetch_size => 1000
    jdbc_page_size => 1000
    jdbc_paging_enabled => true
    last_run_metadata_path => "/var/lib/logstash/.logstash_jdbc_last_run"
  }

```

The column `modified` has type `datetime` (SQL Server). This worked as expect in Logstash version 5.6.5 and the `.logstash_jdbc_last_run` file was updated with the value from modified column just fine.

After upgrading to 6.7.0, this setup no longer works. The `.logstash_jdbc_last_run` file always ends up getting `--- 0` value. Setting `tracking_column_type => "timestamp"` yields following error,

```auto
[2019-05-02T14:19:00,157][WARN][logstash.inputs.jdbc] Exception when executing
JDBC query {:exception=>#<Sequel::DatabaseError: Java::ComMicrosoftSqlserverJdbc::SQLServerException: 
Implicit conversion from data type varchar to timestamp is not allowed. 
Use the CONVERT function to run this query.>}

```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [May 30, 2019, 6:57pm UTC](https://discuss.elastic.co/t/unable-to-use-save-modified-column-value-as-sql-last-value/179427/2 "2019-05-30T18:57:46Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
