473,395 Members | 2,079 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,395 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 9843
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. ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.