SQL Server NULL or empty value checking

This is how to check NULL or empty input values for a date column. Currently NULL or empty values produces ‘1900-01-01’ value which is not acceptable.

DECLARE @InputDate DATE

--set input to spaces
SET @InputDate = ''
--don't want 1900-01-01 output, instead NULL value
SELECT ISNULL(NULLIF(@InputDate, ''), NULL) AS InputDateSpaces

--set input to null
SET @InputDate = NULL
--don't want 1900-01-01 output, instead NULL value
SELECT ISNULL(NULLIF(@InputDate, ''), NULL) AS InputDateNULL

--set input to date
SET @InputDate = '2021-06-25'
--don't want 1900-01-01 output, instead date value
SELECT ISNULL(NULLIF(@InputDate, ''), NULL) AS InputDateRealDate

These are the results;

Select Date between Two Date Columns

This is how to run a SQL Query where you have two date columns and like to see if your date falls between those columns;

SELECT * FROM FiscalCalendarRef
WHERE 1=1
AND '2021-09-13' BETWEEN StartDate AND EndDate

If EndDate column is defined as NULL, you can change it like this;

SELECT * FROM FiscalCalendarRef
WHERE 1=1
AND '2021-09-13' BETWEEN StartDate AND COALESCE(EndDate, GETDATE())

Does Azure charge for stopped VMs?

If we stop a VM inside OS then it goes into “stopped” state. Azure will charge for the compute (hardware), network and storage services.

We can stop maximum charges for VM by using the stopped (deallocated) state. For this we would need Azure Portal (or Azure CLI) to stop the VM. This will shutdown the Operating System and deallocate the compute resource/network resource allocated for the VM. These compute/network resource can be used for another customer.  In this case Azure will report the status of the VM as being in a “Stopped (Deallocated” state.

Stopping (deallocating) a VM also release the internal IP address. A quick tip to prevent this from happening is to make sure that you have at least one VM that you haven’t put in the Stopped (Deallocated) state. You’d still be charged for that one but not the others, whilst maintaining your virtual IP.

Azure doesn’t charge for the VM core hours in Stopped (deallocated) state. However, it continues to accrue charges for the Azure storage needed for the VM’s OS disk and any attached data disks.

Visual Studio Debugger Failed to launch debug adapter

All of sudden I started getting this error;

If I change launchBrowser to false in launchSetting.json file,  I can successfully start the project, and then open the browser and navigate to the url manually.

launchBrowser: false

If I run project “without debugging” by pressing CTRL+F5, it runs fine but I loose debugging feature.

The quick fix is to never use JavaScript debugging in Visual Studio. The Chrome JavaScript debugger is a much better alternative for debugging.

To turn off debugging and fix the problem follow this;

You can confirm this change;

The pain is gone.

Resourceshttps://stackoverflow.com/questions/58767169/visual-studio-2017-failed-to-launch-debug-adapter-chrome