SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Thread: setting null

  1. #1
    SitePoint Enthusiast
    Join Date
    Jan 2013
    Location
    Greece
    Posts
    70
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    setting null

    I know more or less what is the syntax of a trigger statement(at least in theory, since I have never made use of a trigger in an app).

    My question is if a trigger can cover the situation below:

    Set a column value to null if the corresponding value that comes from a submitted a form is an empty string.

    Can the above be achieve with a trigger?

  2. #2
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,270
    Mentioned
    60 Post(s)
    Tagged
    3 Thread(s)
    if it's a submitted form, it's gotta be passing through some application language (like php)

    that's where you would detect the empty string and replace it with the NULL keyword

    trigger not required
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  3. #3
    SitePoint Enthusiast
    Join Date
    Jan 2013
    Location
    Greece
    Posts
    70
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You are right, I will do it the way you propose.
    Nonetheless I just wanted to use a triger for learning purposes.

    I will post in the PHP forums because I am having trouble achieving what I want.


Bookmarks

Posting Permissions

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