working with sql inserting type double, string, int - How to detect unasigned value.

Posted on 2011-04-24
Last Modified: 2012-06-27
Hi there

i am try to work with data type
double, int, enum, string in and create a function to insert/select from mysql

i have issue when to create this function i have no way to know if the value should be insert to sql or not because i dont know if it unassigned or or assigned.

the idea is that if i know the value is unassigned then i will not generate TSQL to insert into SQL and so database will not insert incorrect value such as 0 or "".

On the other hand, when pull the data from SQL i need to know that these value is not assigned so i can display on application as not available... instead of showing 0 or something that has incorrect meaning...

Question by:JSW21

    Author Comment

    To explain a bit more:
    When I assigned no data as 0 for an enum type i can filter the zero out during TSQL insertion but it will be wrong b/c data can be 0....

    My older application i assigned value like -987654321 to id the non assigned value but it get bulky.
    and it would slow thing down.
    LVL 83

    Expert Comment

    Some more explanation please(outside of assigned/unassigned).

    Author Comment


    Say I want to update field columns in SQL with .. x y z .... My function does not know which  x y z is a new data... x y z are members in a class obj.

    because If know which is not updated then I would exclude it from TSQL
    The question is how do I identify if any member in this class has some value assigned to it.

    for instance if class is a stock data ... some stock has volume field , and another doest have volume field ... sort of speak. but Volume can be 0.

    LVL 83

    Accepted Solution

    Show us the code in the function. May be you want to use NullAble(of T) as types of members in the class and then use .HasValue to find out if the member has been assigned a value.

    Author Closing Comment


    Featured Post

    Highfive Gives IT Their Time Back

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    Suggested Solutions

    Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
    How to leverage one TLS certificate to encrypt Microsoft SQL traffic and Remote Desktop Services, versus creating multiple tickets for the same server.
    This video is in connection to the article "The case of a missing mobile phone (". It will help one to understand clearly the steps to track a lost android phone.
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

    755 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

    20 Experts available now in Live!

    Get 1:1 Help Now