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)
 Question on LEFT function

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2006-09-13 : 06:31:40
Tara writes "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?"

chiragkhabaria
Master Smack Fu Yak Hacker

1907 Posts

Posted - 2006-09-13 : 06:32:54
you can not use the Left in the insert statement.

Chirag
Go to Top of Page

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2006-09-13 : 06:56:54
Unfortunately, databases are not that smart currently !

You will have to do that in the SELECT statement

Harsh Athalye
India.
"Nothing is Impossible"
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-09-13 : 10:29:53
You cant specify the column with LEFT as you used. You can do

Insert into table(columns)
Select value1,value2,...LEFT(value10,3),..


Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -