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.
| Author |
Topic |
|
paramu
Posting Yak Master
151 Posts |
Posted - 2009-06-01 : 09:04:19
|
| Hi,I want to update the table like the following manner. Field "Item_type" is having the data'sASMBSDRVFASMTYPBSDASMBut I want to update like the followingASM1BSD1RVF1ASM2TYP1BSD2ASM3like wise ...means when the value is found again, need to increase the counterupdate itm_code set itm_code=count(itm_type) from item_master....????Paramu @ PARANTHAMAN |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2009-06-01 : 09:17:59
|
make use of row_number()select item_type + convert(varchar(10), row_number() over (partition by item_type order by item_type))from item_master KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
paramu
Posting Yak Master
151 Posts |
Posted - 2009-06-01 : 11:26:33
|
| Not Enough.Nedd to repair it........"select itm_code,substring(itm_description,1,3) as Itm_type,substring(itm_description,1,3)+convert (varchar(10), row_number() over (substring(itm_description,1,3)) order by substring(itm_description,1,3)) as Record_number from itemmst"ThanksParamu @ PARANTHAMAN |
 |
|
|
|
|
|
|
|