This might give you something to work with.
SELECT ASCII(substring(name,1,1)),
ASCII(substring(name,2,1)),
ASCII(substring(name,3,1)),
ASCII(substring(name,4,1)),
ASCII(substring(name,5,1)),
ASCII(substring(name,6,1)),
ASCII(substring(name,7,1)),
ASCII(substring(name,8,1)),
ASCII(substring(name,9,1))
FROM sysobjects
Roy Harvey
Beacon Falls, CT
>Hi!
>
[quoted text clipped - 5 lines]
>
>Dave Venus
dvenus - 09 Jul 2008 19:32 GMT
Hi!
Again thanks for the quick reply!
To me it is getting stranger still.....
Here is the query I ran:
SELECT ASCII(substring(stores,1,1)) col1,
ASCII(substring(stores,2,1)) col2,
ASCII(substring(stores,3,1)) col3,
ASCII(substring(stores,4,1)) col4,
ASCII(substring(stores,5,1)) col5,
ASCII(substring(stores,6,1)) col6,
ASCII(substring(stores,7,1)) col7,
ASCII(substring(stores,8,1)) col8,
ASCII(substring(stores,51,1)) col51,
datalength(stores) length
FROM ald
where ascii(stores) is null
And here is what it returned for each row:
COL1 COL2 COL3 COL4 COL5 COL6 COL7 COL8 CO51 Length
------- ------- -------- ------- -------- -------- ------- --------
------- ---------
NULL NULL NULL NULL NULL NULL NULL NULL NULL 0
Now the column only has 50 characters (nvarchar(50)). So column 51 must
just mean there is no such character.
I really appreciate everyone's help with this!
Dave Venus
Roy Harvey (SQL Server MVP) - 09 Jul 2008 20:31 GMT
So you have an empty string stored in a column that does not allow
NULLs. An empty string is different than a NULL, at least in SQL. In
SQL the NULLability is an attribute of the column as a whole, and if
it is NULLable then whether it is NULL or not is an attribute of the
column in each individual row.
Roy Harvey
Beacon Falls, CT
>Hi!
>
[quoted text clipped - 30 lines]
>
>Dave Venus
David Portas - 09 Jul 2008 23:05 GMT
> Hi!
>
[quoted text clipped - 30 lines]
>
> Dave Venus
That is the expected result. ASCII() returns NULL if the string in question
is the zero-length string.

Signature
David Portas