Hello. TIA! 
I have this as a selector in a sproc and I don't think the result I'm getting is correct.
'BA' +CAST(datepart(yy, GETDATE()) AS VARCHAR) + CAST(DATEPART(MM, GETDATE()) AS VARCHAR) AS 'BatchNumber'
What I expect to get here is BA0409. What I get instead is BA20049.
What is going on?
Please help. I'm frustrated with it.
That and why do I have to explicitly do the cast here? If I don't, I get errors about it.
Kimberly
I have this as a selector in a sproc and I don't think the result I'm getting is correct.
'BA' +CAST(datepart(yy, GETDATE()) AS VARCHAR) + CAST(DATEPART(MM, GETDATE()) AS VARCHAR) AS 'BatchNumber'
What I expect to get here is BA0409. What I get instead is BA20049.
What is going on?
Please help. I'm frustrated with it.
That and why do I have to explicitly do the cast here? If I don't, I get errors about it.
Kimberly