| Author |
Topic |
|
jobby
Starting Member
4 Posts |
Posted - 2005-08-22 : 06:16:31
|
| Hi all.I'm using foxpro and I'm completely new to SQL. I'm trying to create a database into which I need to enter a time field. I've read around on the net that the only way to do this is using a datetime datatype but I can't find anywhere that explains the format I use to INSERT INTO my tables.Anyone help?*EDIT* I actually just want to enter the time and not the date and the time, I have read it is possible to do this using a convert but I'm happy enough to have the date and the time as I don't want to overcomplicate anything at this stage. |
|
|
gpl
Posting Yak Master
195 Posts |
Posted - 2005-08-22 : 06:25:16
|
| JobbyLooking at BOL (Books Online - it comes with SQL server and has nearly everything you need) it mentions in the convert functions, this date formatter. 8 - hh:mm:ss If you have a string value for your time and convert it to a datetime it will default the date part to 01/01/1900eg Update MyTable Set MyStartTime=Convert(Datetime, '09:10:30', 8)Where StaffID=@InputStaffIDHope this helps youGraham |
 |
|
|
jobby
Starting Member
4 Posts |
Posted - 2005-08-22 : 06:29:12
|
| Sorry Graham, I don't mean to sound ungrateful but that went way over my head.I have a table:CREATE TABLE RACE ;(RaceNo INT(2) PRIMARY KEY, NameOfRace CHAR(35) NOT NULL, TimeOfRace T, ;RaceDistance FLOAT(3) NOT NULL, MeetingNo INT(2) NOT NULL ;FOREIGN KEY MeetingNo TAG MeetingNo REFERENCES MEETING)and I need to know how to do theINSERT INTO RACE VALUES('TimeOfRace' field)Apologies if you have already explained this in plain english, I'm a newb. |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-08-22 : 06:38:30
|
| >>I'm using foxpro and I'm completely new to SQLThis is SQL Server ForumTry thisINSERT INTO RACE(TimeOfRace) VALUES('TimeValue')MadhivananFailing to plan is Planning to fail |
 |
|
|
jobby
Starting Member
4 Posts |
Posted - 2005-08-22 : 06:45:54
|
| SQL is SQL is it not???When you say ('Time Value') what format would you suggest?A simple 'HH:MM'?Also I thought you had to enter a date aswell? please correct me if I'm wrong. |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-08-22 : 06:57:57
|
Your table structurequote: CREATE TABLE RACE ;(RaceNo INT(2) PRIMARY KEY, NameOfRace CHAR(35) NOT NULL, TimeOfRace T, ;RaceDistance FLOAT(3) NOT NULL, MeetingNo INT(2) NOT NULL ;FOREIGN KEY MeetingNo TAG MeetingNo REFERENCES MEETING)
does not seem to of SQL Server 2000Do you want to create the same structure in SQL Server?MadhivananFailing to plan is Planning to fail |
 |
|
|
jobby
Starting Member
4 Posts |
Posted - 2005-08-22 : 07:04:41
|
| Sorry I assumed that SQL was a generic language that was similar if not the same on all platforms. I do not wish to create the same structure in SQL server. I must use FoxPro.I suppose this is the wrong place to ask then. |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-08-22 : 07:22:15
|
| >>I do not wish to create the same structure in SQL server. I must use FoxPro.Post this question at Foxpro ForumsMadhivananFailing to plan is Planning to fail |
 |
|
|
|