Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2012
    Posts
    33

    Cool Unanswered: Validation data in T-SQL

    Hello!

    I writing application based on database in sql server 2008 r2 in c#. How is better:

    1. Validation data in c# language
    (
    function type: if(name.Text is null ) MessageBox.Show("WTF")
    )

    or validation data include in procedure sql? Example:

    Create PROCEDURE [dbo].[DetailsClient]
    @id int
    AS
    BEGIN
    if(@id is NULL) PRINT 'Param id is null, exception'
    else
    select Corporation from Clients where ID_C=@id
    END

    I greet

    Edit: How is professional?

  2. #2
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    Having the stored procedure issue the error message is generally preferred. Please also onsider using the SQL Server RAISERROR feature, it is more locale friendly than hard coded text for error messages.

    -PatP
    In theory, theory and practice are identical. In practice, theory and practice are unrelated.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •