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
 SQL Server 2000 Forums
 SQL Server Development (2000)
 How to add prefix at database design stage

Author  Topic 

ryanlcs
Yak Posting Veteran

62 Posts

Posted - 2009-03-31 : 05:25:14
I have a column (PR_No) which having a formula "([PRMaster_RKey])" that inherits all the value from column "PRMaster_RKey". Thisis working fine.

But on top of this, I wanted to add a prefix to the value, something like "PR-" follow by the value from column "PRMaster_RKey", how can I do that at design stage?

Thanks.

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2009-03-31 : 05:29:16
ALTER TABLE
ALTER COLUMN PR_No AS ('PR-' + CAST(PRMaster_Key AS VARCHAR(12)))



E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page

dsindo
Starting Member

45 Posts

Posted - 2009-03-31 : 15:00:39
select 'PR-'+cast(RPmaster_RKey as varchar(50)) from urtable
Go to Top of Page
   

- Advertisement -