Thank this author by sharing:
By Masar Ivica,
Sometimes you have to start from beginning, almost from a DOS, especially if you task sounds like "make a simple barcode generator". Naturally, I started with most complicated ideas, to make a RTF (it is not short for read the f*** manual) or a PDF as an add-on to previous article. Other ideas were to create HTML tables with cells black & white backgrounds, or to use GIFs but it is almost complicated like drawing shapes in RTFs or PDFs. But first of all..
Why barcode? We are working with Documentum, so electronic documents are our objects. When you have batch scanning there is need to connect images with attributes in databases. If you have scanning tool you can scan papers into the electronic format but there has to be some link to other data and that it is barcode. Just paste some label with barcode on paper and after scanning use some tool like JavaOCR for OCRing and you can even index documents. Barcode is very good for OCRing. This example does not need barcode reader, but if you want to manage you CD/DVD collection you will need barcode reader like they do in the shops.
And now some technical stuff. Testing environment is: Win 2k, MS SQL server 2000, IE 6.
There is a sql script with one created table psoBarCode39, two functions (hex, checksum39 - for control digit) and main procedure psoCode39. The procedure will produce html file on C disk (C:\PsoCode39.htm).IE is needed for penning because Microsoft font embedding technology is used. Sometimes I get numbers instead of barcode so it is recommended to test results in print preview window. Produced barcode is Barcode 39. Allowed characters are :'0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-.(space)$/+%'.
Download SQL code.
Hope you are familiar with next syntax from SQL BOL.
Create HTML page with Barcode39.
Is the number of columns int, with no default,
Is the number of rows int, with no default,
Is the number of pages int(visible only in print preview window), with no default,
Is the height of rows int, with no default.
Is the size of barcode int, with no default.
Is the size of text description bellow barcode int, with no default.
0 means no text description.
Is the text in front of barcode varchar(10), with no default.
'' means no prefix,
Is the number with starting value for auto generate barcode with step 1,
0 means take values from table psoBarCode39, int, with no default.
If 1 check digit is added at end of barcode,
other means no check digit int, with no default.
Some additional settings could be done with IE menu File- Page setup. Delete anything from header and footer. Update margins as needed. Be careful with function invocation in the main procedure.
See Also my previous article on creating PDFs.
You may never need to work with them, but if you do then you will quickly realize how complicated ba...
Having trouble printing a readable 3 of 9 barcode
How can I default prefix length to 0 for fixed width format file
Searching for a barcode Code128 generator function
Question regarding naming prefix
As a member of SQLServerCentral, you get free access to loads of fresh content: thousands
of articles and SQL scripts, a library of free eBooks, a weekly database news roundup,
a great Q & A platform… And it’s our huge, buzzing community of SQL Server Professionals
that makes it such a success.