home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.databases.ms-sqlserver      Notorious Rube Goldberg contraption      19,505 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 18,630 of 19,505   
   Erland Sommarskog to Gene Wirchenko   
   Re: Enforcing an Order to Validation   
   11 May 12 09:01:22   
   
   XPost: microsoft.public.sqlserver.programming   
   From: esquel@sommarskog.se   
      
   Gene Wirchenko (genew@ocis.net) writes:   
   >      One of the issues that I have with database errors is the   
   > disconnect between them and the frontend.   
      
   Yes, down in the database, you cannot really tell what error the user did.   
   All you can tell is that a constraint etc was violated.   
      
   Particularly, if you want error message that helps the user, constraints   
   are not your guy.   
      
   >      I am trying to find out what is the guaranteed behaviour.  That   
   > is safer.   
      
   I gave it some more thinking, and there is hardly any guaranteed order.   
   There is an optimizer and it makes the actions in the order which is the   
   most efficient.   
      
   >      I think that statement should be that the database should never   
   > permit such, but the application should be free to do no error   
   > checking.  The application also doing error checking makes for a more   
   > friendly app, but I would prefer correctness FIRST.   
      
   Let me make it clear again: the error messages that are produced by   
   SQL Server when a constraint is violated are not helpful for the user.   
   At best you can trap and interpret them. But that is difficult.   
      
   And since the error messages are useless to the user, it's completely   
   irrelevant in which order SQL Server checks the constraints.   
      
   Error messages from stored procedures and trigger checks are a different   
   matter, here you have control. Then again, down in the trigger all   
   you can tell that a column has an illegal value, but you don't know   
   where in the form the user went wrong. You don't even know if there is   
   a form.   
      
   Finally, permit me to point out that the application can implement error   
   checking more than one way. If a column only permits the values A, B and C   
   the application will of course not expose a text box, but a drop-down or a   
   ratio button.   
      
   --   
   Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se   
      
   Links for SQL Server Books Online:   
   SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx   
   SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca