February 14, 2024 at 12:00 am
Comments posted to this topic are about the item The Default Variable String
February 14, 2024 at 2:10 pm
Nice one Steve!
I like short questions, with short answers and even shorter query outcome
February 14, 2024 at 8:04 pm
In times past, using varchar without a length defaulted to 30 characters. Did that change?
LinkedIn: https://www.linkedin.com/in/sqlrv
Website: https://www.sqlrv.com
February 14, 2024 at 10:40 pm
I don't think so. I checked back through 2017, and this still happens.
I think most of us used cast/convert, and in those cases, it is 30.
February 15, 2024 at 1:06 am
In times past, using varchar without a length defaulted to 30 characters. Did that change?
No. It hasn't changed. What it says in BOL has been true since I can remember and I also checked copies of BOL back to 2016.
When n isn't specified in a data definition or variable declaration statement, the default length is 1. If n isn't specified when using the CAST and CONVERT functions, the default length is 30.
--Jeff Moden
Change is inevitable... Change for the better is not.
February 15, 2024 at 2:22 am
Yep, that's what I was thinking about. Thanks for clarifying!
I've had my head embedded in Postgres for the last few years. It's not surprising something got pushed out in the process!
LinkedIn: https://www.linkedin.com/in/sqlrv
Website: https://www.sqlrv.com
February 15, 2024 at 2:49 pm
Yep, that's what I was thinking about. Thanks for clarifying!
I've had my head embedded in Postgres for the last few years. It's not surprising something got pushed out in the process!
Heh... true dat.
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy