SQL Server - Error converting data type float to bigintWhat's the right way to represent phone numbers?Add a column with a default value to an existing table in SQL ServerHow to return only the Date from a SQL Server DateTime datatypeHow to check if a column exists in a SQL Server table?Check if table exists in SQL ServerHow to concatenate text from multiple rows into a single text string in SQL server?Select columns from result set of stored procedureLEFT JOIN vs. LEFT OUTER JOIN in SQL ServerHow do I UPDATE from a SELECT in SQL Server?Error converting data type varchar to bigintHow to Delete using INNER JOIN with SQL Server?

Can you keep a readied action even through incapacitation?

Is having a hidden directory under /etc safe?

Explain Ant-Man's "not it" scene from Avengers: Endgame

Could a guilty Boris Johnson be used to cancel Brexit?

Asking bank to reduce APR instead of increasing credit limit

Why were the Night's Watch required to be celibate?

What does the behaviour of water on the skin of an aircraft in flight tell us?

Accidentally cashed a check twice

How can I grammatically understand "Wir über uns"?

Strange math syntax in old basic listing

Is the capacitor drawn or wired wrongly?

Cryptography and patents

What is the most important characteristic of New Weird as a genre?

The most awesome army: 80 men left and 81 returned. Is it true?

Asking for something with different prices

If Sweden was to magically float away, at what altitude would it be visible from the southern hemisphere?

Estimate related to the Möbius function

Is there a rule that prohibits us from using 2 possessives in a row?

Opposite of "Squeaky wheel gets the grease"

Are there mythical creatures in the world of Game of Thrones?

How much current can Baofeng UV-5R provide on +V pin?

Humans meet a distant alien species. How do they standardize? - Units of Measure

Can you use a concentration spell while using Mantle of Majesty?

Is American Express widely accepted in France?



SQL Server - Error converting data type float to bigint


What's the right way to represent phone numbers?Add a column with a default value to an existing table in SQL ServerHow to return only the Date from a SQL Server DateTime datatypeHow to check if a column exists in a SQL Server table?Check if table exists in SQL ServerHow to concatenate text from multiple rows into a single text string in SQL server?Select columns from result set of stored procedureLEFT JOIN vs. LEFT OUTER JOIN in SQL ServerHow do I UPDATE from a SELECT in SQL Server?Error converting data type varchar to bigintHow to Delete using INNER JOIN with SQL Server?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















Can the datatype of a field be changed to bigint from float ??



Create a new column that's an integer:



ALTER TABLE tabl ADD newCol int;


Select the data from the old column into the new one:



UPDATE tabl SET newCol = CAST(TEL2 AS int) FROM tabl ;


P.S: I am using MS SQL Server



i try to us this in c# but it didn't get any result



 string sqlCommand = "SELECT * FROM tabl WHERE CONCAT([TEL1], [TEL2],[TEL3], [TEL4],[TEL5], [TEL6],[TEL7], [TEL8],[TEL9]) LIKE '%" + txtBoxSearch.Text + "%'";


I store telephone numbers as float and try find it by the c# code and didn't get any result so im trying to convert the column or correct the c# code










share|improve this question
























  • It is not clear where is your problem. Where are the FLOAT and BIGINT in your table? What has to do the final query with your problem? Do you store telephone numbers as float?

    – Steve
    Mar 24 at 11:19












  • i update it now

    – ahmed_eltot93
    Mar 24 at 11:23











  • See here why your choice to store tel numbers as float is wrong stackoverflow.com/questions/3483156/…

    – Steve
    Mar 24 at 11:26











  • If you are able to change the table then make phone numbers varchar instead of numeric.

    – Crowcoder
    Mar 24 at 11:26











  • @Crowcoder it is FLOAT and i can't convert it

    – ahmed_eltot93
    Mar 24 at 11:27

















0















Can the datatype of a field be changed to bigint from float ??



Create a new column that's an integer:



ALTER TABLE tabl ADD newCol int;


Select the data from the old column into the new one:



UPDATE tabl SET newCol = CAST(TEL2 AS int) FROM tabl ;


