|
Ah, well, you'll need to change it a bit to suit your taste. varChar(max) and nVarChar(max) are SQL Server specific data types. They're like modern versions of the Text and nText (CLOB) types.
Just replace (max) with a size appropriate to what you need.
Numbers for column names are a bad idea in general, and confused the heck out of me - I think I understand now, tho.
After you size your columns in the code I wrote out, you might do something like
Insert PageType ( TypeDesc ) Values ( 'Sports' )
Insert PageType ( TypeDesc ) Values ( 'History' )
Insert PageType ( TypeDesc ) Values ( 'Stupid Database Garbage' )
Et cetera. The database will generate TypeID values for each of them. If you do what I just typed, above, in that order, Sports will have a TypeID of 1. So you'd follow it up with
Insert Quotes ( PageTypeID, Quote, Author ) Values ( 1, 'Deja vu all over again', 'Yogi Berra' )
I think we've gone over most of the advantages of this approach. Mainly, it makes your application drastically faster as you add more and more data. But also if you add 500,000 sports quotes, then you want to change the label from "Sports" to "Sport Related Quotes" you would change 1 value in the PageType table, and it would instantly be reflected everywhere in your system - because that's the only place it's stored.
|