tags:

views:

11

answers:

0

Hi,

I got to work on database with read only permission.

Now i wrote a query with a reusable code in it.

the query will be like

select col1, clo2 from tablename

where col1 = substring(substring(x,charindex('\',x),len(x)),0,charindex('\',substring(x)))

here 'x' is my resusable code which would be like below one.

x= stufff(col3,charindex('.',col3),charindex('.',col3,7),'\')

where col3 will be like \adf.fg.d\jhfl\123\

Now the problem is i tried to create an user defined function for that resuable code in a database with readonly permissions but it dint work out for me.. so is there any other way other than userdefined functions

Or if we can do it with userdefined function can you help me with that too