Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Check constraints validating HTML Expand / Collapse
Author
Message
Posted Tuesday, March 23, 2010 11:21 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Monday, December 3, 2012 7:54 AM
Points: 27, Visits: 90
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
Post #888377
Posted Tuesday, March 23, 2010 11:34 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Today @ 7:42 AM
Points: 12,887, Visits: 31,834
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

--There is no spoon, and there's no default ORDER BY in sql server either.
Actually, Common Sense is so rare, it should be considered a Superpower. --my son
Post #888392
Posted Tuesday, March 23, 2010 11:43 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Monday, December 3, 2012 7:54 AM
Points: 27, Visits: 90
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.
Post #888396
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse