Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with Stored procedure

Status
Not open for further replies.

MikeTom

Programmer
Aug 17, 2001
98
GB
I am trying to write a stored procedure where i select a bacode field from a table then convert the barcode to numeric (from Varchar).if i get an error in converting it is because their was an error when scanned(non nUmeric Characters) or it wasnot sacanned and i want to output the record id to an error table. if it succeeds in the conversion i want to strip out the last two digits and save them and the third last digit and save, that is if their is 16 digits in the barcode otherwise another error into the error table.

Can anyone help with examples.
 
There is a nifty little function called IsNumeric that you can use to check if the data in a sting can be converted to numeric data. You can use this to identify your records that will not convert. In terms overall of how you set things up, it would depend on exactly what you are trying to do.
Are you planning to actually convert the field or send the data to a different field with a numeric or send the data from one table (say one used for data collection from a bar code reader)with a varchar field for barcode to a diferent table (say one used for querying and analyzing the data like an Inventory table)? If you are planning to convert the data, what are you going to do when you want to scan more data in as your barcode reader evidently collects the data in string form?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top