P.S: I am using MS SQL Server



i try to us this in c# but it didn't get any result



 string sqlCommand = "SELECT * FROM tabl WHERE CONCAT([TEL1], [TEL2],[TEL3], [TEL4],[TEL5], [TEL6],[TEL7], [TEL8],[TEL9]) LIKE '%" + txtBoxSearch.Text + "%'";


I store telephone numbers as float and try find it by the c# code and didn't get any result so im trying to convert the column or correct the c# code










share|improve this question
























  • It is not clear where is your problem. Where are the FLOAT and BIGINT in your table? What has to do the final query with your problem? Do you store telephone numbers as float?

    – Steve
    Mar 24 at 11:19












  • i update it now

    – ahmed_eltot93
    Mar 24 at 11:23











  • See here why your choice to store tel numbers as float is wrong stackoverflow.com/questions/3483156/…

    – Steve
    Mar 24 at 11:26











  • If you are able to change the table then make phone numbers varchar instead of numeric.

    – Crowcoder
    Mar 24 at 11:26











  • @Crowcoder it is FLOAT and i can't convert it

    – ahmed_eltot93
    Mar 24 at 11:27













0












0








0








Can the datatype of a field be changed to bigint from float ??



Create a new column that's an integer:



ALTER TABLE tabl ADD newCol int;


Select the data from the old column into the new one:



UPDATE tabl SET newCol = CAST(TEL2 AS int) FROM tabl ;


P.S: I am using MS SQL Server



i try to us this in c# but it didn't get any result



 string sqlCommand = "SELECT * FROM tabl WHERE CONCAT([TEL1], [TEL2],[TEL3], [TEL4],[TEL5], [TEL6],[TEL7], [TEL8],[TEL9]) LIKE '%" + txtBoxSearch.Text + "%'";


I store telephone numbers as float and try find it by the c# code and didn't get any result so im trying to convert the column or correct the c# code










share|improve this question
















Can the datatype of a field be changed to bigint from float ??



Create a new column that's an integer:



ALTER TABLE tabl ADD newCol int;


Select the data from the old column into the new one:



UPDATE tabl SET newCol = CAST(TEL2 AS int) FROM tabl ;


P.S: I am using MS SQL Server



i try to us this in c# but it didn't get any result



 string sqlCommand = "SELECT * FROM tabl WHERE CONCAT([TEL1], [TEL2],[TEL3], [TEL4],[TEL5], [TEL6],[TEL7], [TEL8],[TEL9]) LIKE '%" + txtBoxSearch.Text + "%'";


I store telephone numbers as float and try find it by the c# code and didn't get any result so im trying to convert the column or correct the c# code







c# sql-server database






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 24 at 11:23







ahmed_eltot93

















asked Mar 24 at 11:15









ahmed_eltot93ahmed_eltot93

11912




11912












  • It is not clear where is your problem. Where are the FLOAT and BIGINT in your table? What has to do the final query with your problem? Do you store telephone numbers as float?

    – Steve
    Mar 24 at 11:19












  • i update it now

    – ahmed_eltot93
    Mar 24 at 11:23











  • See here why your choice to store tel numbers as float is wrong stackoverflow.com/questions/3483156/…

    – Steve
    Mar 24 at 11:26











  • If you are able to change the table then make phone numbers varchar instead of numeric.

    – Crowcoder
    Mar 24 at 11:26











  • @Crowcoder it is FLOAT and i can't convert it

    – ahmed_eltot93
    Mar 24 at 11:27

















  • It is not clear where is your problem. Where are the FLOAT and BIGINT in your table? What has to do the final query with your problem? Do you store telephone numbers as float?

    – Steve
    Mar 24 at 11:19












  • i update it now

    – ahmed_eltot93
    Mar 24 at 11:23











  • See here why your choice to store tel numbers as float is wrong stackoverflow.com/questions/3483156/…

    – Steve
    Mar 24 at 11:26











  • If you are able to change the table then make phone numbers varchar instead of numeric.

    – Crowcoder
    Mar 24 at 11:26











  • @Crowcoder it is FLOAT and i can't convert it

    – ahmed_eltot93
    Mar 24 at 11:27
















