????SQL Server????????????
???????????? ???????[ 2015/7/30 10:49:26 ] ?????????????
?????????????棬????????????????????????????????м??????????????????????????????????????????????????????????????????????????λ?????????????????????????????????????????????????????????????д???????????????????????д????????ε????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????Σ??????Σ?????y???????DB????????????????????????????????????????????????κ????????SQL????????
???????????????????У?????????????????????????????е?????д???????????????????????????http://www.pcstx.cn
???????????????棺
???????????ε???檔?????????????????????ε??????
???????????????SQL??????檔??????ж???SQL????????????????
????web.config??????????????????????????????????????
???????????????????????????????????ligerUI????????????????Dapper??????????棬????????????????????棬???????????????????????????ū?????????????
???????????????????д???? App_DataconnectionStrings.config ???檔?????д??????????????????????????SQL????????????з????????????????????????????
?????????????Щ?????SQL???
????????????????????????????
????string dbSQL = "select dbid as id??name??crdate as createDate??type='database'??connName='"+connectionStringName+@"' from master..sysdatabases with(nolock) where dbid > 4 order by name;--?????";
?????????????????е????
????string tableSQL = @"select t.object_id as id??t.name as name??t.create_date as createdate??
????t.modify_date as modifydate??s.value as note??databaseName='{0}'?? type='table'??connName='{1}'
????from [{0}].sys.objects t with(nolock)
????left join [{0}].sys.extended_properties s with(nolock) on t.object_id=s.major_id and s.minor_id=0
????where [type] = 'u' and is_ms_shipped=0
????order by name;";
????dbName=dbName.Replace('''??' ');
????tableSQL = string.Format(tableSQL?? dbName??connectionStringName);
?????????????????ε???????
string rowSQL = @" SELECT id=C.column_id??name=C.name??primaryKey=ISNULL(IDX.PrimaryKey??N'')??
rowType=T.name??lenght=C.max_length??isNull=C.is_nullable??defaultValue=ISNULL(D.definition??N'')??
note=ISNULL(PFD.[value]??N'')?? type='row'
FROM [{0}].sys.columns C with(nolock)
INNER JOIN [{0}].sys.objects O with(nolock)
ON C.[object_id]=O.[object_id] AND O.type='U' AND O.is_ms_shipped=0
INNER JOIN sys.types T with(nolock)
ON C.user_type_id=T.user_type_id
LEFT JOIN sys.default_constraints D with(nolock)
ON C.[object_id]=D.parent_object_id AND C.column_id=D.parent_column_id AND C.default_object_id=D.[object_id]
LEFT JOIN sys.extended_properties PFD with(nolock)
ON PFD.class=1 AND C.[object_id]=PFD.major_id AND C.column_id=PFD.minor_id
LEFT JOIN -- ?????????????
( SELECT IDXC.[object_id]??IDXC.column_id??PrimaryKey=IDX.is_primary_key
FROM sys.indexes IDX with(nolock)
INNER JOIN sys.index_columns IDXC with(nolock)
ON IDX.[object_id]=IDXC.[object_id] AND IDX.index_id=IDXC.index_id
) IDX
ON C.[object_id]=IDX.[object_id] AND C.column_id=IDX.column_id
WHERE O.name=@tableName -- ??????????????????????
ORDER BY O.name??C.column_id ";
rowSQL = string.Format(rowSQL?? dbName);
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11