0

we are inserting values to a table through a procedure , one values we are inserting is current_timestamp. throwing below while inserting timestamp values. too many arguments for function [TO_TIMESTAMP(CURRENT_TIMESTAMP(), 'DD-MM-YYYY HH:MI:SS')] expected 1, got 2\n Stack Trace:\nundefined\n

below is the syntax:

var create_vol1=snowflake.execute({sqlText: "INSERT INTO CDW_DB.LOAD_timestamp VALUES (TO_TIMESTAMP(Current_Timestamp,'DD-MM-YYYY HH:MI:SS'))"});

please correct me if i am wrong here.

Thanks

1 Answer 1

1

The current_timestamp function already returns a timestamp so you don't need to do anything to it. Just insert it like this:

INSERT INTO CDW_DB.LOAD_timestamp VALUES (Current_Timestamp)
Sign up to request clarification or add additional context in comments.

6 Comments

Thanks Simon, i have used it but it is loading extra -000 at the end of value, i need to load in this format 'dd-mm-yyyy hh-mi-ss', that is why i am using to_timestamp.
What is the data type of the column you're inserting into? There is a difference between a timestamp and a string representation of a timestamp. Timestamp data types don't have a format.
data type is Timestamp
how would we convert to a specified format if it is having data type as Timestamp?
Have a read of this documentation about the different types of timestamps. The first step would be to understand which one you're using for that column. You may have to look up the timestamp_type_mapping if it's really just shown as timestamp docs.snowflake.com/en/sql-reference/…
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.