I was wondering. If I have a table with 20(or more) column names in and I want to select All of them, but one column of those 20 columns is a date column and you would like to change the format of that column, how would you do that? This obviously didn't work (created duplicate columns)
Select *, CONVERT(varchar(100),courseStartDate,111) from EthicsManagement
This is to avoid writing a select statement selecting ALL 20 columns individually and converting one of them with the statement
Select xxxx,xxx,xxx,xxx,xx,xx,xxx,xxx,xx,xx,xxx,xxx,xx, CONVERT(varchar(100),courseStartDate,111) from xxx
The SQL*Plus COLUMN command is used to change the appearance of the data returned for a given column using the following syntax: COLUMN column_name option1 option2 ... Once set, the SQL*PLUS COLUMN command will format any column of the specified name until it is unset with the CLEAR COLUMNS command.
It should let you do that, as long as you name the column something different:
Select *, CONVERT(varchar(100),courseStartDate,111) as myConvertedDateColumn
from EthicsManagement
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With