Convert Access RIGHT$ Function to TSQL

I'm familiar with Access' Left and Right functions but this code has me baffled:

SET MiscLine2 = Right$([invoicedate],4), MiscLine3 = Left$([invoicedate],2)

What does the $ do?

Thanks

It's been quite a while since I've done Access, but the $ forces the returned data type to be a string; without a $, the return result is a variant (I think). If a NULL result is possible, then you must use LEFT().

For SQL Server, just use LEFT() / RIGHT() as usual.

1 Like

Thanks, @ScottPletcher SET MiscLine2 = Right([invoicedate],4), MiscLine3 = Left([invoicedate],2)
worked fine.

"It's been quite a while since I've done Access..." I wish I could say the same :slight_smile: