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

View effective permission of single user

Login to SQL Server as an admin account. Run following query by impersonating the user;

execute as user = 'SomeUserName' -- Set this to the user name you wish to check
select * from fn_my_permissions(null, 'DATABASE') -- Leave these arguments, don't change to MyDatabaseName
order by subentity_name, permission_name
revert

This will list all effective permission for this user;