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 |  
                                    | NazimA custom title
 
 
                                        1408 Posts | 
                                            
                                            |  Posted - 2002-03-12 : 00:48:22 
 |  
                                            | Going thru this thread http://www.sqlteam.com/Forums/topic.asp?TOPIC_ID=13742 . i came up with this stored procedure which uses the information from systables and builds a dynamic alter table statement to modify user tables column lenght. but it wouldnt work if any column contains primary key constrains on it.FORGIVE ME SQLTEAM for using Cursors  . create procedure upd_len(@mfindlen int,@mChangelen int)asdeclare c1 cursor forselect c.name Columname,t.name DataType,s.name TableName from syscolumns cinner joinsysobjects son c.id=s.idinner join systypes ton c.xtype=t.xtypewhere c.length=@mfindlen and s.xtype='U' declare @Sql varchar(800)declare @mColumnname varchar(128)declare @mDatatype varchar(128)declare @mtablename varchar(128)beginopen c1fetch next from c1 into @mcolumnname,@mDatatype,@mtablenameWHILE @@FETCH_STATUS = 0BEGIN select @sql='alter table '+@mtablename+ ' alter column ' + @mcolumnname +  ' '+@mDatatype +'('+ltrim(@mChangelen)+')' print @sql exec(@sql) fetch next from c1 into @mcolumnname,@mDatatype,@mtablenameendclose c1deallocate c1endgoeg usageexec upd_len 10,12will change the column lenght of all tables from 10 to 12.--------------------------------------------------------------Edited by - Nazim on 03/12/2002  00:56:37 |  |  
                                |  |  |  |