从内存中查询表字段定义的长度大小

SELECT TABLE_NAME AS TableName , COLUMN_NAME As ColumnName, CHARACTER_MAXIMUM_LENGTH As MaxCharacters
FROM INFORMATION_SCHEMA.COLUMNS
WHERE table_name IN
(SELECT name
FROM sys.Tables
Where name like '%Translation')
AND
COLUMN_NAME NOT IN ('Id', 'Language', 'IsSynchronized', 'tVersion') AND TABLE_NAME='AccountTranslation' AND COLUMN_NAME='Description'
order by TABLE_NAME + COLUMN_NAME

 

 

2.

// adds the correct data to the _dynamic table, if it hasn't already exsited
string f = " INSERT INTO _dynamic (Id, SystemFeatureAreaId) ";
f += " SELECT '" + textCode + "', '" + systemFeatureAreaId + "' WHERE NOT EXISTS (SELECT NULL FROM _dynamic WHERE ";
f += " Id = '" + textCode + "' AND SystemFeatureAreaId = '" + systemFeatureAreaId + "') ";

posted on 2012-06-02 22:17  cw_volcano  阅读(249)  评论(0编辑  收藏  举报