Syntax error in update statement

I using Visual Basic 2010 and MS Access 2010 database. My OS is Windows7. In my earlier complaint I had my database stored on root drive C: I changed that and the program worked fine. Using the exact same code I wrote another program using a different database, now I get an error stating "Syntax error in UPDATE statement", the only thing I did was change the name of the database. Again, Please Help.
  • Remove From My Forums
  • Question

  • I using Visual Basic 2010 and MS Access 2010 database. My OS is Windows7. In my earlier complaint I had my database stored on root drive C: I changed that and the program worked fine. Using the exact same code I wrote another program using a different
    database, now I get an error stating «Syntax error in UPDATE statement», the only thing I did was change the name of the database. Again, Please Help.

    Public Class Form1
    
        Dim inc As Integer
        Dim MaxRows As Integer
        Dim con As New OleDb.OleDbConnection
        Dim dbProvider As String
        Dim dbSource As String
        Dim ds As New DataSet
        Dim da As New OleDb.OleDbDataAdapter
        Dim sql As String
    
    
        Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
    
            dbProvider = "PROVIDER=Microsoft.Jet.OLEDB.4.0;"
            dbSource = "Data Source = C:DataBaseIIAddressBook1.mdb"
    
            con.ConnectionString = dbProvider & dbSource
    
            con.Open()
    
            sql = "SELECT * FROM tblContacts"
            da = New OleDb.OleDbDataAdapter(sql, con)
            da.Fill(ds, "Addressbook1")
    
            'MsgBox("Database is Open")
    
            con.Close()
    
            MaxRows = ds.Tables("AddressBook1").Rows.Count
            inc = -1
    
            'MsgBox("Database is Close")
    
        End Sub
    
        Private Sub NavigateRecords()
    
            txtFirstName.Text = ds.Tables("AddressBook1").Rows(inc).Item(1)
            txtLastName.Text = ds.Tables("AddressBook1").Rows(inc).Item(2)
            txtAddress1.Text = ds.Tables("AddressBook1").Rows(inc).Item(3)
            txtAddress2.Text = ds.Tables("AddressBook1").Rows(inc).Item(4)
            txtAddress3.Text = ds.Tables("AddressBook1").Rows(inc).Item(5)
            txtPostCode.Text = ds.Tables("AddressBook1").Rows(inc).Item(6)
        End Sub
    
        Private Sub btnNext_Click(sender As System.Object, e As System.EventArgs) Handles btnNext.Click
    
            If inc <> MaxRows - 1 Then
                inc = inc + 1
                NavigateRecords()
            Else
                MsgBox("No More Rows")
            End If
    
        End Sub
    
        Private Sub btnPrevious_Click(sender As System.Object, e As System.EventArgs) Handles btnPrevious.Click
    
            If inc > 0 Then
                inc = inc - 1
                NavigateRecords()
            Else
                MsgBox("First Record")
            End If
    
        End Sub
    
        Private Sub btnLast_Click(sender As System.Object, e As System.EventArgs) Handles btnLast.Click
    
            If inc <> MaxRows - 1 Then
                inc = MaxRows - 1
                NavigateRecords()
            End If
    
        End Sub
    
        Private Sub btnFirst_Click(sender As System.Object, e As System.EventArgs) Handles btnFirst.Click
    
            If inc <> 0 Then
                inc = 0
                NavigateRecords()
            End If
    
        End Sub
    
        Private Sub btnUpdate_Click(sender As System.Object, e As System.EventArgs) Handles btnUpdate.Click
    
            Dim cb As New OleDb.OleDbCommandBuilder(da)
    
            ds.Tables("AddressBook1").Rows(inc).Item(1) = txtFirstName.Text
            ds.Tables("AddressBook1").Rows(inc).Item(2) = txtLastName.Text
            ds.Tables("AddressBook1").Rows(inc).Item(3) = txtAddress1.Text
            ds.Tables("AddressBook1").Rows(inc).Item(4) = txtAddress2.Text
            ds.Tables("AddressBook1").Rows(inc).Item(5) = txtAddress3.Text
            ds.Tables("AddressBook1").Rows(inc).Item(6) = txtPostCode.Text
    
            Try
                da.Update(ds, "AddressBook1")
            Catch ex As Exception
                MessageBox.Show(ex.ToString)
            End Try
    
    
            MsgBox("Data updated")
    
        End Sub
    
    Exception:
    
    ---------------------------
    
    ---------------------------
    System.Data.OleDb.OleDbException (0x80040E14): Syntax error in UPDATE statement.
    
       at System.Data.Common.DbDataAdapter.UpdatedRowStatusErrors(RowUpdatedEventArgs rowUpdatedEvent, BatchCommandInfo[] batchCommands, Int32 commandCount)
    
       at System.Data.Common.DbDataAdapter.UpdatedRowStatus(RowUpdatedEventArgs rowUpdatedEvent, BatchCommandInfo[] batchCommands, Int32 commandCount)
    
       at System.Data.Common.DbDataAdapter.Update(DataRow[] dataRows, DataTableMapping tableMapping)
    
       at System.Data.Common.DbDataAdapter.UpdateFromDataTable(DataTable dataTable, DataTableMapping tableMapping)
    
       at System.Data.Common.DbDataAdapter.Update(DataSet dataSet, String srcTable)
    
       at DataBaseII.Form1.btnUpdate_Click(Object sender, EventArgs e) in C:DataBaseIIDataBaseIIForm1.vb:line 99
    ---------------------------
    OK   
    ---------------------------
    
    • Edited by

      Tuesday, September 13, 2011 6:19 AM

