create table query: format field

msmeth
04-13-2004, 12:37 PM
I'd like to run a CREATE TABLE query and have a field (Tag) formatted in a special way. For instance, instead of the Tag being '1', I want it to show as '00000001' in the table. I know it can take the format like that if the field is text, but I'd really prefer to have the field as an integer. I know in Access you can set the Format to '00000000' and it will make sure the leading 0s are there but how do I do this with a CREATE TABLE query? Does anyone know how to do this? Thanx in advance.

CrystalWizard
04-13-2004, 02:39 PM
I don't think that SQL fields format this way w/o declaring it as a text field and reading it in as a string.

My only suggestion would be to add the appropriate amount of 0's to the number as you pull it out of the db.

MKoslof
04-13-2004, 07:53 PM
So you want to create an Integer field type with an initial tag of 00000001? Can I ask why you need this? What is your ultimate goal?

msmeth
04-14-2004, 04:55 AM
So you want to create an Integer field type with an initial tag of 00000001? Can I ask why you need this? What is your ultimate goal?

The values will be inserted into a temporary table and then queried against another whose Tag #s are already in that format, having been autonumbered, because they are serial numbers. What I want is if I have a value of 00000026 entered by the user say, I want it inserted into the temporary table the exact same with with the data type matching the tbl it will be queried against.

MKoslof
04-14-2004, 06:28 AM
The easiest way would be to simply create your table and format the data at run-time before conducting any query.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum