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

            SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

            은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현