Autor Beitrag
bvl
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 29



BeitragVerfasst: Fr 25.11.05 13:37 
Hallo, ich habe hier ein MSSQL Server Datenbank vor mir.
Da gibt es ein Feld (VARCHAR(64)), bei welchen ALLOWS NULL false gesetzt ist.
Nun schreibe ich gerade ein Software, die auf diese Daten schreibend zugreift.

Per Zufall habe ich entdeckt, dass ich einen leeren String darein schreiben kann, ohne dass die DB meckert. Ist das korrekt? Kann ich daran was machen?
Robert.Wachtel
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 895
Erhaltene Danke: 7

Windows 7 Ultimate x64
D5 Ent, D7 Arch, RAD Studio 2010 Pro, VS 2008
BeitragVerfasst: Fr 25.11.05 13:41 
Ein leerer String ist eben nicht NULL.
bvl Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 29



BeitragVerfasst: Fr 25.11.05 13:57 
Und was schicke ich dann stattdessen? Und was mache ich jetzt? Muss ich das wieder manuell aus meiner Software heraus prüfen?

Irgendwie macht die DB heute mehr arbeit als sie mir abnimmt...
noidic
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 851

Win 2000 Win XP Vista
D7 Ent, SharpDevelop 2.2
BeitragVerfasst: Fr 25.11.05 14:07 
Wenn MSSQL CHECK-Contraints kennt ( weiss ich nicht, arbeite mit Oracle ) kannst es damit machen.

_________________
Bravery calls my name in the sound of the wind in the night...
alzaimar
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2889
Erhaltene Danke: 13

W2000, XP
D6E, BDS2006A, DevExpress
BeitragVerfasst: Fr 25.11.05 14:11 
Was möchstest Du?
NULL ist nicht der leere String, denn der leere String ist ja ein String (der Länge 0), aber NULL ist Nichts.

MSSQL kennt natürlich CHECK Constraints.

_________________
Na denn, dann. Bis dann, denn.
bvl Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 29



BeitragVerfasst: Fr 25.11.05 14:14 
Ja, die CHECK Constraints gibt es in MSDE.

Ich weiss aber gar nicht wie man die verwendet. Und wo.
noidic
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 851

Win 2000 Win XP Vista
D7 Ent, SharpDevelop 2.2
BeitragVerfasst: Fr 25.11.05 14:16 
Das kann dir die Doku sagen, oder der DBA, falls vorhanden.

_________________
Bravery calls my name in the sound of the wind in the night...
bvl Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 29



BeitragVerfasst: Fr 25.11.05 14:23 
Super habs gefunden und es klappt. Man lernt nie aus.