Archives

 

This is a little more complicate than you might think. Simply using DATEDIFF won't work correctly, because it only subtracts the 'year' portion of the date. It doesn't take into account if the month/day is before or after the current date. 

I've come across a formula that works, and it's not too complicated. See below. 

I have an issue in a database where the unit of measure schedules are sometimes upper case, sometimes lower, sometimes mixed. I'm about to lose my mind...

I need a query that will display the offenders and fix them. 

COLLATE Latin1_General_CS_AS to the rescue.

Ever have one of those moments where you 'hear the angels sing'? A 'man, that's so cool' moment? I just had one. 

I'm editing an ACA query just now (has to do with year end reporting). 3 days ago I wrote a formula, ran it a few times, then the client told me it wasn't needed so I removed it. Today, I need it <forehead slap>. And it was a paid to research and code, I needed a person's age on Jan 1 for the report. 

Enter Red Gate SQL Prompt:

This tutorial will take you through the ENTIRE process of creating a web hook receiver in VB and ASP.NET. It can be easily ported to C#, if you're not old like me. 

It's safe to say that this tutorial does not exist anywhere on the internet. I've looked. 

I'm going to code two of them in the next few days, this first one will receive a webhook sent from www.github.com, because it's easy, and easy to test repeatedly. I can just click a button on Github and it will send my webhook over and over. 

The second one will be using the 'custom' API, it's going to come from a national bank. 

Step one is included here, in the 'teaser' section, because many of you are not subscribers and I want you to know that I'm EASILY going to save you days of work here. I just spent 3 days figuring this out. 

So... 

Step 1:

Create a new ASP.NET Web Application (.NET Framework) (mine is in VB, but it can be easily ported to C#)

 

Step 2 is below. 

I have a SQL Table that I need to update with a BATCHID based upon data from the table.

The Table has a Posting Date Column with Dates formatted (example) 2024-01-30

I need to update the Batchid based upon a string plus the date (formatted without hyphens)

Something like Update Batchid = CONCAT('YAYPAY_'+PostingDate)

So if posting date in table is 2021-01-30 then BatchID (has to be 15 chars max) should be: 'YayPay_20240130'

How do I strip out the hyphens and format the date so it fits 15 characters? 

Thanks in advance

 

 

Is there anyway to give a power user in GP the ability to setup new users without them having SysAdmin to the database?  Everything I read says no but maybe someone here has discovered a creative solution to this problem.  We want the power user to be able to go into SSMS and run select queries but not be able to do any inserts/updates/deletes etc..  If you change there sql account to restrict them then they can do certain admin functions in the app.

Okay - I'm trying to grab the first five letters of a customer name field in GP. In some cases, the Customer name starts with numbers which I need to strip out. 

Example - here the data:

 

I'm trying to use PATINDEX and LEFT to get the first five letters -

Here's my feeble attempt:

select LEFT( PATINDEX('%[A-Z]%', CUSTNAME), 5) as CustomerName from RM00101

This returns - 

Obviously, it's just counting where the first letter begins not returning anything. 

I originally tried substring - then settled on PATINDEX.

Any help would be greatly appreciated - thanks 

 

 

 

Table Definition Quick Links
All Tables
SOP Tables
RM Tables
GL Tables
POP Tables
HR Tables
PM Tables
UPR Tables
IV Tables
Olympic Tables
3