# Error while writing data to Sql Server

**URL:** <https://community.influxdata.com/t/error-while-writing-data-to-sql-server/29303>\
**Category:** Systems\
**Created:** [March 30, 2023, 12:08pm UTC](https://community.influxdata.com/t/error-while-writing-data-to-sql-server/29303 "2023-03-30T12:08:34Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![AVVS\_Sudheer](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/avvs_sudheer/32/13075_2.png) [@AVVS\_Sudheer](https://community.influxdata.com/u/AVVS_Sudheer)\
**Post date:** [March 30, 2023, 12:08pm UTC](https://community.influxdata.com/t/error-while-writing-data-to-sql-server/29303/1 "2023-03-30T12:08:34Z")

</div>

Hi,

When I try to write the data into Sql server from influx (Version 2.1.1) by using the below query

import “sql”  
data  
|\> sql.to(  
driverName: “sqlserver”,  
dataSourceName: “sqlserver://user:password@localhost:1433?database=examplebdb”,  
table: “Example.Table”,  
)

I am getting the following error.

error @2:1-2:5: undefined identifier data  
Can anyone help me how to fix this error

Regards  
Sudheer
