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
 alphanumeric id column

Author  Topic 

sinjin67
Yak Posting Veteran

53 Posts

Posted - 2008-04-09 : 20:00:52
I have set a column called "Anumber", I am
using a computed value to get the PK ID # and
a the letter "A" to it.

('A'+CONVERT([varchar](10),[requestid],(0)))

The above works fine unless I copy a record,
The copied record never displays the correct
value like "A55" it keeps "NULL" as it value.

Is their a better way to achieve a result as
described above ?

I am coming from Foxpro to SQL, Any advice would
be great.

Thanks

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2008-04-09 : 20:13:35
When you copy a record, what value is in requestid?

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/
Go to Top of Page

sinjin67
Yak Posting Veteran

53 Posts

Posted - 2008-04-09 : 21:14:04
Its The Primary Key and is Numeric type. It starts at number
1001. So it should look at the record I am on like 1002
and when I copy the record it should create record 1003 and
the Anumber column should have A1003
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2008-04-09 : 21:38:06
Post your code.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-04-10 : 04:26:44
Refer this
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=57069


Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

sinjin67
Yak Posting Veteran

53 Posts

Posted - 2008-04-10 : 18:21:56
I look at the link shown, I hate to say it was over my head.
are those examples being used as a trigger ? or how is it applied
in SQL.

I am learning so please bare with me..

Thanx..
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-04-11 : 04:06:25
quote:
Originally posted by sinjin67

I look at the link shown, I hate to say it was over my head.
are those examples being used as a trigger ? or how is it applied
in SQL.

I am learning so please bare with me..

Thanx..


Have a procedure to increament the number every time you insert data
or make use of calculated column
But I prefer doing it in front end application

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -