btamulis 2/1/2024 6:19:10 AM

Quick SQL Question

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

 

 

Version: All
Section: SQL for Beginners, SQL Scripts


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