Category: MS SQL Server
-
Set Date Back Twelve Hours – MSSQL
Hey everyone, A quick post on how to set a date value for twelve hours ago using SQL Server: UPDATE MyTable SET MyDate = dateadd(HOUR, -12, CURRENT_TIMESTAMP) Simply use the dateadd function and specify the unit (hours in this case). The example above will set MyDate to twelve hours ago. Here’s the offical documentation on…
-
Cannot attach the file ‘C:…database.mdf’ as database x – Entity Framework
Hi everyone, I ran into the following error when attempting to run ‘update-database’ on an initial migration: Cannot attach the file ‘C:Users…App_Dataaspnet-…115933.mdf’ as database ‘aspnet-…15933’ The solution to this one is pretty easy, remove the initial catalog property from your connection string. …33.mdf;Initial Catalog=aspnet… This is apparently caused by issues with EntityFramework and multiple projects…