Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 add 1 to field

Author  Topic 

parry02
Starting Member

18 Posts

Posted - 2006-06-12 : 05:47:02
I have a database call Reference with 2 fields
1) reference prefix
2) reference number

I would like to set the prefix to REFOO
and reference number to be incremented by 1 everytime the table is executed ....
How do I do it please ??????????

RyanRandall
Master Smack Fu Yak Hacker

1074 Posts

Posted - 2006-06-12 : 05:56:50
parry02 - you're not getting your terminology quite right. A database can't have fields - a database has tables, each of which has fields (loosely speaking). And what do you mean by 'table is executed'? If you mean every time a record is inserted into the table, read about 'identity' columns. These links should help you...

http://www.w3schools.com/sql/default.asp
http://www.firstsql.com/tutor.htm
http://www.sql-tutorial.net/

Ryan Randall
www.monsoonmalabar.com London-based IT consultancy

Solutions are easy. Understanding the problem, now, that's the hard part.
Go to Top of Page
   

- Advertisement -