I have a table in my warehouse that has columns in all uppercase. It scripts out like this:
CREATE TABLE [dbo].[Outlet](
[OUTLET_KEY] [varchar](10) NOT NULL,
[OUTLET] [varchar](8) NULL,
[CITY_CODE] [varchar](4) NULL,
[OUTLET_NAME] [varchar](25) NULL,
[COUNTRY_CODE] [varchar](3) NULL,
[EXTENDED_CATEGORY_CODE] [varchar](2) NULL,
[PHONE_NUMBER] [varchar](17) NULL
) ON [PRIMARY]
I want to change the case of the columns in the table to a much more readable format
- Outlet_Key
- Outlet
- City_Code
- Outlet_Name
- Country_Code …….
There are about 15 tables and about 200 columns. How do I change the case for all of them?
Give this a shot:
This code assumes that the only non-character value that you have is “_” and that you don’t have successive underscores (i.e., MY____COLUMN would give the wrong results).