I have been given a database I need to perform a PIVOT on. My Pivot works perfectly fine. However, one of the columns I need to perform in my SELECT is a column of text type. However, the PIVOT command cannot use this data type. How would I get round this?
相关问题
- SQL join to get the cartesian product of 2 columns
- sql execution latency when assign to a variable
- Difference between Types.INTEGER and Types.NULL in
- React Native Inline style for multiple Text in sin
- php PDO::FETCH_ASSOC doesnt detect select after ba
My personal preference would be just to convert the column type to
VARCHAR(MAX)
and be done with it,TEXT
is on the deprecation list anyway.If this is not an option you can simply cast/convert the text value to
VARCHAR(MAX)
in your query. e.g.Gives the error:
This works fine: