Where clause with date type. Need help
compvis
Posts: 13
hi,
I have a table with a field that has data type is date. So how can i filter data in table by date type, like:
I have a table with a field that has data type is date. So how can i filter data in table by date type, like:
TableMappings mappings = new TableMappings(); sourcedb.Register(sourcecn, Options.Default); targetdb.Register(targetcn, Options.Default); mappings.CreateMappings(sourcedb.Tables, targetdb.Tables); foreach(TableMapping tbm in mappings) { if (tbm.Obj1.Name == "DQP_T3") { tbm.Include = true; tbm.Where = new RedGate.SQLDataCompare.Engine.WhereClause("Date >= 10/10/2000 && Date <= 10/10/2011"); } else { tbm.Include = false; } }Thanks
Comments
tbm.Where = new RedGate.SQLDataCompare.Engine.WhereClause("Date >= 10/10/2000 AND Date <= 10/10/2011");
Does that help? Also, to avoid any potential confusion over date formats you may want to specify the dates as yyyy-mm-dd.
Redgate Software