| Author |
Topic |
|
nickjack
Starting Member
34 Posts |
Posted - 2008-11-07 : 01:29:07
|
| Hi,I need a Series Like Q1, Q2 and So on.... |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-11-07 : 01:37:35
|
| http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=57069MadhivananFailing to plan is Planning to fail |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-11-07 : 01:42:22
|
| Create an identity column and computed column based on identity column to append the series aplhabet. |
 |
|
|
nickjack
Starting Member
34 Posts |
Posted - 2008-11-07 : 01:48:29
|
| sample code ? |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-11-07 : 01:58:25
|
| [code]CREATE TABLE #Temp(ID int identity(1,1),Test varchar(11),Seq AS 'Q'+CAST(ID as varchar(4)))INSERT INTO #Temp (Test)SELECT 'val1' union allSELECT 'val2' union allSELECT 'val3' union allSELECT 'val4' union allSELECT 'val5' select * from #Tempdrop table #Tempoutput----------------------ID Test Seq1 val1 Q12 val2 Q23 val3 Q34 val4 Q45 val5 Q5[/code] |
 |
|
|
nickjack
Starting Member
34 Posts |
Posted - 2008-11-07 : 04:02:38
|
| HiI have table Col1 Col2 Col3ID QuestionNo QuestionText1 Q1 Hi?and Also need a Procedure who insert value like Q1,Q2 and so on.. only Question No |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-11-07 : 04:13:08
|
quote: Originally posted by nickjack HiI have table Col1 Col2 Col3ID QuestionNo QuestionText1 Q1 Hi?and Also need a Procedure who insert value like Q1,Q2 and so on.. only Question No
you are not giving enough informationMadhivananFailing to plan is Planning to fail |
 |
|
|
nickjack
Starting Member
34 Posts |
Posted - 2008-11-07 : 07:02:34
|
| In my table i have 3 column say c1,c2,c3C1 C2 C3Id QuestionNumber QuestionTextwhat i need:1)A procedure ?2)which makes my C2 column auto incremented in a form Q1, Q2,Q3 and so on..... |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-11-07 : 07:07:33
|
| DId you see query i posted. Create a table as suggested then simply use a procedure to insert values just as i did. |
 |
|
|
nickjack
Starting Member
34 Posts |
Posted - 2008-11-08 : 01:46:18
|
| And If i need Like Q001 in Place Of Q1 then |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-11-08 : 03:53:55
|
| CREATE TABLE #Temp(ID int identity(1,1),Test varchar(11),Seq AS 'Q'+ RIGHT('00' + CAST(ID as varchar(4)),3)) |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-11-10 : 00:40:02
|
quote: Originally posted by nickjack And If i need Like Q001 in Place Of Q1 then
Also did you read the link I posted?MadhivananFailing to plan is Planning to fail |
 |
|
|
|