<p>I need to print out data into a pre-printed A6 form (1/4 the size of a landsacpe A4). I do not need to print paragraphs of text, just short lines scattered about on the page.</p>

<p>All the stuff on MSDN is about priting paragraphs of text. </p>

<p>Thanks for any help you can give,
Roberto</p>

[{'answer_id': 54513, 'author': 'Ryan Lanciaux', 'author_id': 1385358, 'author_profile': 'https://Stackoverflow.com/users/1385358', 'pm_score': 2, 'selected': False, 'text': "<p>If you will be supporting languages other than English, you will want to use nvarchar.</p>\n\n<p>HTML should be okay as long as it contains standard ASCII characters. I've used nvarchar mainly in databases that were multi-lingual support. </p>\n"}, {'answer_id': 54517, 'author': 'Jason Cohen', 'author_id': 4926, 'author_profile': 'https://Stackoverflow.com/users/4926', 'pm_score': 5, 'selected': True, 'text': '<p>VARCHAR(255).  It won\'t use all 255 characters of storage, just the storage you need.  It\'s 255 and not 256 because then you have space for 255 plus the null-terminator (or size byte).</p>\n\n<p>The "N" is for Unicode.  Use if you expect non-ASCII characters.</p>\n'}, {'answer_id': 54519, 'author': 'Joel Coehoorn', 'author_id': 3043, 'author_profile': 'https://Stackoverflow.com/users/3043', 'pm_score': 2, 'selected': False, 'text': "<p>IIRC, 255 is the max size of a varchar in MySQL before you had to switch to the text datatype, or was at some point (actually, I think it's higher now).  So keeping it to 255 might buy you some compatibility there.  You'll want to look this up before acting on it, though.</p>\n\n<p>varchar vs nvarchar is kinda like ascii vs unicode.  varchar is limited to one byte per character, nvarchar can use two.  That's why you can have a varchar(8000) but only an nvarchar(4000)</p>\n"}, {'answer_id': 54529, 'author': 'Guy Starbuck', 'author_id': 2194, 'author_profile': 'https://Stackoverflow.com/users/2194', 'pm_score': 2, 'selected': False, 'text': '<p>Both varchar and nvarchar auto-size to the content, but the number you define when declaring the column type is a maximum.</p>\n\n<p>Values in "nvarchar" take up twice the disk/memory space as "varchar" because unicode is two-byte, but when you declare the column type you are declaring the number of characters, not bytes.</p>\n\n<p>So when you define a column type, you should determine the maximum number of characters that the column will ever need to hold and have that as the varchar (or nvarchar) size.</p>\n\n<p>A good rule of thumb is to estimate the maximum sting length the column needs to hold, then add support for about 10% more characters to it to avoid problems with unexpectedly long data in the future.</p>\n'}, {'answer_id': 54533, 'author': 'chakrit', 'author_id': 3055, 'author_profile': 'https://Stackoverflow.com/users/3055', 'pm_score': 2, 'selected': False, 'text': "<p>Because there are <strong>8-bits in 1 byte</strong> and so in 1 byte you can store up to 256 distinct values which is</p>\n\n<pre><code>0 1 2 3 4 5 ... 255\n</code></pre>\n\n<p>Note the first number is 0 so that's a total of <strong>256</strong> numbers.</p>\n\n<p>So if you use nvarchar(255) It'll use <strong>1 byte to store the length</strong> of the string but if you tip over by 1 and use nvarchar(256) then you're wasting 1 more byte <em>just</em> for that extra 1 item off from 255 (since you need <strong>2 bytes to store the number 256</strong>).</p>\n\n<p>That might not be the actual implementation of SQL server but I believe that is the typical reasoning for limiting things at 255 over 256 items.</p>\n\n<p>and <strong>nvarchar</strong> is for Unicode, which use 2+ bytes per character and<br>\n<strong>varchar</strong> is for normal ASCII text which only use 1 byte</p>\n"}, {'answer_id': 55722, 'author': 'Josef', 'author_id': 5581, 'author_profile': 'https://Stackoverflow.com/users/5581', 'pm_score': 3, 'selected': False, 'text': "<p>There are a couple of other points to consider when defining char/varchar and the N variations.</p>\n\n<p>First, there is some overhead to storing variable length strings in the database. A good general rule of thumb is to use CHAR for strings less than 10 chars long, since N/VARCHAR stores both the string and the length and the difference between storing <em>short</em> strings in N/CHAR vs. N/VARCHAR under 10 isn't worth the overhead of the string length.</p>\n\n<p>Second, a table in SQL server is stored on 8KB pages, so the max size of the row of data is 8060 bytes (the other 192 are used for overhead by SQL). That's why SQL allows a max defined column of VARCHAR(8000) and NVARCHAR(4000). Now, you <em>can</em> use VARCHAR(MAX) and the unicode version. But there can be extra overhead associated with that. </p>\n\n<p>If I'm not mistaken, SQL server will try to store the data on the same page as the rest of the row but, if you attempt to put too much data into a VARCHAR(Max) column, it will treat it as binary and store it on another page.</p>\n\n<p>Another big difference between CHAR and VARCHAR has to do with page splits. Given that SQL Server stores data in 8KB pages, you could have any number of rows of data stored on a page. If you <em>UPDATE</em> a VARCHAR column with a value that is large enough that the row will no longer fit on the page, the server will <em>split</em> that page, moving off some number of records. If the database has no available pages and the database is set to auto grow, the server will first grow the database to allocate blank pages to it, then allocate blank pages to the table and finally split the single page into two. </p>\n"}, {'answer_id': 62648, 'author': 'edosoft', 'author_id': 6399, 'author_profile': 'https://Stackoverflow.com/users/6399', 'pm_score': 2, 'selected': False, 'text': '<p>varchar(255) was also the maximum length in SQL Server 7.0 and earlier.</p>\n'}, {'answer_id': 63377, 'author': 'Philip Kelley', 'author_id': 7491, 'author_profile': 'https://Stackoverflow.com/users/7491', 'pm_score': 4, 'selected': False, 'text': '<p>In MS SQL Server (7.0 and up), varchar data is represented internally with up to three values:</p>\n\n<ul>\n<li>The actual string of characters, which will be from 0 to something over 8000 bytes (it’s based on page size, the other columns stored for the row, and a few other factors)</li>\n<li>Two bytes used to indicate how long the data string is (which produces a value from 0 to 8000+)</li>\n<li>If the column is nullable, one bit in the row’s null bitmask (so the null status of up to eight nullable columns can be represented in one byte)</li>\n</ul>\n\n<p>The important part is that two-byte data length indicator. If it was one byte, you could only properly record strings of length 0 to 255; with two bytes, you can record strings of length 0 to something over 64000+ (specifically, 2^16 -1). However, the SQL Server page length is 8k, which is where that 8000+ character limit comes from.  (There\'s data overflow stuff in SQL 2005, but if your strings are going to be that long you should just go with varchar(max).)</p>\n\n<p>So, no matter how long you declare your varchar datatype column to be (15, 127, 511), what you will actually be storing for each and every row is:</p>\n\n<ul>\n<li>2 bytes to indicate how long the string is</li>\n<li>The actual string, i.e. the number of characters in that string</li>\n</ul>\n\n<p>Which gets me to my point: a number of older systems used only 1 byte to store the string length, and that limited you to a maximum length of 255 characters, which isn’t all that long. With 2 bytes, you have no such arbitrary limit... and so I recommend picking a number that makes sense to the (presumed non-technically oriented) user. , I like 50, 100, 250, 500, even 1000. Given that base of 8000+ bytes of storage, 255 or 256 is just as efficient as 200 or 250, and <em>less</em> efficient when it comes time to explain things to the end users.</p>\n\n<p>This applies to single byte data (i.e. ansii, SQL<em>_</em>Latin1*_*General_CP1, et. al.). If you have to store data for multiple code pages or languages using different alphabets, you’ll need to work with the nvarchar data type (which I think works the same, two bytes for number of charactesr, but each actual character of data requires two bytes of storage). If you have strings likely to go over 8000, or over 4000 in nvarchar, you will need to use the [n]varchar(max) datatypes.</p>\n\n<p>And if you want to know why it is so very important to take up space with extra bytes just to track how long the data is, check out <a href="http://www.joelonsoftware.com/articles/fog0000000319.html" rel="noreferrer">http://www.joelonsoftware.com/articles/fog0000000319.html</a></p>\n\n<p>Philip</p>\n'}]
['https://Stackoverflow.com/questions/54522', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/5648/']