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.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Syntax error with LEFT function

Author  Topic 

taraernst
Starting Member

9 Posts

Posted - 2006-09-12 : 11:26:29
I am trying to run the following in Query Analyzer and receiving the error: 'Incorrect syntax near the keyword 'LEFT'.'

INSERT INTO tblFinalStdLead
(name1,name2,fname,lname,address1,address2,city,state,zip_9,phone,cisphone,casphone,hh_key,custno,camp_code,campaign,mail_drop,call_start,call_end,offer_no,offer_na,offer_desc,bank,branch,officer,product2,prod2_desc,product3,prod3_desc,priority,sort,account_no,balance,bal_date,winocall,fednocall,monocall,flnocall,option1,option2,option3,option4,option5,option6,option7,option8,discode,mrkt_link_no,LEFT(phone,3)as PhoneAreaCode)

SELECT * FROM dbo.tblStdLead

Any suggestions? Can you use the LEFT function with an INSERT INTO statement?

Luis Martin
Yak Posting Veteran

54 Posts

Posted - 2006-09-12 : 11:32:28
I'm not expert developer, but no need a black between 3)as.
Or is a copy mistake?
Go to Top of Page

TG
Master Smack Fu Yak Hacker

6065 Posts

Posted - 2006-09-12 : 11:34:45
The columnList of your INSERT statement can only be a...list of columns.

perhaps you intended to use the LEFT function in the ColumnList of your SELECT statement.

Be One with the Optimizer
TG
Go to Top of Page

taraernst
Starting Member

9 Posts

Posted - 2006-09-12 : 11:35:41
Removing the ')' does not correct the error....
Go to Top of Page

Luis Martin
Yak Posting Veteran

54 Posts

Posted - 2006-09-12 : 11:38:20
So, what TG said is the problem.
Go to Top of Page

taraernst
Starting Member

9 Posts

Posted - 2006-09-12 : 11:38:54
TG -

Yes, that makes perfect sense and thank you!
Go to Top of Page
   

- Advertisement -