# Insert into SQL Server – use NULL vs. empty string?

**URL:** <https://forum.inductiveautomation.com/t/insert-into-sql-server-use-null-vs-empty-string/11917>\
**Category:** Ignition\
**Created:** [July 11, 2016, 11:00pm UTC](https://forum.inductiveautomation.com/t/insert-into-sql-server-use-null-vs-empty-string/11917 "2016-07-11T23:00:08Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![bfaivre](https://avatars.discourse-cdn.com/v4/letter/b/f19dbf/32.png) [@bfaivre](https://forum.inductiveautomation.com/u/bfaivre)\
**Post date:** [July 11, 2016, 11:00pm UTC](https://forum.inductiveautomation.com/t/insert-into-sql-server-use-null-vs-empty-string/11917/1 "2016-07-11T23:00:08Z")

</div>

Hello,

My table in SQL Server is setup not to allow NULL values. When using runPrepUpdate, if the text field I’m using is blank, runPrepUpdate inserts an empty string instead of using NULL. Is there a way to use NULL by default? I’d prefer to not have to check every field every time for blank strings.

Thanks!

Brian

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [July 12, 2016, 8:34am UTC](https://forum.inductiveautomation.com/t/insert-into-sql-server-use-null-vs-empty-string/11917/2 "2016-07-12T08:34:20Z")

</div>

An empty text field is a zero-length string, not a null. If you pass an empty string to system.db._Prep_, you get an empty string in your SQL. If you want Null, you need to pass jython’s None for that parameter. You’ll have to script for yourself when and how to do this.
