Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Adding a Date to a SQL Select


Hello All,

I am using a SQL Select * from MyView into a resident table.  While doing the select, I would like to add a date column to the table (not supplied in the view) to indicate the load date of the record set.  This may sound simple, but I'm having trouble finding the right syntax.

1 Solution

Accepted Solutions
swuehl
MVP
MVP

Add a preceding Load:

Load *,     

Today() as LoadDate;

SQL SELECT ...

View solution in original post

5 Replies
swuehl
MVP
MVP

Add a preceding Load:

Load *,     

Today() as LoadDate;

SQL SELECT ...

rbecher
MVP
MVP

Syntax for which database..?

Astrato.io Head of R&D
Not applicable
Author

Thanks for your response.  I tried your suggestion and the script threw an error.  Here is the statement.  The sql select statement by itself runs fine.

 

TestTable:

Load *,
Today() as LoadDate;
SQL SELECT *
FROM myDB.DBO."MyViewName";

swuehl
MVP
MVP

What does the error message say?

Your DB table does not also have a field named LoadDate, of course.

Not applicable
Author

My mistake.  I had a bad line above this one (copy / paste error).  Everything is ok.  Thanks again for your help.