Forum Replies Created

Viewing post 1 (of 1 total)

  • RE: How to find dependencies in dynamic sql queries

    hi,

    to do this i wrote this query:

    declare @d varchar(max)='this is my query'

    declare @d_trim varchar(max)=replace(replace(replace(replace(REPLACE(@d,CHAR(13),''),char(10),''),' ',''),'[',''),']','')

    select *

    from

    (

    select CHARINDEX(t1.name,@d)c,

    SUBSTRING(@d,CHARINDEX(t1.name,@d)-5,LEN(t1.name)+10)x,

    SUBSTRING(@d,CHARINDEX(t1.name,@d)-1,1)L,

    ascii(SUBSTRING(@d,CHARINDEX(t1.name,@d)-1,1))L_ascii,

    SUBSTRING(@d,CHARINDEX(t1.name,@d)+LEN(t1.name),1)R,

    ...

Viewing post 1 (of 1 total)