Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
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.
Hi every one I have table "Qualification" with a column "Code" as identity.The problem is in my table i want to have prefix as 'Q' to that identity columnHow can i get this
SwePeso
Patron Saint of Lost Yaks
30421 Posts
Posted - 2008-11-21 : 05:37:01
In your query? SELECT Code AS qCode ...Or in your table? sp_rename...E 12°55'05.63"N 56°04'39.26"
visakh16
Very Important crosS Applying yaK Herder
52326 Posts
Posted - 2008-11-21 : 06:23:27
create a new column on the fly as
SELECT 'Q' + CAST(youridentitycolumn as varchar(10)) AS NewCol,...
alternatively if you want this to held in table create another computed column based on identity column as
CREATE TABLE(IDCol int identity(1,1),....NewCol AS 'Q' + CAST(IDCol AS varchar(10)))
madhivanan
Premature Yak Congratulator
22864 Posts
Posted - 2008-11-21 : 07:33:40
or do it in fornt end applicationMadhivananFailing to plan is Planning to fail