Author |
Topic |
shoxxbinoxx
Starting Member
2 Posts |
Posted - 2010-08-17 : 16:39:15
|
I am trying to insert all of the data from one table into another by using the following query:INSERT INTO LeadTemplate (phone, firstname, lastname, address, city, state, zip, e-mail, eventname, eventdate)SELECT *FROM _tempImportwhen i try to parse the query i get "Line 1: Incorrect syntax near '-'." I have already checked to make sure the column name in LeadTemplate is "e-mail" with the dash in it. Does anyone know whats causing this error? |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2010-08-17 : 16:43:26
|
INSERT INTO LeadTemplate (phone, firstname, lastname, address, city, state, zip, [e-mail], eventname, eventdate)SELECT *FROM _tempImport N 56°04'39.26"E 12°55'05.63" |
|
|
shoxxbinoxx
Starting Member
2 Posts |
Posted - 2010-08-17 : 16:47:15
|
thank you! |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2010-08-18 : 11:19:56
|
It is better to make use of underscore (_) instead of hephen (-)MadhivananFailing to plan is Planning to fail |
|
|
X002548
Not Just a Number
15586 Posts |
Posted - 2010-08-18 : 11:39:44
|
<biatch slap>quote: Originally posted by Peso INSERT INTO LeadTemplate (phone, firstname, lastname, address, city, state, zip, [e-mail], eventname, eventdate)SELECT *FROM _tempImport N 56°04'39.26"E 12°55'05.63"
</biatch slap>INSERT INTO LeadTemplate ( phone, firstname, lastname, address, city, state, zip, [e-mail], eventname, eventdate)SELECT phone, firstname, lastname, address, city, state, zip, [e-mail], eventname, eventdate FROM [_tempImport] Brett8-)Hint: Want your questions answered fast? Follow the direction in this linkhttp://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspxAdd yourself!http://www.frappr.com/sqlteam |
|
|
Lamprey
Master Smack Fu Yak Hacker
4614 Posts |
Posted - 2010-08-18 : 15:08:20
|
quote: Originally posted by X002548 FROM [_tempImport]
Why the square brackets around the table name? |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2010-08-18 : 23:13:41
|
quote: Originally posted by Lamprey
quote: Originally posted by X002548 FROM [_tempImport]
Why the square brackets around the table name?
It is not a must, but probably just a personal taste or weird to see a table name prefix with a "_" KH[spoiler]Time is always against us[/spoiler] |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2010-08-19 : 03:23:05
|
Better a underscore than a space! Took me a while to find that out with another problem... N 56°04'39.26"E 12°55'05.63" |
|
|
Kristen
Test
22859 Posts |
Posted - 2010-08-19 : 03:59:14
|
Table name STARTED with a space? I could use that ... |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2010-08-19 : 06:20:45
|
The benefit of creating tables with dynamic sql code... N 56°04'39.26"E 12°55'05.63" |
|
|
|