DATALENGTH function returns the total number of bytes used to represent string.
First I try it on VARCHAR data type.
Output is coming as 5 because it will take 5 bytes in memory.
If I try it on NVARCHAR data type
Output is coming as 10 because it will take 10 bytes memory here each character will take 2 bytes.
Now if I try it on CHAR data type
Whatever you store in variable it will consume 20 bytes in memory so that’s why output is coming as 20.
DATALENGTH of Null returns Null.
That's It.
Enjoy Learning.
Output is coming as 5 because it will take 5 bytes in memory.
If I try it on NVARCHAR data type
Output is coming as 10 because it will take 10 bytes memory here each character will take 2 bytes.
Now if I try it on CHAR data type
Whatever you store in variable it will consume 20 bytes in memory so that’s why output is coming as 20.
DATALENGTH of Null returns Null.
That's It.
Enjoy Learning.
No comments:
Post a Comment