“Mise à jour SQL” Réponses codées

Mise à jour SQL de Select

UPDATE YourTable 
SET Col1 = OtherTable.Col1, 
    Col2 = OtherTable.Col2 
FROM (
    SELECT ID, Col1, Col2 
    FROM other_table) AS OtherTable
WHERE 
    OtherTable.ID = YourTable.ID
Ankur

Comment modifier la valeur d'une table dans SQL

UPDATE employees 
SET 
    address = '1300 Carter St',
    city = 'San Jose',
    postalcode = 95125,
    region = 'CA'
WHERE
    employeeID = 3;
Friendly Fox

Mise à jour SQL

UPDATE Table_name
-- The desired value
SET Column_name = desired_value
-- Any value, of the item, of which one value you want to change
WHERE Column_name = value
ASP

Mise à jour SQL

UPDATE sakila.actor  # table to update
SET first_name = "Bryan", last_name = "Besmond"   # fields to be added/updated
WHERE actor_id = 201;   # boolean condition
Scary Salamander

Mise à jour SQL

private void btnUpdateData_Click(object sender, EventArgs e)
       {
               try
               {
                   SqlComm = new SqlCommand("UPDATE MyDataTable ('DataDesc', 'DataDate', 'DataQty') VALUES ('@DataDesc', '@DataDate', '@DataQty') WHERE DataID ='@DataID'", SqlConn);
                   SqlComm.Parameters.AddWithValue("@DataID", txtDataID.Text);
                   SqlComm.Parameters.AddWithValue("@DataDesc", txtDataDesc.Text);
                   SqlComm.Parameters.AddWithValue("@DataQty", int.Parse(txtDataQty.Text));
                   SqlComm.Parameters.AddWithValue("@DataDate", dtpDataDate.Value);
                   SqlComm.ExecuteNonQuery();

                   MessageBox.Show("Data updated!", "DB Connection With App.Config", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);

                   Clear();
                   DisableButtons();
               }
               catch (Exception ex)
               {
                   MessageBox.Show(ex.Message);
               }
           }
Curious Cassowary

Mise à jour SQL

UPDATE computer SET cores = {}, cpu_speed = {}, ram = {}, cost = {} WHERE name = '{}'
Curious Cockroach

Réponses similaires à “Mise à jour SQL”

Parcourir les réponses de code populaires par langue

Parcourir d'autres langages de code