sql 程序para indexar tablas de Gestar

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sql 程序para indexar tablas de Gestar相关的知识,希望对你有一定的参考价值。

'Usar en Exec.aspSet oDomForms = dSession.FormsList()for each onode in oDomForms.documentElement.childNodes	response.write "<br>exec fulltext_createindex 'sys_fields_"&onode.getAttribute("id")&"';"next
/*Verificar nombre del catalogo en entorno productivo*/
GO
/****** Object:  StoredProcedure [dbo].[FULLTEXT_CREATEINDEX]    Script Date: 09/06/2017 13:13:48 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER procedure [dbo].[FULLTEXT_CREATEINDEX](@table varchar(200), @catalog varchar(200) = 'FT_Gestar')
as

declare mycurs cursor for
    select column_name from user_tab_columns
        where table_name = @table and is_computed = 0 and
        data_type in ('varchar', 'nvarchar', 'char', 'nchar', 'text', 'ntext')

declare @col varchar(200)
declare @sqlt varchar(1000)
declare @sqlc varchar(1000)
declare @pk varchar(200)

begin
    set @table = upper(@table)
    set @sqlt = ''

    if objectproperty(object_id(@table), 'TableHasActiveFulltextIndex') = 1
    begin
        set @sqlt = 'sp_fulltext_table N''[dbo].[' + @table + ']'', N''drop'''
        execute (@sqlt)
    end
 
    select @pk = NAME from SYSOBJECTS where XTYPE = 'PK' and PARENT_OBJ = 
        (select ID from SYSOBJECTS where NAME = @table)
 
    open mycurs
    fetch next from mycurs into @col 
    if @@fetch_status = 0
    begin
        set @sqlt = 'sp_fulltext_table N''[dbo].[' + @table + ']'', N''create'', N''' + @catalog + ''', N''' + @pk + ''''
        execute (@sqlt)
    end
 
    while @@fetch_status = 0
    begin
        set @sqlc = 'sp_fulltext_column N''[dbo].[' + @table + ']'', N''' + @col + ''', ''add'', 0x0c0a'
        execute (@sqlc)
        fetch next from mycurs into @col
    end

    if @sqlt <> ''
    begin
        set @sqlt = 'sp_fulltext_table N''[dbo].[' + @table + ']'', N''activate'''
        execute (@sqlt)
        set @sqlt = 'sp_fulltext_table N''[dbo].[' + @table + ']'', N''start_change_tracking'''
        execute (@sqlt)
        set @sqlt = 'sp_fulltext_table N''[dbo].[' + @table + ']'', N''start_background_updateindex'''
        execute (@sqlt)
    end
    
    close mycurs
    deallocate mycurs    
end

以上是关于sql 程序para indexar tablas de Gestar的主要内容,如果未能解决你的问题,请参考以下文章

sql SQL脚本para listar todas las tablas de una base de datos

sql Compara tablas para buscar elementos que existan en una y no en la otra。来自:http://stackoverflow.

背景图像para las filas de una tabla

Sintaxis bÃsica/习惯性SQL para consulta tipo选择

text SQL Anywhere卸载y重新加载Consola tabla por tabla

sql Listado de SP的y Tablas