Hello All,
I am working on IIS 8.1 and source & target database is MS SQL server.
I have one flag in target table with data type char(1). I want to set value NULL when it is not Y or N. I am achieving using -
If ( monitoring_flag != 'Y' and monitoring_flag != 'N')
Then SetNull()
Else monitoring_flag
When I check in database I can see empty cell for this flag and not NULL.
What should be done to achive the same?
Thanks & Regards.
setNull() output in Char(1) data type
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 47
- Joined: Tue Feb 23, 2010 12:16 am
- Location: CHENNAI
Re: setNull() output in Char(1) data type
Hi,
you can obtain this using this
If ( monitoring_flag <> 'Y' or monitoring_flag <> 'N')
Then SetNull()
else monitoring_flag
you can obtain this using this
If ( monitoring_flag <> 'Y' or monitoring_flag <> 'N')
Then SetNull()
else monitoring_flag
-
- Premium Member
- Posts: 892
- Joined: Thu Oct 16, 2003 5:18 am
Hi All,
Something which is unclear to me.. bit strange ..
If (len(trim(monitoring_flag)) = 0 or Seq(monitoring_flag) = 0)
Then SetNull()
else monitoring_flag
this works fine .. gives NULL in output
but when I check
If IsNull(monitoring_flag)
Then SetNull()
else monitoring_flag
it gives spce in that flag .. i.e. ASCII 32.. I donno why .. any suggestions ?
Something which is unclear to me.. bit strange ..
If (len(trim(monitoring_flag)) = 0 or Seq(monitoring_flag) = 0)
Then SetNull()
else monitoring_flag
this works fine .. gives NULL in output
but when I check
If IsNull(monitoring_flag)
Then SetNull()
else monitoring_flag
it gives spce in that flag .. i.e. ASCII 32.. I donno why .. any suggestions ?
-
- Participant
- Posts: 11
- Joined: Fri Jan 30, 2009 3:21 am
Try this one
If ( trim(nulltoempty(monitoring_flag)) ='Y' or trim(nulltoempty(monitoring_flag)) = 'N')
Then monitoring_flag else setnull()
Then monitoring_flag else setnull()