Solved

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

Posted on 2014-03-10
3
1,537 Views
Last Modified: 2014-03-10
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
Comment
Question by:searchsanjaysharma
3 Comments
 
LVL 142

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 250 total points
Comment Utility
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
 
LVL 25

Assisted Solution

by:SStory
SStory earned 250 total points
Comment Utility
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
 

Author Closing Comment

by:searchsanjaysharma
Comment Utility
tx, so that means i can use the option of cast. this also defined the blank() function doesnt work
0

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Join & Write a Comment

Introduction This article will provide a solution for an error that might occur installing a new SQL 2005 64-bit cluster. This article will assume that you are fully prepared to complete the installation and describes the error as it occurred durin…
Introduction: When running hybrid database environments, you often need to query some data from a remote db of any type, while being connected to your MS SQL Server database. Problems start when you try to combine that with some "user input" pass…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now