SQL validation
Last Post 08-13-2012 04:51 AM by Ryan Bakerink. 2 Replies.
AddThis - Bookmarking and Sharing Button
Author Messages
toddgdaughertyUser is Offline
skipping stones
skipping stones
Posts:13
Avatar

--
08-10-2012 10:11 PM
    Any idea why this SQL validation does not return false?  It doesn't return anything.

    Thanks!


    DECLARE @DATE varchar(10)
    SET @DATE = '9/31/2012'
    IF ISDATE(@DATE) = 1
    PRINT 'IsValid'
    ELSE
    PRINT 'False'
    toddgdaughertyUser is Offline
    skipping stones
    skipping stones
    Posts:13
    Avatar

    --
    08-12-2012 10:18 PM
    BTW - this returns a value (false) in a SS Management Studio query but in a Dynamic Registration "SQL validation" or in a host > SQL query it returns nothing. (The query did not return any data.)

    Is there something I'm missing here?

    Thanks!

    Todd
    Ryan BakerinkUser is Offline
    river guide
    river guide
    Posts:1900
    Avatar

    --
    08-13-2012 04:51 AM
    Hello Todd,

    There are a couple rules when it comes to utilizing the SQL Validation feature withing Dynamic Registration:

    1.) A column or column alias must be returned that is named "IsValid"
    2.) The returned column value must be "False" for failed validation or "True" for a completed validation.

    Here's an example of a working SQL Validation query:
    ----------------------------------------------------------------------------
    DECLARE @COUNT INT
    SET @COUNT = (SELECT COUNT(*) FROM USERS WHERE UserName like '%$(UserName)%')

    DECLARE @BOOL NVARCHAR(200)

    IF @COUNT > 0
    BEGIN
    SET @BOOL = 'True'
    SELECT @BOOL As IsValid
    END
    ELSE
    BEGIN
    SET @BOOL = 'False'
    SELECT @BOOL As IsValid
    END
    ----------------------------------------------------------------------------

    Now this validation query may be used in a scenario such as if a User exists with the provided Username from the form. This is only an example query.

    Let me know if you have any questions.

    Thanks,

    Ryan


    ---
  • film izle
  • 720 izle
  • film
  • sinema izle
  • film makinesi
  • T�rk�e dublaj film
  • film izle
  • film izle
  • baglan film izle
  • sinema izle
  • 1080 film izle
  • film mercegi