lundi 25 juillet 2016

Using merge how can i use where statement?

i'm using this code:

SqlCommand cmd = new SqlCommand(@"
MERGE customermaster  AS target USING
      Tamio.dbo.memberform  AS source
      ON target.id  = source.id 
WHEN MATCHED THEN
    UPDATE SET target.name = source.name
WHEN NOT MATCHED THEN
        INSERT (id, name) VALUES (source.id, source.name)
", conn);
cmd.ExecuteNonQuery();

Example:How can i execute mycode where active=1.

Aucun commentaire:

Enregistrer un commentaire