473,218 Members | 1,504 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,218 software developers and data experts.

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 9819
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

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

Similar topics

13
by: perplexed | last post by:
How do you convert a user inputted date to a unix timestamp before insterting it into your database? I have a form, with a textfield for a date that the user inputs in the format mm-dd-yyyy and...
4
by: oshanahan | last post by:
Does anyone have ideas on the best way to move large amounts of data between tables? I am doing several simple insert/select statements from a staging table to several holding tables, but because...
3
by: sms1 | last post by:
My Participants table in Access 2002 contains about 1500 records. The Notes field is OLE. I want to use Insert Object to insert MS Word into the Notes field. It is easily done using: Insert...
15
by: Khurram | last post by:
I have a problem while inserting time value in the datetime Field. I want to Insert only time value in this format (08:15:39) into the SQL Date time Field. I tried to many ways, I can extract...
9
by: Zak Milas | last post by:
The field is too small to accept the amount of data you attempted to add. Try inserting or pasting less data. Is the error I get when it get dbCmd.ExecuteNonQuery();. I have 15 fields to insert,...
6
by: fniles | last post by:
I am using VB.NET 2003 and SQL Server 2000. I have a table with a datetime column type. When inserting into the table for that column, I set it to Date.Now.ToString("T") , which is something like...
7
by: ebindia0041 | last post by:
This is like the bug from hell. It is kind of hard to explain, so please bear with me. Background Info: SQL Server 7.0, Asp.net 1.1 with c# I'm inserting simple records into a table. But one...
13
by: imnewtoaccess | last post by:
Hi, I am getting errors while inserting records in one table from another. These are the structures of two tables : file51tm_new RecordType Text
5
by: rando1000 | last post by:
Okay, here's my situation. I need to loop through a file, inserting records based on a number field (in order) and if the character in a certain field = "##", I need to insert a blank record. ...
1
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
0
by: veera ravala | last post by:
ServiceNow is a powerful cloud-based platform that offers a wide range of services to help organizations manage their workflows, operations, and IT services more efficiently. At its core, ServiceNow...
0
by: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.