I am looking for the way to autogenerate a unique number so I can key from it. I know it is Autonumber() in access but what default do I need to give the row????
Hi, Grimmy!
May be I don't undertand the question but
It is a little strange :
If you select the Autonumber() - you cannot set the default number for this field and it should be not not logic if you could to do that...
Autonumber is the automatic number...
What I am trying to do is generate a unique number for each record in a table. I am wanting to do something similar to the GETDATE() inbuilt function which automatically adds the date to that field.
What I was saying is that to do this in access you can select autonumber as a data type which will automatically generate a unique number for that record.
What is the similar command in SQL, I am assuming that when you go into a table through enterprise manager you need to insert something into the default column as you would with the GETDATE() function.
If I understood your question, you want to create in sql server via the Enterprise manager a table that will have the Field with authomatic incremented number like Autonumber in access?
In this case you need to do the next thing:
Create new table
Add new field with the next charateristics:
'ColumnName' = 'RecID'
'DataType'=int
'Lenght','Precision','Scale' - will be filled authomatically
'AllowNulls'=false
'Identify'=true
'Indentify Seed' and 'Indentify Increment' will be filled automatically
Add some new fields just for demo..
Now , if you will browse this table and add new records
your 'RecID' field will be filled out automatically...
DOn't try to put values into the RecID
You will get error...
and don't entirely don't need to give the default value - it will care for this automatically
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.