• Windows 2008 – Alert on Scheduled Job Failure

    First we need to enable logging for the Windows Task Scheduler, open Event Viewer (Put “eventvwr.msc” in Run) and browse to TaskScheduler as below. Right click the Operational log and click properties and ensure the “Enable Logging” is checked Windows is now setup to log Scheduled tasks to the Event Viewer, now we need to…

    Continue reading

  • Mail on Login failure to a Microsoft SQL Server

    Ensure a mail profile is setup and make a note of its name. Run the following in Microsoft Query Analyser replacing the mail profile and email address. USE [msdb] GO /* Credit https://sqljunkieshare.com/2016/08/01/variable-wmi-not-found/ for issue with Variable WMI Not Found on newer versions of SQL Server */ EXEC msdb.dbo.sp_set_sqlagent_properties @alert_replace_runtime_tokens = 1 GO USE [msdb]…

    Continue reading

  • Sage Line 500 V7.1 CSAgent TCR and Form appear to start but ports never open

    Recently we had this issue where after windows patches were applied, after a reboot the Sage Line 500 v7.1 Windows services no longer worked on our development and live servers. It was due to the Visual Studio dll msvcr71.dll being removed SYSWOW64 (32 Bit systems will be System32 and you can see in process monitor…

    Continue reading

  • Populate Sage table opheadm with credit note information for Cindercone Magma to send to Tungsten/OB10

    The below stored proc is used to populate two Sage fields shipper_code2 and shipper_code3 in the Order Header Table. Obiously if this is used already by another Sage Project do not use, as the fields won’t be updated. Here I look 30 days backwards and at particular invoice customers (There is no point updating every…

    Continue reading

  • Force TSQL dateformat

    If you get the following error on scheduled stored procedures, force the dateformat (The Microsoft SQL Server scheduler will probably be running the default mdy), you can use Set Language but I tend to change the dateformat. [SQLSTATE 01000] (Message 0) The conversion of a nvarchar data type to a datetime data type resulted in…

    Continue reading

  • Use a case to make sure provided data is a date

    I find this useful for using validating spreadsheet imports, using ISDATE can just blank the field if crap data is provided –Use Case to make sure a data field is a date –Will Work and produce the inserted field select CASE WHEN ISDATE(t1.datefield) =1 THEN t1.datefield ELSE ” END as datefield_full from (select ’14/12/2054′ as…

    Continue reading

  • Check the audit on Business Objects XIR3 SP7 for logons

    This is useful to see who is using their licenses which are very expensive. I tend to check every few months and look at 90 days. Its a simple count excluding the System Account and look at a date range. I have only run this against XIR3 SP7 where auditing has been enabled on an…

    Continue reading

  • In VBA strip out characters which cause TSQL to fail

    A simple way to strip out characters which can cause TSQL Code to break. Assumes the SQL commannd is in sqlstatement and you are passing a variable in me.comment, before executing the code. ‘Allows Characters such as , and ‘ which may break TSQL Code and Cause Injection sqlstatement = RTrim(sqlstatement) + “,’Me.comment & “‘”…

    Continue reading

  • Sage EDI IN Intermediary Email

    I have found users don’t always read the logs from the Adaptus EDI Module anymore in Sage Line 500. There are a few reasons why orders get stuck, the most common is a customer has sent a duplicate EDI file although one was caused by incorrect product supersession setup causing an endless loop. USE <Affected…

    Continue reading

  • Maintain regtrans-ms and blf files generated by Georgia UTS sessions

    A little script I schedule for servers using Georgia UTS. Below I use Robocopy to move files older than 3 days, to avoid anyone currently logged in. For me I expect users to be logged on for no more than a day, active user files should therefore be untouched. echo This Batch Files removes .regtrans-ms…

    Continue reading