Solved

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

Posted on 2014-03-10
3
1,677 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 250 total points
ID: 39917490
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
ID: 39917517
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
ID: 39917547
tx, so that means i can use the option of cast. this also defined the blank() function doesnt work
0

Featured Post

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will describe one method to parse a delimited string into a table of data.   Why would I do that you ask?  Let's say that you need to pass multiple parameters into a stored procedure to search for.  For our sake, we'll say that we wa…
by Mark Wills Attending one of Rob Farley's seminars the other day, I heard the phrase "The Accidental DBA" and fell in love with it. It got me thinking about the plight of the newcomer to SQL Server...  So if you are the accidental DBA, or, simp…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…

696 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