Sample Header Ad - 728x90

How to retain same FLOAT value after converting it to a VARCHAR in Azure Synapse

1 vote
1 answer
324 views
Consider the following example: DROP TABLE dbo.TEST_FLOAT; CREATE TABLE dbo.TEST_FLOAT ( AMOUNT FLOAT ); INSERT INTO dbo.TEST_FLOAT (AMOUNT) VALUES (11546.25); SELECT AMOUNT, CAST(AMOUNT AS VARCHAR(10)) AS AMOUNT_AS_CHAR FROM dbo.TEST_FLOAT This is what is returned from Management Studio: enter image description here What I want is the displayed values to be the same, however it seems Azure Synapse is rounding the number when the CAST is performed. I need this to work inline as I am hashing several concatenated values and need these all COALESCED VARCHARS. Any idea how to do this?
Asked by Lauren_G (69 rep)
May 3, 2022, 03:50 PM
Last activity: May 3, 2022, 06:02 PM