It is not clear where is your problem. Where are the FLOAT and BIGINT in your table? What has to do the final query with your problem? Do you store telephone numbers as float?

– Steve
Mar 24 at 11:19






It is not clear where is your problem. Where are the FLOAT and BIGINT in your table? What has to do the final query with your problem? Do you store telephone numbers as float?

– Steve
Mar 24 at 11:19














i update it now

– ahmed_eltot93
Mar 24 at 11:23





i update it now

– ahmed_eltot93
Mar 24 at 11:23













See here why your choice to store tel numbers as float is wrong stackoverflow.com/questions/3483156/…

– Steve
Mar 24 at 11:26





See here why your choice to store tel numbers as float is wrong stackoverflow.com/questions/3483156/…

– Steve
Mar 24 at 11:26













If you are able to change the table then make phone numbers varchar instead of numeric.

– Crowcoder
Mar 24 at 11:26





If you are able to change the table then make phone numbers varchar instead of numeric.

– Crowcoder
Mar 24 at 11:26













@Crowcoder it is FLOAT and i can't convert it

– ahmed_eltot93
Mar 24 at 11:27





@Crowcoder it is FLOAT and i can't convert it

– ahmed_eltot93
Mar 24 at 11:27












2 Answers
2






active

oldest

votes


















2














Try using the STR() function:



SELECT STR(your_float_field, 25, 0)


This would return your float value as a string.
Note: This function pads on the left with spaces. If this is a problem, combine with LTRIM function:



SELECT LTRIM(STR(your_float_field, 25, 0))





