sql - SYBASE Nested query not running -


i have procedure writing , contains nested insert nested insert never runs. nested insert's data filled out select statements insert never ran.

     create procedure search_string #invalue varchar(255)         begin     set nocount on     create table #results (table_name sysname, column_name sysname)     select     "insert #results select distinct '"     + object_name(c.id)     + "' table_name, '"     + c.name     + "' column_name "     + object_name(c.id)     + " "     + c.name     + " '%"     + @invalue     + "%'"     syscolumns c, sysobjects o         c.usertype in ( 1     ,2     ,18     ,19     ,24     ,25     ,42     )     , o.type ='u'     , o.id = o.id     , c.length >= datalength(@invalue)     select * #results     end 

this yields bunch of insert statements never run.

try below code :

   create procedure search_string #invalue varchar(255)         begin     set nocount on     create table #results (table_name sysname, column_name sysname)     declare @sql varchar(255)      select @sql = 'insert #results      select distinct       object_name(c.id)       table_name,       c.name       column_name      object_name(c.id)             c.name       ''' +      @invalue      '%''     syscolumns c, sysobjects o         c.usertype in ( 1     ,2     ,18     ,19     ,24     ,25     ,42     )     , o.type =''u''     , o.id = o.id     , c.length >= datalength(''' + @invalue ''')'      execute(@sql)      select * #results     end 

i hope :)


Comments

Popular posts from this blog

c++ - QTextObjectInterface with Qml TextEdit (QQuickTextEdit) -

javascript - angular ng-required radio button not toggling required off in firefox 33, OK in chrome -

xcode - Swift Playground - Files are not readable -