create constraint on strings in table

  • We have clients pushing data to us. I need to prevent them from inserting strings containing the following:

    -illegal XML chars

    -whitespace

    -any lowercase chars

    I am only allowed scalar expression for CONSTRAINT ("Subqueries are not allowed in this context. Only scalar expressions are allowed.").

    INSTEADOF constraint is the closest I can find, but it won't work for the filters above.

    Is there another path to limit client ability to insert values that will break SSRS downstream?

    Thanks,

    Micheal

  • Sounds like you may want to look into creating a CLR function for this. You could do it in a T-SQL function but probably wouldn't scale as well as CLR using regex.

  • I'll second the CLR function call idea on this one.

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • And I will table the motion - CLR seems the best option for this type of requirement.

    Jason...AKA CirqueDeSQLeil
    _______________________________________________
    I have given a name to my pain...MCM SQL Server, MVP
    SQL RNNR
    Posting Performance Based Questions - Gail Shaw[/url]
    Learn Extended Events

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

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