Answers

  • Not so strange as this code you show is for Access 2003 (I see you have edited your question, Paul, Andrew and Mike see this direct and probably even I would have seen that direct)

    dbProvider = «PROVIDER=Microsoft.Jet.OLEDB.4.0;»

    So all of us have assumed it was Jet (Access 2003)

    Change your connectionstring accoording to Access 2007/2010

    http://www.connectionstrings.com/access-2007



    Success
    Cor

    • Edited by
      Cor Ligthert
      Tuesday, September 13, 2011 8:17 AM
    • Proposed as answer by
      Mike Feng
      Wednesday, September 14, 2011 7:03 AM
    • Marked as answer by
      Mike Feng
      Tuesday, September 27, 2011 11:07 AM

See more:

hi
i have «(Syntax error in UPDATE statement.)» when I updating the record in access database by c# source code:

OleDbConnection connect = new OleDbConnection(@"path.mdb");
           OleDbCommand cmd = new OleDbCommand();

               cmd.CommandType = CommandType.Text;
               cmd.CommandText = "UPDATE Table2 set check=2 whene key=asd ";
               cmd.Connection = connect;
               connect.Open();
               cmd.ExecuteNonQuery();
               connect.Close();

thank you for solution my problems


Your keyword is incorrect .

It should be where instead of whene.
Also When you are using string in where clause, it should be written in single quotes.
like ‘asd’ instead of asd

cmd.CommandText = "UPDATE Table2 set check='2' where key='asd'";

Please check following line and update it.

Please define the datatype of field check and key.

cmd.CommandText = "UPDATE Table2 set check='2' where key='asd' ";

Thanks
Ashish

why are you giving check value in quotes.Try giving lik this in your code.

cmd.CommandText = "UPDATE Table2 set check=2 where  key='"+richTextBox2.Text+"' ";

I had the same problem long back, i added textbaox1.text.tostring(); it works fine.

in your code also use richTextBox2.Text.tostring();

I am also getting same error syntax error in update command. . .I am using 64 bit win 8.1 operating system. . . all other commands are executing except update. . please try to solve my problem. .

String str = «update transaction_tab set desc = ‘updated’ where tcode = ‘JV'»;

Cmd = oledbCommand(str,con);
Cmd.ExecuteNonQuery();

