SQL Select All and Change Single Column Format

It was interesting to me. If I have a table with 20 (or more) column names and I want to select all of them, but one column of these 20 columns is a date column, and you would like to change the format of this column, how would you do that? This clearly didn't work (duplicate columns are created)

Select *, CONVERT(varchar(100),courseStartDate,111) from EthicsManagement 

This is to avoid writing a select statement that selects ALL 20 columns individually and converts one of them using the operator

  Select xxxx,xxx,xxx,xxx,xx,xx,xxx,xxx,xx,xx,xxx,xxx,xx, CONVERT(varchar(100),courseStartDate,111) from xxx 
+6
source share
2 answers

This should allow you to do this if you call the column something else:

 Select *, CONVERT(varchar(100),courseStartDate,111) as myConvertedDateColumn from EthicsManagement 
+5
source
 Select t.*, CONVERT(varchar(100),courseStartDate,111) as converted from EthicsManagement t 
0
source

All Articles