Hi guys, Please help me with this ASAP I got a code which is reused so many times in my query...it's a long code..i want to know wether i can set a name to that code and use that name instead of that code..i tried of using userdefined function but i couldnt get that as i'm not that much practised on that.. so here is the code.. (substring(stuff(column,CHARINDEX('.', column),CHARINDEX('',column,3)-CHARINDEX('.',column),''),0,charindex('',stuff(column,CHARINDEX('.', column),CHARINDEX('',column,3)-CHARINDEX('.',column),''),charindex('',stuff(column,CHARINDEX('.', column),CHARINDEX('',column,3)-CHARINDEX('.',column),''),charindex('',stuff(column,CHARINDEX('.', column),CHARINDEX('',column,3)-CHARINDEX('.',column),''),3)+1)+1)),column) i need to use the above code for so many times in my query the output of that code is a string.. in breif the string will be like \tomkit.sun.ekabsfree og if i use the above code for this string i'll get the result as \tomkitabsfree in the above code colum=\tomkit.sun.ekabsfree og Thanq in advance