Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Is "SELECT *, Date" possible? 1

Status
Not open for further replies.

Sandman83

Programmer
Sep 11, 2001
122
US
Hi All,

I am trying to write a query that will select all fields from a table (without puting each field in the select statement) and add an addition field that converts the the date from the database format to a date format. I have tried the following, but get a "keyword not found where expected" error.

Code:
SELECT *, TO_DATE(lpad(term_date - 1000000, 6, 0), 'yymmdd') "Term Date"
FROM calldetail
WHERE term_date = 1060420

I have test the "TO_DATE" code and it works fine.

Thanks,
Tim
 
i dunno about the TO_DATE and LPAD functions, but as far as your question is concerned, yes, you can say

SELECT *, somefunction(...) ...

r937.com | rudy.ca
 
I always thought that the '*' option was mutually exclusive to all the other select list options; i.e. you can use '*' or you can specify individual columns/functions/expressions but not both - am I wrong ? :)
 
Standard SQL does not (currently) allow

Code:
select *,expressions ...
from t ...

use

Code:
select t.*,expressions ...
from t ...
 
Thanks swampBoogie. I changed to

Code:
SELECT [b][green]a.[/green][/b]*, TO_DATE(lpad([b][green]a.[/green][/b]term_date - 1000000, 6, 0), 'yymmdd') "Term Date"
FROM calldetail [b][green]a[/green][/b]
WHERE [b][green]a.[/green][/b]term_date = 1060420

and that worked perfectly.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top