468,170 Members | 1,913 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,170 developers. It's quick & easy.

inserting data in time field

priyan
54
hai everyone,
I am having a doubt in inserting data in time field.
I am having a table in which in column in timestamp without time zone datatype. I want to insert a row into the table but that time field has no value if I insert omitting that column error occurs...
for eg.
Expand|Select|Wrap|Line Numbers
  1. CREATE TABLE blah
  2. (
  3.   uuid integer NOT NULL DEFAULT nextval('universal_sq'::regclass),
  4.   "time" timestamp without time zone
  5. WITHOUT OIDS;
  6.  
insert query:
Expand|Select|Wrap|Line Numbers
  1. insert into blah (uuid,time)values (5,'')
  2.  
I am getting an error like this:

Expand|Select|Wrap|Line Numbers
  1. ERROR: invalid input syntax for type timestamp: ""
  2. SQL state: 22007
  3.  
Please help me i should have that column name in the list but should not have an value for that column.please tell me is there any possible way for this. please help me as soon as possible.....
Aug 10 '07 #1
4 9428
michaelb
534 Expert 512MB
... ... ...
Expand|Select|Wrap|Line Numbers
  1. CREATE TABLE blah
  2. (
  3.   uuid integer NOT NULL DEFAULT nextval('universal_sq'::regclass),
  4.   "time" timestamp without time zone
  5. WITHOUT OIDS;
  6.  
insert query:
Expand|Select|Wrap|Line Numbers
  1. insert into blah (uuid,time)values (5,'')
  2.  
I am getting an error like this:
Expand|Select|Wrap|Line Numbers
  1. ERROR: invalid input syntax for type timestamp: ""
  2. SQL state: 22007
  3.  
... ... ...
Either one of these two statements should work for you:
Expand|Select|Wrap|Line Numbers
  1. insert into blah (uuid,time) values (5, NULL);
  2. insert into blah (uuid) values (5);
  3.  
Did you see the manual page for INSERT command?

You probably realize that outside of this example there's no need to provide a value for the SERIAL field uuid.
Aug 10 '07 #2
priyan
54
Either one of these two statements should work for you:
Expand|Select|Wrap|Line Numbers
  1. insert into blah (uuid,time) values (5, NULL);
  2. insert into blah (uuid) values (5);
  3.  
Did you see the manual page for INSERT command?

You probably realize that outside of this example there's no need to provide a value for the SERIAL field uuid.
thank you for helping me
Aug 11 '07 #3
gauravgmbhr
107 100+
thank you for helping me

U can also use Values (5,Default) instead of values (5,NULL)

Both works


Regards Gaurav
Aug 11 '07 #4
priyan
54
U can also use Values (5,Default) instead of values (5,NULL)

Both works


Regards Gaurav

Thank you very much helping me..
Aug 14 '07 #5

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

4 posts views Thread by oshanahan | last post: by
6 posts views Thread by fniles | last post: by
reply views Thread by gcreed | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.