share|improve this answer






























    -1














    No,because float contain decimals
    And bigint contain only integer.
    But bigint can be converted into
    Float as float contain both part -integer and decimals.
    If your float value contains .00 as the decimal value then it can be changed into bigint.
    Thanks.
    If you want more about datatype conversion.then please comment.
    Thanks again.






    share|improve this answer























    • yes i need that

      – ahmed_eltot93
      Mar 24 at 11:34











    • Are you understanding the above answer.

      – krishan -programmer in india
      Mar 24 at 11:36











    • yes i understand that . now it is a number (21412124) when i convert it to nvarchar it be like (2.1412e+)

      – ahmed_eltot93
      Mar 24 at 11:39











    • This is because mysql convert the no. According to it's unicode character.

      – krishan -programmer in india
      Mar 24 at 11:44











    Your Answer






    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "1"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55323222%2fsql-server-error-converting-data-type-float-to-bigint%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    2














    Try using the STR() function:



    SELECT STR(your_float_field, 25, 0)


    This would return your float value as a string.
    Note: This function pads on the left with spaces. If this is a problem, combine with LTRIM function:



    SELECT LTRIM(STR(your_float_field, 25, 0))





    share|improve this answer



























      2














      Try using the STR() function:



      SELECT STR(your_float_field, 25, 0)


      This would return your float value as a string.
      Note: This function pads on the left with spaces. If this is a problem, combine with LTRIM function:



      SELECT LTRIM(STR(your_float_field, 25, 0))





      share|improve this answer

























        2












        2








        2







        Try using the STR() function:



        SELECT STR(your_float_field, 25, 0)


        This would return your float value as a string.
        Note: This function pads on the left with spaces. If this is a problem, combine with LTRIM function:



        SELECT LTRIM(STR(your_float_field, 25, 0))





        share|improve this answer













        Try using the STR() function:



        SELECT STR(your_float_field, 25, 0)


        This would return your float value as a string.
        Note: This function pads on the left with spaces. If this is a problem, combine with LTRIM function:



        SELECT LTRIM(STR(your_float_field, 25, 0))






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Mar 24 at 13:31









        Rahul SharmaRahul Sharma

        8281617




        8281617























            -1














            No,because float contain decimals
            And bigint contain only integer.
            But bigint can be converted into
            Float as float contain both part -integer and decimals.
            If your float value contains .00 as the decimal value then it can be changed into bigint.
            Thanks.
            If you want more about datatype conversion.then please comment.
            Thanks again.






            share|improve this answer























            • yes i need that

              – ahmed_eltot93
              Mar 24 at 11:34











            • Are you understanding the above answer.

              – krishan -programmer in india
              Mar 24 at 11:36











            • yes i understand that . now it is a number (21412124) when i convert it to nvarchar it be like (2.1412e+)

              – ahmed_eltot93
              Mar 24 at 11:39











            • This is because mysql convert the no. According to it's unicode character.

              – krishan -programmer in india
              Mar 24 at 11:44















            -1














            No,because float contain decimals
            And bigint contain only integer.
            But bigint can be converted into
            Float as float contain both part -integer and decimals.
            If your float value contains .00 as the decimal value then it can be changed into bigint.
            Thanks.
            If you want more about datatype conversion.then please comment.
            Thanks again.






            share|improve this answer























            • yes i need that

              – ahmed_eltot93
              Mar 24 at 11:34











            • Are you understanding the above answer.

              – krishan -programmer in india
              Mar 24 at 11:36











            • yes i understand that . now it is a number (21412124) when i convert it to nvarchar it be like (2.1412e+)

              – ahmed_eltot93
              Mar 24 at 11:39











            • This is because mysql convert the no. According to it's unicode character.

              – krishan -programmer in india
              Mar 24 at 11:44













            -1












            -1








            -1







            No,because float contain decimals
            And bigint contain only integer.
            But bigint can be converted into
            Float as float contain both part -integer and decimals.
            If your float value contains .00 as the decimal value then it can be changed into bigint.
            Thanks.
            If you want more about datatype conversion.then please comment.
            Thanks again.






            share|improve this answer













            No,because float contain decimals
            And bigint contain only integer.
            But bigint can be converted into
            Float as float contain both part -integer and decimals.
            If your float value contains .00 as the decimal value then it can be changed into bigint.
            Thanks.
            If you want more about datatype conversion.then please comment.
            Thanks again.







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Mar 24 at 11:32









            krishan -programmer in indiakrishan -programmer in india

            113




            113












            • yes i need that

              – ahmed_eltot93
              Mar 24 at 11:34











            • Are you understanding the above answer.

              – krishan -programmer in india
              Mar 24 at 11:36











            • yes i understand that . now it is a number (21412124) when i convert it to nvarchar it be like (2.1412e+)

              – ahmed_eltot93
              Mar 24 at 11:39











            • This is because mysql convert the no. According to it's unicode character.

              – krishan -programmer in india
              Mar 24 at 11:44

















            • yes i need that

              – ahmed_eltot93
              Mar 24 at 11:34











            • Are you understanding the above answer.

              – krishan -programmer in india
              Mar 24 at 11:36











            • yes i understand that . now it is a number (21412124) when i convert it to nvarchar it be like (2.1412e+)

              – ahmed_eltot93
              Mar 24 at 11:39











            • This is because mysql convert the no. According to it's unicode character.

              – krishan -programmer in india
              Mar 24 at 11:44
















            yes i need that

            – ahmed_eltot93
            Mar 24 at 11:34





            yes i need that

            – ahmed_eltot93
            Mar 24 at 11:34













            Are you understanding the above answer.

            – krishan -programmer in india
            Mar 24 at 11:36





            Are you understanding the above answer.

            – krishan -programmer in india
            Mar 24 at 11:36













            yes i understand that . now it is a number (21412124) when i convert it to nvarchar it be like (2.1412e+)

            – ahmed_eltot93
            Mar 24 at 11:39





            yes i understand that . now it is a number (21412124) when i convert it to nvarchar it be like (2.1412e+)

            – ahmed_eltot93
            Mar 24 at 11:39













            This is because mysql convert the no. According to it's unicode character.

            – krishan -programmer in india
            Mar 24 at 11:44





            This is because mysql convert the no. According to it's unicode character.

            – krishan -programmer in india
            Mar 24 at 11:44

















            draft saved

            draft discarded
















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55323222%2fsql-server-error-converting-data-type-float-to-bigint%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

            Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

            Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript