help with this scenario

  • Hi,

    I've sql 2012 and I need to implement this solution.

    when a user make any select statement that in this query it refer to a specific column in the query the results from the column should be replaced to 'NODATA'

    can it be done by trigger or any other method that SQL server have?

    THX

  • If you want to replace NULLs or empty strings with the string 'NODATA', one option would be to create views that use ISNULL() for nulls and NULLIF() for empty strings on nullable columns.

    The other option is to write those options in the query.

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • i can't interpolate the query at all it is closed box.

    can it be done via trigger or something else?

  • SELECT statements don't fire triggers.

    You can use insert and update triggers to avoid empty values but that would only complicate validations.

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply