SQL ANY & ALL Operators

The ANY and ALL operators allow you to perform a comparison between a single column value and a range of other values. For instance: select * from Table1 t1 where t1.Col1 < ANY(select value from Table2) ANY means that the condition will be satisfied if the operation is true for any of the values in … Read more

MySQL columns with DEFAULT NULL – stylistic choice, or is it?

As documented under Data Type Default Values: If the column can take NULL as a value, the column is defined with an explicit DEFAULT NULL clause. (I think they meant implicit, not explicit). Moreover, as documented under CREATE TABLE Syntax: If neither NULL nor NOT NULL is specified, the column is treated as though NULL … Read more

Any way to SQLBulkCopy “insert or update if exists”?

I published a nuget package (SqlBulkTools) to solve this problem. Here’s a code example that would achieve a bulk upsert. var bulk = new BulkOperations(); var books = GetBooks(); using (TransactionScope trans = new TransactionScope()) { using (SqlConnection conn = new SqlConnection(ConfigurationManager .ConnectionStrings[“SqlBulkToolsTest”].ConnectionString)) { bulk.Setup<Book>() .ForCollection(books) .WithTable(“Books”) .AddAllColumns() .BulkInsertOrUpdate() .MatchTargetOn(x => x.ISBN) .Commit(conn); } trans.Complete(); … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)