Hi All,
Let's say I have an excel file with 10 columns, All the column header names starts with "SA_"
Like- SA_Name, SA_Sales, SA_Date etc.
Need to remove the prefix for all columns, which tool should I use? How to do it?
And, what will be the SQL query to do this?
Kindly assist.
Solved! Go to Solution.
Use Dynamic rename tool and try this formula
Replace([_CurrentField_],"SA_","")
Try this SQL query
SELECT
CASE
WHEN SUBSTRING(column_name, 1, 3) = 'SA_' THEN SUBSTRING(column_name, 4)
ELSE column_name
END AS new_column_name
FROM
YourTableName;
Hi @BRRLL99
Your query is attempting to modify the column names and won't work unless you actually have a field called "column_name" in your database.
To return the values in a SQL table with new column names try this
Select SA_Name "Name",
SA_Sales Sales,
SA_Date "Date"
etc
From tablename
Name and Date are both reserved words in SQL so it's a good idea to enclose them in quotes.
Dan