Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
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: Tuesday, February 24, 2015 1:06 PM
Points: 27, Visits: 91
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: Yesterday @ 2:58 PM
Points: 13,971, Visits: 36,274
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!
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: Tuesday, February 24, 2015 1:06 PM
Points: 27, Visits: 91
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