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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
KenMann
Regular Visitor

Can we change column type in Fabric SQL Endpoint ?

Hi guys,

 

I have CSV file that I uploaded into my Lakehouse, soon after by using drag and drop to Tables, I would have 1 table created with the same structure as the CSV. It is actually a CSV contain Date table. However when I take a look at the table structure, the column has no Date type column even with the field contain date.

 

Can we change it ? or can we add new column based on the exisiting column and lets say I want to new column to have Date type.

Firstly I though Lakehouse SQL Endpoint is the best place to do all that, but turns out I cannot find any button or function to support my plan.

KenMann_0-1701529503142.png

Any other place I can do that ? or how to have a column with Date type when we have table with source is CSV ?

 

Thanks

 

 

 

 

1 ACCEPTED SOLUTION

Hi,

 

I'm finally manage to make the column as Date. Figure it out that I better not using "Drag and Drop" on the csv file to my Lakehouse table. Instead doing the Get Data feature so I can manually change the column inside PowerQuery, before the table created.

 

Issue solved. Thanks.

View solution in original post

6 REPLIES 6
GilbertQ
Super User
Super User

Thanks for letting us know.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!







Power BI Blog

GilbertQ
Super User
Super User

Hi @KenMann 


Because a CSV is just a text file, when creating a table in the Lakehouse it cannot determine what the column data types are.


One way to do it when querying via the SQL End Point is you can use the following code to cast it on the fly as shown below.

 

Select 
CAST(FullDateAlternateKey as Date) as Date
from dbo.MyTableName

 

NOTE: The SQL Endpoint is case sensitive for your column names so make sure to spell them exactly the same. 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!







Power BI Blog

Hi,

Yes, this what I'm thinking as well. But may I know how to do it in SQL Endpoint ? 

Are you referring to that button "New sql query" and write the CAST over there like this ?

KenMann_0-1701745402303.png

But, as this is just a query, how this will alter the table it self which then can be used in my data set outside (Power BI Dekstop)

 

Thanks,

 

Hi @KenMann 

 

When you use the Power Query data source from "SQL Server" you can insert a query, which you can use from your screenshot above, which will then bring the data in as Date.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!







Power BI Blog

I'm sorry, but I'm not quite understand what is the meaning by 'data source from "SQL Server" ', since my datasource is from CSV. And by looking at this resource : T-SQL surface area - Microsoft Fabric | Microsoft Learn

 

There are these limitation in SQL Endpoint:

KenMann_0-1702142348809.png

 

 

 

 

Hi,

 

I'm finally manage to make the column as Date. Figure it out that I better not using "Drag and Drop" on the csv file to my Lakehouse table. Instead doing the Get Data feature so I can manually change the column inside PowerQuery, before the table created.

 

Issue solved. Thanks.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.