Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
jesuslogmein
Helper I
Helper I

Copy Data Lakehouse

I need to modify the field of a table in my lakehouse (I have it in text and I want to change it to FLOAT).

To do so, I thought of creating a new table inserting the values in the table:

 

%%sql
CREATE TABLE TB_Destino (
  Fecha DATE,
  Hora STRING,
  Nombre_Cola STRING,
  Oferta FLOAT,
  Contestadas FLOAT,
  Abandonadas FLOAT,
  Retener FLOAT,
  Transferir FLOAT,
  Abandono_Rapido FLOAT, -- Corregido el nombre de la columna
  ACW FLOAT,
  Conversacion FLOAT,
  Retencion FLOAT,
  Atendidas_Antes_X_Segundos FLOAT
) USING DELTA
OPTIONS (path 'Tables/TB_Destino');

INSERT INTO TB_Destino
SELECT * FROM TB_Origen;
1 ACCEPTED SOLUTION
jesuslogmein
Helper I
Helper I

thank you very much! in the end I solved it in another way, I had in one of the fields text and I had a problem with the null to convert them in Float. In the end I put in the query a try cast and it was solved.

View solution in original post

3 REPLIES 3
jesuslogmein
Helper I
Helper I

thank you very much! in the end I solved it in another way, I had in one of the fields text and I had a problem with the null to convert them in Float. In the end I put in the query a try cast and it was solved.

Glad to know that your issue got resolved. Please continue using Fabric Community on your further queries.

AndyDDC
Solution Sage
Solution Sage

Hi @jesuslogmein you could use CTAS in a single statement and add/modify columns as appropriate.

 

eg in the query below, in the SELECT, select the relevant columns, and cast to other types 

 

%%sql
CREATE TABLE IF NOT EXISTS new_table
USING DELTA AS
SELECT <columns>
FROM source_table

 

Helpful resources

Announcements
Expanding the Synapse Forums

New forum boards available in Synapse

Ask questions in Data Engineering, Data Science, Data Warehouse and General Discussion.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayFBCUpdateCarousel

Fabric Monthly Update - May 2024

Check out the May 2024 Fabric update to learn about new features.