Using INFORMATION_SCHEMA for error checking

  • Hi guys and gals,

    I'm thinking of upgrading my older ASP sites to have a better server side error checking facility for form submissions.

    I'm thinking of putting somthing together, possibly with JQuery to pass the form fields and either the lengths of inputted data or the values themselves to the db where I can use INFORMATION_SCHEMA.COLUMNS to check everthing is valid.

    If not, I can return a custom error otherwise I can carry on and insert the data!

    So, my main decision is what format would be best to send the form data over to the db. I was thinking JSON or XML. I'd need to split out the info sent into field names and values then I can use mappings to check against whether they are required and if the correct type of data has been provided.

    Has anyone done this before??

  • I hv'nt used JSON but xml is a good option. You can pass the xml as a parameter to the procedure and do your checking inside the procedure.

    "Keep Trying"

  • Hi,

    Thanks for the response. Ok. To be honest I was thinking XML would be easiest. I'll have a little play and see what I can put together.

  • From SQL 2005 onwards there is a lot of stuff with which xml data can be manipulated.

    "Keep Trying"

  • This is going to be a huge performance hit to your application. You should avoid extra round trips to the database and do the validation on the client side. If you are worried about the datbase schema changing, you can set up a process on the web server that downloads the schema on a regular basis (daily? every 6 hours?) and stores it on the client for doing the validation client side.


    My blog: SQL Soldier[/url]
    SQL Server Best Practices:
    SQL Server Best Practices
    Twitter: @SQLSoldier
    My book: Pro SQL Server 2008 Mirroring[/url]
    Microsoft Certified Master: SQL Server, Data Platform MVP
    Database Engineer at BlueMountain Capital Management[/url]

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

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