How to check in a sproc if a datetime2 value is the minimum value?
I have a SQL Server 2008 stored procedure that takes a datetime2 parameter. If the user passes in the minimum value I don't want to run part of the sproc. My question is, what is the best way to check if the value passed in is the c# DateTime.MinValue ?
If you insert the sample DateTime.MinValue value in Database in DateTime2 type. The result will be 0001-01-01 00:00:00.0000000
if @Param != '0001-01-01 00:00:00.0000000' begin -- Your code end