Sunday, March 11, 2012

datalength( '' + space(5) + '' ) = 7 !??

Hello,
What configuration could cause a database to substitute a space character
for empty strings ?
Two databases on the same server. In one the statement select '' + '123' +
'' yields " 123 " and on the other the same statement yields "123".
Thanks for any insight
APSET ANSI_PADDING
--
HTH
Ryan Waight, MCDBA, MCSE
"Antoine Perret" <antoine@.bow.ch> wrote in message
news:eUi$EfYjDHA.1284@.TK2MSFTNGP09.phx.gbl...
> Hello,
> What configuration could cause a database to substitute a space character
> for empty strings ?
> Two databases on the same server. In one the statement select '' + '123' +
> '' yields " 123 " and on the other the same statement yields "123".
> Thanks for any insight
> AP
>|||Thank-you sir!|||Hi Antoine,
The database that yields " 123 " is probably on a compatibility level of 60
or 65.
Run
EXEC sp_dbcmptlevel [ [ @.dbname = ] name ]
to check.
--
Jacco Schalkwijk
SQL Server MVP
"Antoine Perret" <antoine@.bow.ch> wrote in message
news:eUi$EfYjDHA.1284@.TK2MSFTNGP09.phx.gbl...
> Hello,
> What configuration could cause a database to substitute a space character
> for empty strings ?
> Two databases on the same server. In one the statement select '' + '123' +
> '' yields " 123 " and on the other the same statement yields "123".
> Thanks for any insight
> AP
>|||Yes that is it.
Thanks
Funny I don't recall that feature on older versions...