Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
Stevanicus
Starting Member
1 Post |
Posted - 2007-10-13 : 18:44:31
|
Hi, im currently learning sql. I have a problem extracting a date from a table.SELECT Date FROM FlightGives me a "syntax error in sql expression"in the table the date coloum - fields are set Date/Timean example field is 28.12.2007 00:00Thanks in advanced!Stevep.s. im using openoffice base, if i force to run the code it display's the date. however I would like it to run without errors. Thanks again |
|
rmiao
Master Smack Fu Yak Hacker
7266 Posts |
Posted - 2007-10-13 : 20:55:20
|
Is it for sql server? What's data type of the column? If it's datetime column, you can get date with this:select convert(char(10), col_name) from tab_name |
 |
|
Kristen
Test
22859 Posts |
Posted - 2007-10-14 : 00:45:39
|
Maybe because DATE is a reserved word, try:SELECT [red][[red]Date[red]][red] FROM FlightSELECT [Date] FROM FlightEdit: Thanks khTanKristen |
 |
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2007-10-14 : 03:32:05
|
Kristen missed out the '/' for the forum formatting code. It should be SELECT [Date] FROM Flight KH[spoiler]Time is always against us[/spoiler] |
 |
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2007-10-15 : 03:14:52
|
quote: Originally posted by Stevanicus Hi, im currently learning sql. I have a problem extracting a date from a table.SELECT Date FROM FlightGives me a "syntax error in sql expression"in the table the date coloum - fields are set Date/Timean example field is 28.12.2007 00:00Thanks in advanced!Stevep.s. im using openoffice base, if i force to run the code it display's the date. however I would like it to run without errors. Thanks again
Are you using Microsoft SQL Server?If you are a newbie to sql, learn ithttp://www.sql-tutorial.net/ http://www.firstsql.com/tutor.htm http://www.w3schools.com/sql/default.asp MadhivananFailing to plan is Planning to fail |
 |
|
|
|
|