Tuesday, September 30, 2008

SQL 2005: Delete Records Using Another Table

DELETE tobeupdated_table FROM tobeupdated_table  a
WHERE a.tableID = @ID_in
       AND a.otherTableID IN 
           ( SELECT otherTableID  FROM otherTable b
                    WHERE b.someField = @someValue_in
           );

Monday, September 22, 2008

C#: DataTable row conversions.

double value = double.Parse(dr["value"].ToString());

This would parse a value in a datatable field as a double.