Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

INSERT INTO syntax error

Status
Not open for further replies.

Telsa

Programmer
Jun 20, 2000
393
US
I have an ASP page that builds a SQL statement. But when I run it, I get a syntax error on the INSERT INTO.

INSERT INTO tblpds_projects (title, description, deliverables, scope, cdrom_dvd, ews, firmware, iadd, iftw, os_bundles, pcl, point_print_bundles, postscript, printing_system, web_jet_admin, othercomponents, products, future, win95, win98, winme, winnt, win2k, winxp, mac8and9, macx, linux, hpux, otheros, langnum, weblivedate, otherdate) VALUES ('hp laserjet 4800', 'testing new ', 'web', 'all over world', 0, 0, 0, 0, 0, 0, -1, -1, -1, -1, 0, ' ', 'lj4800', ' ', 0, -1, -1, 0, -1, -1, -1, -1, 0, 0, ' ', 23, #05/08/2003#, );

Can anyone see what I don't why this is giving me an error? Mary :)

Violence begets Violence
Let's Give Peace a Chance!!
 
There is a superfluous comma after the last value

#05/08/2003#, );

that should be removed
 
you have an extra comma after your last value


#05/08/2003#, );

------------^ HERE

CHEYNEY
 
For starters, you may need to add square brackets around a couple of your column names - [title] and [description] - as they are reserved words (I think both of them are anyway!)

Try those and let us know if you still have problems. --James
 
Removing the comma (which actually comes before another date field) didn't make any difference and neither does placing brackets around title and description.

BTW: if there is no date in the field (it's the last field), what would be a good placeholder?? Would having, say, NULL work?

All I'm trying to do is add the record to the table and then have it display what was added... but I have to add it before I can get its ID # to display it. Mary :)

Violence begets Violence
Let's Give Peace a Chance!!
 
try cutting and pasting your statement into query analyser. This should give you a better idea of the problem rather than "syntax error on the INSERT INTO".

Cheyney
 
Thanks Cheyney,

Where would I find the query analyzer?
Mary :)

Violence begets Violence
Let's Give Peace a Chance!!
 
It should have been installed with your sql server client tools. If you don't have these, i don't think they're free (anymore? or maybe they never were...). If you have enterprise manager, you should have query analyser.

I think theres a free program microsoft provides called "microsoft query" or something? it may even be included with office, i think i've seen someone run queries from excel.

cheyney
 
Query Analyzer is a SQL Server tool but since it looks like you are using Access then you can't really use that! ;-)

I noticed that you have specified one more column in the list than you have values. It looks like you have missed a date off the end of the value list.

Also, if this was just a typo, it may not be liking the empty strings you are trying to pass. Try using NULL if you don't want a value in a particular column. --James
 
I'm using Access 2000, not SQL Server (I wish!).

I'll hunt around for it.

Thanks! Mary :)

Violence begets Violence
Let's Give Peace a Chance!!
 
ack, sorry, i'm used to posting in the sql server forum. I was wondering what those #'s were doing around your date :)

cheyney
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top