trouble with DBA

trouble with DBA

am 28.11.2007 22:38:19 von BobH

Hi All,

I recently asked the DBA of the SQLServer database that I use to add a
field and set the 'allow zero length strings' to No.

after a couple more emails back and forth I got this one

"SQL Server does not support a Zero Length String. The only way to
ensure that we won't get a Zero Length is to make the field not
nullable."

what???? I'm tired of fighting with these people, its like there
telling me SQLServer tables must have data in all fields of all
records....

bobh.

Re: trouble with DBA

am 29.11.2007 00:40:43 von Lye Fairfield

bobh wrote in news:a45349b8-3782-40c1-8c52-
78bf10bf2db9@d61g2000hsa.googlegroups.com:

> Hi All,
>
> I recently asked the DBA of the SQLServer database that I use to add a
> field and set the 'allow zero length strings' to No.
>
> after a couple more emails back and forth I got this one
>
> "SQL Server does not support a Zero Length String. The only way to
> ensure that we won't get a Zero Length is to make the field not
> nullable."
>
> what???? I'm tired of fighting with these people, its like there
> telling me SQLServer tables must have data in all fields of all
> records....
>
> bobh.

I find zero length strings and nulls confusing in SQL Server. I am
disappointed that when I set the column "SchoolName" as non-null in Table
Schools I can still enter a zero length string into it. (It seems to me
that in the olden days that was impossible but maybe I'm hallucinating.
But it definitely can happen now in SQL 2005).

I find running this SQL seems to make the column behave as I wish:

ALTER TABLE Schools
ADD CONSTRAINT no_zls_SchoolName CHECK (LEN(SchoolName) > 0)

Now No Nulls (it was already non-nullable), and no zls's! Hooray! Hooray!

But I haven't been using it long enough to say that it's the way to go
for sure, nor to say there might not be a simpler, better way.

PS: I have found that DBAs don't seem to mind empowering me to run
Dynamic SQL strings (which is really wayyyyyyyyyyy dangerous), while not
wanting to create Stored Procedures for me whose SQL they can vet
beforehand. Go Figure.

--
lyle fairfield

I will arise and go now,
For always night and day
I hear lake water lapping
With low sounds by the shore;
While I stand on the roadway
Or on the pavements gray,
I hear it in the deep heart's core.
- Yeats