
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Converting timestamp to a number in SQL
Hi
I created a standard incremental loader based on the Date field. I'm having difficulties changing the data format of my date field to a number. Date format in SQL database: 2015-02-04 00:00:00:.0000000', I want to replace this with a number format, i.e. 42040, within the SQL part of the load script (I need this in my where clause). Any ideas how this can be achieved?
Thanks
- « Previous Replies
-
- 1
- 2
- Next Replies »

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Timestamps are numbers. You don't have to convert the timestamp value to use it as a number.
talk is cheap, supply exceeds demand

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Actually it is a character string, I just run the script again and this is the error:
Conversion failed when converting date and/or time from character string.
any ideas?


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
What's the datatype of your date in SQL?
if it's datetime2 then: 'Explicit conversion from data type datetime2 to int is not allowed.'


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi.
I use the following:
num(date(left(ColumnDate,10),'DD-MM-YYYY'))
Regards.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I tried this but 'date' is not a recognized built-in function name
my where clause is in the SQL part of the script under SQL Select


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Can you post your SQL select please?


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sorry, this is for use in the load.
Regards.


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Katarzyna
can you post the relevant part of your where clause here, please?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Use the CAST function in sql or the timestamp# function in a qlikview load statement.
talk is cheap, supply exceeds demand

- « Previous Replies
-
- 1
- 2
- Next Replies »