Click to See Complete Forum and Search --> : Updating Table Definitions - Field Description


George1111
May 2nd, 2007, 10:35 AM
In design mode each Field in a Table has a Field Name, Field Type, Field Length etc, and also a "Field Description" .

How can I programmatically enter some data into this Field Description and update the Database Table Definitions with the changes

I am running SQLExpress 2005

Thanks for any ideas

TheCPUWizard
May 2nd, 2007, 10:43 AM
"ALTER TABLE" is the best starting point....

http://search.msdn.microsoft.com/search/Default.aspx?brand=msdn&locale=en-us&query=%22alter+column%22

George1111
May 3rd, 2007, 07:31 AM
Apparently this is how you would change the field descriptions in SQL2000 - my problem is I would like to do it in SQL2005 Express




1) Open SQL Analyzer
2) select the desired database (e.g. pubs)
3) run following command from the sql editor

USE pubs
EXEC sp_configure 'allow updates', '1'
RECONFIGURE WITH OVERRIDE


4) run following command from the sql editor


delete from sysproperties


5) run following command from the sql editor


INSERT INTO sysproperties (id, smallid, type, name, value)
SELECT sysobjects.id, syscolumns.colid, 4, 'MS_Description', syscolumns.name
FROM sysobjects
INNER JOIN syscolumns ON sysobjects.id = syscolumns.id
INNER JOIN systypes ON syscolumns.xtype = systypes.xtype
WHERE (sysobjects.xtype = 'U' OR sysobjects.xtype = 'V')
AND (systypes.name <> 'sysname') AND (systypes.status <= 2)
AND (systypes.xusertype <= 256)ORDER BY syscolumns.colorder


6) sysproperties.value is the DESCRIPTION field. open sysproperties table in edit mode and do the necessary correction.


select * from sysproperties


7) After all the changes done with sysproperties table, run following command from the sql editor

USE pubs
EXEC sp_configure 'allow updates', '0'
RECONFIGURE WITH OVERRIDE

-x-x-x-x-x-x-x-