Browse the archive

SQL Server

SQL Modulo Function gives the wrong value?

Question In Javascript, Excel, Python, and a scientific calculator, the modulo operation -34086.1576962834 % 360.0 <-- python =MOD(-34086.1576962834, 360.0) <-- Excel function gives a value of 113.84230371659942. (Or something very close to that, depending on …

Continue reading

Temporarily turn on Cascade Delete

Question This has probably been asked before, but I couldn't find the answer. I have a complex datamodel in sql-server-20XX (more likely to be something old) in which cascade delete has been turned off (by design). A large chunk of our database has been sold …

Continue reading

CASE statement issue

Question Can anyone help with this error? SQL: SELECT InvoiceDate, BillingAddress, BillingCity, Total, CASE WHEN Total < 2.00 THEN 'Baseline Purchase' WHEN Total BETWEEN 2.00 AND 6.99 THEN 'Low Purchase' WHEN Total BETWEEN 7.00 AND 15.00 THEN 'Target …

Continue reading

Which install kit installs sqlcmd.exe?

Question I recently had to uninstall Visual Studio 2012 and DTS, then install VS 2017 and DTS again. Afterwards, The directory containing sqlcmd.exe was not in my PATH variable. I installed the following. vs_Professional-vs2017-15.9.41.exe …

Continue reading