Updated 18-Jun-15 19:54pm

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  • Home
  • VBForums
  • Visual Basic
  • Visual Basic .NET
  • VS 2010 [RESOLVED] «Syntax error in Update statement»

  1. Oct 14th, 2011, 10:07 AM


    #1

    paulorton is offline

    Thread Starter


    Fanatic Member

    paulorton's Avatar


    Resolved [RESOLVED] «Syntax error in Update statement»

    Code:

    SQL = "SELECT * FROM [" & WorkHistory_tablename & "] ORDER BY DateOfWork asc"
            ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=False;Data Source=" & My.Settings.AppPath & "" & gWorkingCentre & "_FCLManager2011_Students.mdb"
            Conn = New OleDbConnection(ConnectionString)
            Dim da As New OleDbDataAdapter(SQL, Conn)
    
            da.UpdateCommand = New OleDbCommand("UPDATE [" & WorkHistory_tablename & "] SET Worksheet = @Worksheet, WorksheetID = @WorksheetID, NumQuestions = @NumQuestions, Tries = @Tries, TopicName = @TopicName, NumSheets = @NumSheets, Errors = @Errors, Percentage = @Percentage, Time_taken = @Time_taken, OralTopic = @OralTopic, OralErrors = @OralErrors, OralTime = @OralTime, Mastered = @Mastered, HomeComment = @HomeComment, InstructorNotes = @InstructorNotes, Parent/StudentComment = @Parent/StudentComment, InstructorComments = @InstructorComments WHERE DateOfWork = @DateOfWork")
            da.UpdateCommand.Connection = Conn
    
            da.UpdateCommand.Parameters.Add("@Worksheet", OleDbType.VarChar, 150, "Worksheet")
            da.UpdateCommand.Parameters.Add("@WorksheetID", OleDbType.Integer, 5, "WorksheetID")
            da.UpdateCommand.Parameters.Add("@NumQuestions", OleDbType.TinyInt, 3, "NumQuestions")
            da.UpdateCommand.Parameters.Add("@Tries", OleDbType.TinyInt, 3, "Tries")
            da.UpdateCommand.Parameters.Add("@TopicName", OleDbType.VarChar, 150, "TopicName")
            da.UpdateCommand.Parameters.Add("@NumSheets", OleDbType.TinyInt, 2, "NumSheets")
            da.UpdateCommand.Parameters.Add("@Errors", OleDbType.TinyInt, 3, "Errors")
            da.UpdateCommand.Parameters.Add("@Percentage", OleDbType.TinyInt, 3, "Percentage")
            da.UpdateCommand.Parameters.Add("@Time_taken", OleDbType.TinyInt, 3, "Time_taken")
            da.UpdateCommand.Parameters.Add("@OralTopic", OleDbType.VarChar, 50, "OralTopic")
            da.UpdateCommand.Parameters.Add("@OralErrors", OleDbType.TinyInt, 3, "OralErrors")
            da.UpdateCommand.Parameters.Add("@OralTime", OleDbType.TinyInt, 3, "OralTime")
            da.UpdateCommand.Parameters.Add("@Mastered", OleDbType.Boolean, 1, "Mastered")
            da.UpdateCommand.Parameters.Add("@HomeComment", OleDbType.VarChar, 150, "HomeComment")
            da.UpdateCommand.Parameters.Add("@InstructorNotes", OleDbType.VarChar, 150, "InstructorNotes")
            da.UpdateCommand.Parameters.Add("@Parent/StudentComment", OleDbType.VarChar, 150, "Parent/StudentComment")
            da.UpdateCommand.Parameters.Add("@InstructorComments", OleDbType.VarChar, 255, "InstructorComments")
            da.UpdateCommand.Parameters.Add("@DateOfWork", OleDbType.DBDate, 0, "DateOfWork")

    I must have spent 2-3 hours wrestling with this and I still can’t find my mistake….

    Oh, and I *have* put the fields in the same order in both places — and I’m as certain as I can be that there are no typos.

    Paul Orton
    VB6
    Visual Web Developer 2008 Express Edition
    Microsoft Visual Basic 2012 Express


  2. Oct 14th, 2011, 10:12 AM


    #2

    Re: «Syntax error in Update statement»

    table name won’t be in double quotes, write it simple.


  3. Oct 14th, 2011, 10:54 AM


    #3

    Re: «Syntax error in Update statement»

    Check your field names… the name Parent/StudentComment is not valid, and it is possible that others (such as Errors and Percentage) are Reserved words.

    If you change the name(s) in the database and your code, it is likely to work correctly.

    For more information (including lists of Reserved words), see the article What names should I NOT use for tables/fields/views/stored procedures/…? from our Database Development FAQs/Tutorials (at the top of the Database Development forum)


  4. Oct 14th, 2011, 11:06 AM


    #4

    paulorton is offline

    Thread Starter


    Fanatic Member

    paulorton's Avatar


    Re: «Syntax error in Update statement»

    Quote Originally Posted by si_the_geek
    View Post

    Check your field names… the name Parent/StudentComment is not valid, and it is possible that others (such as Errors and Percentage) are Reserved words.

    Why isn’t Parent/StudentComment valid? It’s OK in the Access table itself. I’ve already changed Time and Try so I’ll change the others you mention, too.

    Paul Orton
    VB6
    Visual Web Developer 2008 Express Edition
    Microsoft Visual Basic 2012 Express


  5. Oct 14th, 2011, 11:19 AM


    #5

    paulorton is offline

    Thread Starter


    Fanatic Member

    paulorton's Avatar


    Re: «Syntax error in Update statement»

    Quote Originally Posted by Aash
    View Post

    table name won’t be in double quotes, write it simple.

    It’s a variable containing the table name — the problem isn’t there, I’m almost certain — but thanks for your help anyway!

    Paul Orton
    VB6
    Visual Web Developer 2008 Express Edition
    Microsoft Visual Basic 2012 Express


  6. Oct 14th, 2011, 11:26 AM


    #6

    Re: «Syntax error in Update statement»

    Quote Originally Posted by paulorton
    View Post

    Why isn’t Parent/StudentComment valid? It’s OK in the Access table itself. I’ve already changed Time and Try so I’ll change the others you mention, too.

    Access may think it’s valid, but SQL doesn’t necessarily ….

    think about it…

    select a, b, c/d from sometable

    is that c divided by d? or a field c/d? no way to know for sure… samething happens when you use spaces in table and field names…

    select a, b, c from some table where x=y

    you can get around this by 1) taking this into consideration when designing your tables and not doing this in the first place (for which there really is no reason to) or 2) by using object identifiers…

    select a, b, [c/d] from someTable
    select a, b, c from [some table] where x = y

    while this works, it’s generally considered bad design, as I said before, there is almost no reason to have names that cause conflicts in the first place.

    -tg


  7. Oct 14th, 2011, 11:29 AM


    #7

    paulorton is offline

    Thread Starter


    Fanatic Member

    paulorton's Avatar


    Re: «Syntax error in Update statement»

    I’ve changed those names but still no joy…

    Code:

    SQL = "SELECT * FROM [" & WorkHistory_tablename & "] ORDER BY DateOfWork asc"
            ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=False;Data Source=" & My.Settings.AppPath & "" & gWorkingCentre & "_FCLManager2011_Students.mdb"
            Conn = New OleDbConnection(ConnectionString)
            Dim da As New OleDbDataAdapter(SQL, Conn)
    
            da.UpdateCommand = New OleDbCommand("UPDATE [" & WorkHistory_tablename & "] SET Worksheet = @Worksheet, WorksheetID = @WorksheetID, NumQuestions = @NumQuestions, Tries = @Tries, TopicName = @TopicName, NumSheets = @NumSheets, Mistakes = @Mistakes, Percent = @Percent, Time_taken = @Time_taken, OralTopic = @OralTopic, OralErrors = @OralErrors, OralTime = @OralTime, Mastered = @Mastered, HomeComment = @HomeComment, InstructorNotes = @InstructorNotes, ParentStudentComment = @ParentStudentComment, InstructorComments = @InstructorComments WHERE DateOfWork = @DateOfWork")
            da.UpdateCommand.Connection = Conn
    
            da.UpdateCommand.Parameters.Add("@Worksheet", OleDbType.VarChar, 150, "Worksheet")
            da.UpdateCommand.Parameters.Add("@WorksheetID", OleDbType.Integer, 5, "WorksheetID")
            da.UpdateCommand.Parameters.Add("@NumQuestions", OleDbType.TinyInt, 3, "NumQuestions")
            da.UpdateCommand.Parameters.Add("@Tries", OleDbType.TinyInt, 3, "Tries")
            da.UpdateCommand.Parameters.Add("@TopicName", OleDbType.VarChar, 150, "TopicName")
            da.UpdateCommand.Parameters.Add("@NumSheets", OleDbType.TinyInt, 2, "NumSheets")
            da.UpdateCommand.Parameters.Add("@Mistakes", OleDbType.TinyInt, 3, "Mistakes")
            da.UpdateCommand.Parameters.Add("@Percent", OleDbType.TinyInt, 3, "Percent")
            da.UpdateCommand.Parameters.Add("@Time_taken", OleDbType.TinyInt, 3, "Time_taken")
            da.UpdateCommand.Parameters.Add("@OralTopic", OleDbType.VarChar, 50, "OralTopic")
            da.UpdateCommand.Parameters.Add("@OralErrors", OleDbType.TinyInt, 3, "OralErrors")
            da.UpdateCommand.Parameters.Add("@OralTime", OleDbType.TinyInt, 3, "OralTime")
            da.UpdateCommand.Parameters.Add("@Mastered", OleDbType.Boolean, 1, "Mastered")
            da.UpdateCommand.Parameters.Add("@HomeComment", OleDbType.VarChar, 150, "HomeComment")
            da.UpdateCommand.Parameters.Add("@InstructorNotes", OleDbType.VarChar, 150, "InstructorNotes")
            da.UpdateCommand.Parameters.Add("@ParentStudentComment", OleDbType.VarChar, 150, "ParentStudentComment")
            da.UpdateCommand.Parameters.Add("@InstructorComments", OleDbType.VarChar, 255, "InstructorComments")
            da.UpdateCommand.Parameters.Add("@DateOfWork", OleDbType.DBDate, 0, "DateOfWork")

    Paul Orton
    VB6
    Visual Web Developer 2008 Express Edition
    Microsoft Visual Basic 2012 Express


  8. Oct 14th, 2011, 11:35 AM


    #8

    paulorton is offline

    Thread Starter


    Fanatic Member

    paulorton's Avatar


    Re: «Syntax error in Update statement»

    Not directly related but how would I use one of the fields if I wanted to change it to type «Memo»? I know that this is OleDbType.LongVarWChar but what column length should I give it?

    Paul Orton
    VB6
    Visual Web Developer 2008 Express Edition
    Microsoft Visual Basic 2012 Express


  9. Oct 14th, 2011, 11:36 AM


    #9

    Re: «Syntax error in Update statement»

    Since when you are using parameter it is hard to see the actual SQL that is being used, I would temporarly re-write the Update statement to use string building and use the values to be processed directly. I would then display the actuall SQL that is generated to check for errors. Once I had it worked out I would go back to using parameters.

    Sometimes the Programmer
    Sometimes the DBA

    Mazz1


  10. Oct 14th, 2011, 11:40 AM


    #10

    Re: «Syntax error in Update statement»

    If you are using Oledb parameter with Access then the parameters are to be specified with ? not @ symbol.

    And the sql should be like

    Code:

     da.UpdateCommand = New OleDbCommand("UPDATE [" & WorkHistory_tablename & "] SET Worksheet = ?, WorksheetID = ?, NumQuestions = ?
    
    
    da.UpdateCommand.Parameters.Add("@Worksheet", OleDbType.VarChar, 150, "Worksheet")

    Please mark you thread resolved using the Thread Tools as shown


  11. Oct 14th, 2011, 11:44 AM


    #11

    paulorton is offline

    Thread Starter


    Fanatic Member

    paulorton's Avatar


    Re: «Syntax error in Update statement»

    Quote Originally Posted by GaryMazzone
    View Post

    Since when you are using parameter it is hard to see the actual SQL that is being used, I would temporarly re-write the Update statement to use string building and use the values to be processed directly. I would then display the actuall SQL that is generated to check for errors. Once I had it worked out I would go back to using parameters.

    If I pause the code I find that da.UpdateCommand contains:

    UPDATE [M_GriffithsBen_9] SET Worksheet = @Worksheet, WorksheetID = @WorksheetID, NumQuestions = @NumQuestions, Tries = @Tries, TopicName = @TopicName, NumSheets = @NumSheets, Mistakes = @Mistakes, Percent = @Percent, Time_taken = @Time_taken, OralTopic = @OralTopic, OralErrors = @OralErrors, OralTime = @OralTime, Mastered = @Mastered, HomeComment = @HomeComment, InstructorNotes = @InstructorNotes, ParentStudentComment = @ParentStudentComment, InstructorComments = @InstructorComments WHERE DateOfWork = @DateOfWork

    It’s quite easy to check this against my parameter list (and the fields in the actual table).

    Paul Orton
    VB6
    Visual Web Developer 2008 Express Edition
    Microsoft Visual Basic 2012 Express


  12. Oct 14th, 2011, 11:47 AM


    #12

    paulorton is offline

    Thread Starter


    Fanatic Member

    paulorton's Avatar


    Re: «Syntax error in Update statement»

    Quote Originally Posted by danasegarane
    View Post

    If you are using Oledb parameter with Access then the parameters are to be specified with ? not @ symbol.

    I thought they were interchangeable — I’ve successfully used @ everywhere else in my code.

    Paul Orton
    VB6
    Visual Web Developer 2008 Express Edition
    Microsoft Visual Basic 2012 Express


  13. Oct 14th, 2011, 12:09 PM


    #13

    Re: «Syntax error in Update statement»

    A quick check shows that Percentage is not a reserved word , but Percent (which you changed it to ) is reserved — thus it will be a cause of this problem.


  14. Oct 14th, 2011, 12:12 PM


    #14

    Re: «Syntax error in Update statement»

    That does not show what is being passed in to the database

    Sometimes the Programmer
    Sometimes the DBA

    Mazz1


  15. Oct 14th, 2011, 12:13 PM


    #15

    paulorton is offline

    Thread Starter


    Fanatic Member

    paulorton's Avatar


    Re: «Syntax error in Update statement»

    Eureka! Thanks, Si, and everyone else who chipped in!

    Paul Orton
    VB6
    Visual Web Developer 2008 Express Edition
    Microsoft Visual Basic 2012 Express


  16. May 2nd, 2014, 11:19 PM


    #16

    iamlrac is offline


    Registered User


    Re: «Syntax error in Update statement»

    help me to this sir . same in syntax error in update statement

    Private Sub UpdateItem()
    txtRemarks.Text = txtRemarks.Text.Replace(«,», «»)
    Try
    sqL = «UPDATE [Item] SET ItemCode = ‘» & txtItemCode.Text & «‘,'» & «‘, iDescription ='» & txtDescription.Text & «‘, iSize ='» & txtSize.Text & «‘, Remarks = ‘» & txtRemarks.Text & «‘, StockOnHand = ‘» & txtQuantity.Text & «‘,'» & «‘ WHERE ItemNo = » & txtItemNo.Text & «»
    ConnDB()
    cmd = New OleDbCommand(sqL, conn)
    Dim i As Integer
    i = cmd.ExecuteNonQuery
    If i > 0 Then
    MsgBox(«Item Updated», MsgBoxStyle.Information, «Update Item»)
    Else
    MsgBox(«Failed to update item», MsgBoxStyle.Information, «Update Item»)
    End If
    Catch ex As Exception
    MsgBox(ex.Message)
    Finally
    cmd.Dispose()
    conn.Close()
    End Try
    End Sub


  17. May 3rd, 2014, 09:09 AM


    #17

    Re: [RESOLVED] «Syntax error in Update statement»

    Welcome to VBForums

    While you may have the same error message as the original poster, your issue is not really related to the original issue — so please create a new thread. That way more people will read it (so you are more likely to get help), and they wont have to read old posts before seeing your question. Doing that also means that you don’t annoy the people who have subscribed to the thread (which is not limited to the people who have posted), who get email notification of your post.

    To create a new thread, go to one of our forums (in this case Visual Basic.Net or Database Development ), and click on «New Thread».

    Note that there is at least one issue in your code that would cause the error (an extra ‘ ), and that can be solved (along with several other issues) by using Parameters.

    For an explanation of why you should be using parameters (and links to code examples), see the article Why should I use Parameters instead of putting values into my SQL string? from our Database Development FAQs/Tutorials (at the top of the Database Development forum).


  • Home
  • VBForums
  • Visual Basic
  • Visual Basic .NET
  • VS 2010 [RESOLVED] «Syntax error in Update statement»


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
  • BB code is On
  • Smilies are On
  • [IMG] code is On
  • [VIDEO] code is On
  • HTML code is Off

Forum Rules


Click Here to Expand Forum to Full Width

INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Thanks. We have received your request and will respond promptly.

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!

  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It’s Free!

*Tek-Tips’s functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Syntax error in update statement

Syntax error in update statement

(OP)

21 Dec 04 09:20

Hi all.

I’m a bit stuck on this problem i’m having with my update-query.

I’ve tried my best to write an sql query to update the fields of one table with the value of fields in another table, but i keep on receiving this annoying «syntax error in update statement».

Is there somebody who can help me out with this issue please?

This is what i’ve accomplished so far:

UPDATE SortedFullExcelList p
SET p.Itemnumber = (SELECT n.Itemnumber FROM FullExcelList n WHERE n.id = p.id),
SET p.ItemDescription = (SELECT n.ItemDescription FROM FullExcelList n WHERE n.id = p.id),
SET p.ItemType = (SELECT n.ItemType FROM FullExcelList n WHERE n.id = p.id),
SET p.Download = (SELECT n.Download FROM FullExcelList n WHERE n.id = p.id)

Uhm…any idea’s?

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Join Tek-Tips® Today!

Join your peers on the Internet’s largest technical computer professional community.
It’s easy to join and it’s free.

Here’s Why Members Love Tek-Tips Forums:

  • Tek-Tips ForumsTalk To Other Members
  • Notification Of Responses To Questions
  • Favorite Forums One Click Access
  • Keyword Search Of All Posts, And More…

Register now while it’s still free!

Already a member? Close this window and log in.

Join Us             Close

Понравилась статья? Поделить с друзьями:
  • Syntax error in sql expression
  • Syntax error in program sap
  • Syntax error in number in query expression
  • Syntax error in from clause
  • Syntax error in data declaration at 1