Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1821
  • Last Modified:

How to insert blank in field having int data type. Null also not allowed.

I am having table testdata(i int)

insert into testdata values(1) ok
insert into testdata values(dbnull.value) ok

i want to insert blank only, neither null not '' converting datatype to varchar
and then converting to int
0
searchsanjaysharma
Asked:
searchsanjaysharma
2 Solutions
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
sorry, but for numerical data types (like int), you cannot have any "blank" data except NULL.
so, if you ask with the restriction of "not null", the answer is :
this cannot be done
0
 
SStoryCommented:
Guy is correct. The only other option would be a magic number. Example: If all data must be positive you could insert a -13 to mean nothing and your code would need to interpret it and ignore/display as desired.  However, I'd prefer NULL.
0
 
searchsanjaysharmaAuthor Commented:
tx, so that means i can use the option of cast. this also defined the blank() function doesnt work
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now