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 2008 Forums
 Transact-SQL (2008)
 Incorrect syntax near the keyword 'and'

Author  Topic 

fholemans
Starting Member

12 Posts

Posted - 2012-10-18 : 10:04:03
Hello Everybody,

I'm making some modifications on a database and I have a problem when I write this query :

Update tblFactMGMTAPP
SET M_ACCOUNT='M801' and DIRECTIONS='DIR_MAG'
WHERE PISTES='PIMFR' and TIMEID='20120600' and GROUPS='LC'

When I push execute, I received the message: 'Incorrect Syntax near the Keyword 'and' (in bold). So I don't understand why despite this simple query.

Sorry if the solution is easy but it's my first time that I write queries in SQL Server. So I'm not familiar with it yet.

Thanks in advance,

François


sunitabeck
Master Smack Fu Yak Hacker

5155 Posts

Posted - 2012-10-18 : 10:08:45
Separate the list of columns you want to set using comma's rather than AND's.
Update tblFactMGMTAPP
SET M_ACCOUNT='M801', DIRECTIONS='DIR_MAG'
WHERE PISTES='PIMFR' and TIMEID='20120600' and GROUPS='LC'
Go to Top of Page

fholemans
Starting Member

12 Posts

Posted - 2012-10-18 : 10:35:27
Thanks a lot, it works now
Go to Top of Page

sunitabeck
Master Smack Fu Yak Hacker

5155 Posts

Posted - 2012-10-18 : 11:02:39
very welcome :)
Go to Top of Page
   

- Advertisement -