Check constraints validating HTML

  • Afternoon,

    I'm having to store a title in an nvarchar column that may contain HTML.

    Is it possible to write an expression for a column check constraint that will verify that this html is valid?

    Thanks,

    dnash

  • interesting David;so it would jsut be the html for <title></title>? and you want to make sure it doesn't have things like > instead of & g t ; in the text? stuff like that? or is it an entire html document,and you have to validate everything from missing </td> tags and all that?

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • It's literally just simple html. Like if you had this as a survey title:

    <b>Come and get it</b> - we <i>love</i> hamburger helper

    I just need to confirm that tags match and all. I know how to do this in C# using a RegEx expression.

    I'm migrating data from one schema to another and trying to replicate the validation rules in our new Business Layer with check constraints in order to avoid having to migrate all of the data in THROUGH that Business Object layer, which is written using a complicated .net/c# framework called CSLA.

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

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