Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Mon, 26 Jan 2004 @ 15:24:34 GMT


     
  <Prev Next>  
<<First
<Prev
Next> Last>>  


Subj:   Current_Timestamp in views
 
From:   Lerner, Dirk

Hi all,

when I create a view with a column "user" (database user) I have no problems:

mytable:

x
-
2
3
1

create view myview as(
select m.x,user as dbuser from mytable m)

x       dbuser
-------------
2       DLERNER
3       DLERNER
1       DLERNER

If I want to include a "current timestamp" I get an error message:

create view myview as(
select m.x,user as dbuser,current_timestamp as dbtime from mytable m);

5407:  Invalid operation on an ANSI Datetime or Interval value.

If I cast the "current timestamp" to varchar there's no problem anymore:

create view myview as(
select m.x,user as dbuser,cast(current_timestamp as varchar(40)) as dbtime from mytable m);

x       dbuser  dbtime
--------------------------------------------------
2       DLERNER 2004-01-26 16:11:40.660000+00:00
3       DLERNER 2004-01-26 16:11:40.660000+00:00
1       DLERNER 2004-01-26 16:11:40.660000+00:00

I think, dbtime is now not anymore a "current timestamp". I guess it is after the cast operation a constant like "user" (dbuser).

Is this correct?

I'm just curious about that :-)


Regards,

Dirk



     
  <Prev Next>  
<<First
<Prev
Next> Last>>  
 
 
 
 
 
 
 
 
  
  Top Home Privacy Feedback  
 
 
Copyright for the TeradataForum (TDATA-L), Manta BlueSky    
Copyright 2016 - All Rights Reserved    
Last Modified: 15 Jun 2023