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
 Specify a Prefix for Column

Author  Topic 

Windza
Yak Posting Veteran

61 Posts

Posted - 2008-11-03 : 22:35:31
Can anyone enlighten me as to how I can specify a prefix for a column in MS SQL?
We want to distinguish between system generated and manual purchase orders so I want to set a prefix in the DB column such that PO's are generated something like MX0001 rather than 000001.

Is there a property or setting that will allow this?

PeterNeo
Constraint Violating Yak Guru

357 Posts

Posted - 2008-11-03 : 23:09:29
No, there is no such thing in SQL.
You need to specify it while inserting the record.

"There is only one difference between a dream and an aim. A dream requires soundless sleep to see, whereas an aim requires sleepless efforts to achieve..!!"
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-11-03 : 23:16:52
you need to write this logic in your insert code based on a bit field to distinguish b/w system and manually generated orders.Use a temporary table with identity column to get the new incremental values and append 'MX' to it.
Go to Top of Page

Windza
Yak Posting Veteran

61 Posts

Posted - 2008-11-03 : 23:21:12
Thanks ppl... I don't have ready access to the insert code so I'll have to look at the PO report and just include a static text field before the PO number...
Cheers
Go to Top of Page
   

- Advertisement -