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;
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
|
show 13 more comments
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
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
|
show 13 more comments
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
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
c# sql-server database
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
|
show 13 more comments
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
|
show 13 more comments
2 Answers
2
active
oldest
votes
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))
add a comment |
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.
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
add a comment |
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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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))
add a comment |
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))
add a comment |
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))
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))
answered Mar 24 at 13:31
Rahul SharmaRahul Sharma
8281617
8281617
add a comment |
add a comment |
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.
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
add a comment |
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.
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
add a comment |
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.
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.
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
add a comment |
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
add a comment |
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
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