-
October 8th, 2020, 10:23 AM
#1
SQL Numeric conversion
Hi,
I have got some problems when running this SQL statement :
select CONVERT(numeric,0x120200000000084e20e90015)
It shows "Erreur de conversion du type de données varbinary en numeric.".
How could I manage to fix that point ?
Thank you for help !
-
October 8th, 2020, 12:54 PM
#2
Re: SQL Numeric conversion
Have you tried to single quote the binary string?
-
October 8th, 2020, 01:17 PM
#3
Re: SQL Numeric conversion
Originally Posted by Arjay
Have you tried to single quote the binary string?
Hi Arjay,
Do you mean something like this : select CONVERT(numeric,'0x120200000000084e20e90015') ?
If so, it does not work. It gives an error ==> Erreur de conversion du type de données varchar en numeric.
Last edited by James West; October 8th, 2020 at 01:20 PM.
-
October 8th, 2020, 01:23 PM
#4
Re: SQL Numeric conversion
Originally Posted by James West
Hi Arjay,
Do you mean something like this : select CONVERT(numeric,'0x120200000000084e20e90015') ?
If so, it does not work. It gives an error ==> Erreur de conversion du type de données varchar en numeric.
Well, but you were going to convert it to numeric, not to datetime!
Originally Posted by James West
Hi,
I have got some problems when running this SQL statement :
select CONVERT(numeric,0x120200000000084e20e90015)
Weren't you?
Victor Nijegorodov
-
October 8th, 2020, 01:28 PM
#5
Re: SQL Numeric conversion
Originally Posted by VictorN
Well, but you were going to convert it to numeric, not to datetime!
Weren't you?
It was an error .
I have posted two threads in this way and one is related also to date conversion.
-
October 8th, 2020, 02:26 PM
#6
Re: SQL Numeric conversion
Originally Posted by James West
It was an error .
I have posted two threads in this way and one is related also to date conversion.
So did it work with numeric?
Victor Nijegorodov
-
October 9th, 2020, 07:16 AM
#7
Re: SQL Numeric conversion
The process of changing data type of a value into another data type is referred to as data type conversion and also almost all programing languages include some type of data converting functions or functionality. When we turn our perspective to SQL Server in order to discuss details of SQL data converting operations, at first we can separate data conversion process into two parts; implicit and explicit conversions. Implicit conversion is done by SQL Server for internal needs and you can also find additional details in the article Implicit conversion in SQL Server. Explicit conversion is performed explicitly by a database programmer or administrator and at the same time this conversion process is made with help of any data conversion function. In this article, we will particularly focus on the SQL CONVERT function. This function provides a means to convert one data type to another specified data type. At first, we will interpret the syntax of the SQL CONVERT function.
-
October 9th, 2020, 07:25 AM
#8
Re: SQL Numeric conversion
Originally Posted by mikeduke1290
The process of changing data type of a value into another data type is referred to as data type conversion and also almost all programing languages include some type of data converting functions or functionality.
...
At first, we will interpret the syntax of the SQL CONVERT function.
Is this quotation from https://www.sqlshack.com/sql-convert-function/ ?
Or what were you going to say?
Victor Nijegorodov
-
October 9th, 2020, 11:57 AM
#9
Re: SQL Numeric conversion
Originally Posted by VictorN
I'd say it's a copy-and-paste hijack!
All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!
C++23 Compiler: Microsoft VS2022 (17.6.5)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|