CJSmith dot me

I dump stuff I find useful here

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

Published / by Chris Smith / Leave a Comment

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 […]

Use a case to make sure provided data is a date

Published / by Chris Smith / Leave a Comment

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 […]

In VBA strip out characters which cause TSQL to fail

Published / by Chris Smith / Leave a Comment

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 & “‘” […]

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

Published / by Chris Smith / Leave a Comment

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 […]

Disable Powerpoint 2016 extended display mode

Published / by Chris Smith / Leave a Comment

Credit: http://tips.timscomputer.com/disable-powerpoint-2013-extended-display-mode-via-registry/ Disable the extended display mode upon login, same as the link just modified the version from 15 to 16 Run the following as a batch file upon login @echo off reg add HKCU\Software\Microsoft\Office\16.0\PowerPoint\Options /v UseMonMgr /t REG_DWORD /d 0 /f

Windows 2008: Task Scheduler causes account lockout when policy locks account after one attempt

Published / by Chris Smith / Leave a Comment

I encountered a very odd issue where I was attempting to amend a scheduled task on a Windows 2008 R2 server. When attempting to amend to a “service” account it locked out immediately. This account has a policy where it is locked out if the password is incorrect once. After several attempts and having to […]