Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
DB Engine
SQL ServerMSDESQL Server CE
Services
Analysis (Data Mining)Analysis (OLAP)DTSIntegration ServicesNotification ServicesReporting Services
Programming
CLRConnectivitySQLXML
Other Technologies
ClusteringEnglish QueryFull-Text SearchReplicationService Broker
General
Data WarehousingPerformanceSecuritySetupSQL Server ToolsOther SQL Server Topics
DirectoryUser Groups
Related Topics
MS AccessOther DB ProductsMS Server Products.NET DevelopmentVB DevelopmentJava DevelopmentMore Topics ...

SQL Server Forum / Programming / SQL / July 2008

Tip: Looking for answers? Try searching our database.

What's wrong with the code

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jack - 18 Jul 2008 23:50 GMT
DECLARE @TranName VARCHAR(20)
SELECT @TranName = 'MyTransaction'
BEGIN TRANSACTION @TranName
GO
USE ts2_aldkt_app
GO
update tblcustomer
set sales_ytd = (sales_ytd + 10000)
set sales_lstyr = (sales_lstyr +  10000)
GO
COMMIT TRANSACTION MyTransaction
GO

I am getting the following error:
Line 1: Incorrect syntax near '='.
Any help is appreciated
Plamen Ratchev - 19 Jul 2008 00:03 GMT
Your update statement has two SET clauses, it has to be only one:

UPDATE tblcustomer
SET sales_ytd = (sales_ytd + 10000),
    sales_lstyr = (sales_lstyr +  10000);

HTH,

Plamen Ratchev
http://www.SQLStudio.com
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.