Please start any new threads on our new 
    site at https://forums.sqlteam.com.  We've got lots of great SQL Server
    experts to answer whatever question you can come up with.
    
        | 
                
                    | 
                            
                                | Author | Topic |  
                                    | Dhudson29Starting Member
 
 
                                        23 Posts | 
                                            
                                            |  Posted - 2014-10-28 : 12:28:54 
 |  
                                            | I am trying to actually execute the ALTER FULLTEXT COMMAND in this code, but really don't know how.  I debugged it and it actually assigns the database name, which is what I want, but then I need it to actually execute the command for each database.  Can some help please?--Declare Variable for selecting database filesDECLARE @SELDATABASE VARCHAR(255)DECLARE @NAME VARCHAR(255)DECLARE @RUNCATALOG VARCHAR(255)SET @NAME = ''DECLARE fulltextcatalog_cursor CURSOR FORSelect name FROM MASTER.SYS.DATABASES OPEN fulltextcatalog_cursorFETCH NEXT FROM fulltextcatalog_cursorINTO @nameWHILE @@FETCH_STATUS = 0BEGIN	SELECT @SELDATABASE = 'USE [' + @NAME + ']'	FROM MASTER.SYS.DATABASES	SELECT @RUNCATALOG = 'ALTER FULLTEXT CATALOG' + ' ' + @NAME  + ' ' + 'REBUILD'	Print ' catalog name is ' + @NAME	FETCH NEXT FROM fulltextcatalog_cursor	INTO @nameENDCLOSE fulltextcatalog_cursorDEALLOCATE fulltextcatalog_cursorGO |  |  
                                    | gbrittonMaster Smack Fu Yak Hacker
 
 
                                    2780 Posts | 
                                        
                                          |  Posted - 2014-10-28 : 13:18:19 
 |  
                                          | there's an undocumented procedure for that: http://weblogs.sqlteam.com/joew/archive/2008/08/27/60700.aspx |  
                                          |  |  |  
                                |  |  |  |