INSERT INTO Checkout(ProductID, MemberID, Quantity) 
  SELECT ProductID, MemberID, Quantity 
    FROM Cart 
    WHERE (MemberID = MemberID) 
  DELETE FROM CART WHERE (MemberID = MemberID)

The sql statement is workable before the Choose, WHERE part but when I add the remove statement then your error (syntax error missing operator in query expression) arrives. Zhe second MemberID is really a value I gave for first MemberID parameter. Please assist me to to resolve this as once i transfer the information from first table to second table then I have to remove the information from first table.

[Edit] Because of all of you suggestions and today i recognized that for WHERE (MemberID = MemberID) will import entire table to new table which statement will also remove the whole table contents. So what can i actually do to make certain the sql statement only remove the particulars people item?

Primary Page>Member login page>Buy something>Item saved in shopping cart software database (with member id)>display only particular member's bought item in shopping cart> go to checkout(only display that member item,remove shopping cart software item)

The issue is using the second "MemberID". This must be a continuing or possess a variable title that does not conflict using the area title. Numerous approaches for disambiguation are proven inside a related SO publish: How do you avoid column name conflicts?

You did not mention what version of SQL Server you are using - however, you might have the ability to make use of the [cde] clause for that OUTPUT statement to attain what you are searching for. The DELETE clause has been around since SQL Server 2005, therefore if you are on 2005 or more recent, this code snippet should meet your needs:

Do this:

OUTPUT

Essentially this runs the DELETE FROM dbo.CART OUTPUT deleted.ProductID, deleted.MemberID, deleted.Quantity INTO dbo.Checkout(ProductID, MemberID, Quantity) WHERE MemberID = @MemberID statement against your DELETE table, also it captures what rows happen to be erased individuals are then consequently placed in to the dbo.Cart table.

Also - that symptom in the dbo.Checkout clause appears quite funny - essentially, this can choose and therefore remove all rows out of your table......

Update: I am presuming you in some way keep relevant member's ID in WHERE and employ that to choose the rows to remove in the @MemberID table..

Store your passing data to some recently declared variable and employ that variable to everywhere as below, this works fine, thanks

dbo.Cart