Even though there is no SQL Client tooling installed on a machine, PowerShell can be used to execute SQL. I recently had to verify that I had been granted Dbo rights on a database that was on a server only reachable from a web server. The web server of course had no SQL tooling whatsoever… Continue reading Verify Database Access with PowerShell
Category: SQL
Enums and Lookup Tables with EF Code First
With EntityFramework’s support for enums, there is no longer any need to include lookup tables in the model. But I do want to have them in the database for integrity, even with code first. I’ve been thinking for some time about to handle enums with code first. The idea behind code first is to be… Continue reading Enums and Lookup Tables with EF Code First
On Null or Why Empty Strings are not Same as Null
Null is an important, but sometimes hard concept. What’s the difference between an empty string and a null string? One of my first Stack Overflow questions was (NOT) NULL for NVARCHAR columns. Some people claim that using null is always wrong or is some kind of voodoo. If you feel the urge to use Nullable<int>… Continue reading On Null or Why Empty Strings are not Same as Null
Avoid broken Views in SQL Server with Schemabinding
SQL Server views can get really weird when an underlying table is updated. I’ll show some examples and also the one must do for views to avoid problems. The broken views problem is something I discovered when working on a production system. When I first observed it I was shocked. When I dug deeper into… Continue reading Avoid broken Views in SQL Server with Schemabinding
Dissecting MVC Scaffolded Code for EF Updates
MVC and Entity Framework scaffolding is powerful, but I prefer to know what actually happens before accepting generated code. The code generated to update an entity when an edit has been done looked interesting, so I decided to have a closer look at it. When an edit is done to an entity, the data is… Continue reading Dissecting MVC Scaffolded Code for EF Updates