| Author |
Topic |
|
shemayb
Posting Yak Master
159 Posts |
Posted - 2009-01-05 : 07:11:11
|
| Hi.I really needed your help. Please give me ideas on my scenario..Thank you.My scenario is this.I have a description which has a prefix A or B. For example AFT and BFT.i wanted to get the first letter of my description like in the example i want to get the A and the B.I tried using substring. And luckily i got the first letter.but i do not know what will i do with the next step.The next step is if the first letter of the description that i inserted is A, i will create another one with the same description but replace A with B. For example if i inserted AFT, i will replace it with BFT and insert it again. It's like i'm inserting two descriptions.I know my scenario is confusing, but i will try to explain well if you have any questions.Thank you so much!Funnyfrog |
|
|
sakets_2000
Master Smack Fu Yak Hacker
1472 Posts |
Posted - 2009-01-05 : 07:18:52
|
| Insert another row you mean ? |
 |
|
|
bklr
Master Smack Fu Yak Hacker
1693 Posts |
Posted - 2009-01-05 : 07:19:20
|
| create proc usp_sampleproc(@str varchar(12))asset nocount onbegininsert into urtable select @strinsert into urtable select replace(@str,substring(@str,1,1),'b')endset nocount off |
 |
|
|
bklr
Master Smack Fu Yak Hacker
1693 Posts |
Posted - 2009-01-05 : 07:22:55
|
| or use left also inplace of substringinsert into tt3 select replace(@str,left(@str,1),'b') |
 |
|
|
Jai Krishna
Constraint Violating Yak Guru
333 Posts |
Posted - 2009-01-05 : 07:23:09
|
| insert into urtable select column_nameinsert into urtable select replace(column_name,left(column_name,1),'b')Jai Krishna |
 |
|
|
shemayb
Posting Yak Master
159 Posts |
Posted - 2009-01-05 : 07:43:15
|
| Thank you so much..I will try that.Funnyfrog |
 |
|
|
shemayb
Posting Yak Master
159 Posts |
Posted - 2009-01-05 : 07:43:51
|
| yes, insert another rowFunnyfrog |
 |
|
|
bklr
Master Smack Fu Yak Hacker
1693 Posts |
Posted - 2009-01-05 : 07:44:31
|
ur welcome |
 |
|
|
shemayb
Posting Yak Master
159 Posts |
Posted - 2009-01-05 : 07:52:09
|
That was really a great help for me:) Funnyfrog |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-01-05 : 08:36:06
|
isnt this enough?INSERT INTO TableSELECT 'B'+SUBSTRING(Col,2,LEN(Col))FROM TableWHERE LEFT(Col,1)='A' |
 |
|
|
|