Sending data to SQL server

i am new with Flux language and InfluxDB in general.
What I’m trying to do is periodically transfer data from InfluxDB to SQLServer.
I created a new Task with the following code:

import "sql"

option task = {name: "TaskTest", every: 24h}

from(bucket: "BucketTest")
	|> range(start: 0, stop: now())
	|> limit(n: 100)
	|> "sqlserver", dataSourceName: "server=myServer;user id=myuser;password=mypsw;database=myDB;", table: "dbo.myTable")

This task works almost as i want: periodically it send the oldest 100 records to my SQL Server. The main problem is that I don’t know how to insert a column filter: In SQLServer I need only _time, _value and other custom columns, but _start, _end, _field, _measurements are useless for my scope. Is there a way to exclude these columns from function?

Hello, @Andrea1,
I recommend using the drop() or keep() Flux functions before using the function.

1 Like

Ok, keep function solved my problem. Thank you :sweat_smile:

1 Like

@Andrea1 of course! Thank you for marking the solution