[ת]SQL 2005ÖÐ×Ô¶¯Éú³ÉÊý¾Ý×Öµä
create proc [dbo].[GenerateDataDictionary] as
begin
--»ñÈ¡Êý¾Ý±íÃû
declare @tableid int
declare mycursor Cursor
for select object_id from sys.objects where type='U' and name<>'dtproperties'
--»ñÈ¡×Ö¶ÎÃû³Æ¡¢±êʶ¡¢×Ö¶ÎÐòºÅ¡¢Õ¼ÓÃ×Ö½ÚÊý¡¢Ð¡ÊýλÊý¡¢ÔÊÐí¿ÕµÈ
open mycursor
fetch next from mycursor into @tableid
while(@@fetch_status=0)
begin
print '±íÃû£º'+object_name(@tableid)
select
col.colorder ×Ö¶ÎÐòºÅ,
col.name ×Ö¶ÎÃû,
t.name ÀàÐÍ,
col.length Õ¼ÓÃ×Ö½ÚÊý,
COLUMNPROPERTY(col.id,col.name,'PRECISION') as ³¤¶È,
isnull(COLUMNPROPERTY(col.id,col.name,'Scale'),0) as СÊýλÊý,
(case when
(SELECT count(*)
from sysobjects
WHERE (name in
(SELECT name
from sysindexes
WHERE (id = col.id)
AND (indid in
(SELECT indid
from sysindexkeys
WHERE (id = col.id) AND (colid in
( SELECT colid
from syscolumns
WHERE (id = col.id)
AND (name = col.name)
Ïà¹ØÎĵµ£º
Sql´úÂë
--²ÉÓÃSQLÓï¾äʵÏÖsql2005ºÍExcel Êý¾ÝÖ®¼äµÄÊý¾Ýµ¼Èëµ¼³ö£¬ÔÚÍøÉÏÕÒÀ´Ò»--Ï£¬ÊµÏÖ·½·¨ÊÇÕâÑùµÄ£º
--Excel---->SQL2005 µ¼È룺
select * into useinfo from O ......
ÓÐÈýÕűí LP_COMPANY, LP_COMPANYTYPE,LP_APPLICATION
SQLÓï¾äÊÇ
SELECT b.appname,c.typename,a.ID, a.APPID, a.PROVID, a.CITY, a.DISTRICT, a.TYPEID, a.PARENTID,
a.COMNAME, a.CHARGER, a.LICENSE, a.OPENBANK, a.ACCOUNT, ......
¹ØÓÚDBAµÄ½ÇÉ«
Éú²úDBA
ÊôÓÚ´«Í³DBA½ÇÉ«£¬Êǹ«Ë¾µÄ‘±£µ¥’£¬È·±£Éú²úÊý¾Ý²»»á³ö´í¡£»¹¸ºÔðÈ·±£·þÎñÆ÷Ò»×îÓÅ»¯µÄ·½Ê½ÔËÐУ¬²¢´Ù½øÊý¾Ý¿â´Ó¿ª·¢ÆÚתµ½QAÔÙתµ½Éú²ú¡£
Éú²úDBAµÄÆäËûһЩ½ÇÉ«°üÀ¨ÒÔÏ·½Ã棺
1£© °²×°SQL Server ʵÀýºÍ²¹¶¡°ü¡£
2£© ¼àÊÓÐÔÄÜÎÊÌâ¡£
3£© °²×°À´×Ô¿ª·¢ÈËÔ±µÄ½ ......
Êý¾Ý¿â±íµÄ¼Ç¼Èç¹ûÌ«¶à£¬±ÈÈç´ïµ½ÁË20ÍòÒÔÉÏ£¬ÔÚbosÖÐÒ»´ÎÐÔ²é¼Ç¼×ö´¦Àí¿ÉÄÜ»á³öÏÖoutofmemoryµÄ´íÎó£¬ÎÒÃÇÖ»ÄܲÉÈ¡·Ö¶ÎÈ¡¼Ç¼À´´¦Àí£¬¾ßÌåʾÀýÈçÏ£º
/*dialect*/
With Cust AS
( SELECT fnumber,
ROW_NUMBER() OVER (order by fnumber) as RowNumber  ......
Èç¹ûÄãÕýÔÚ¸ºÔðÒ»¸ö»ùÓÚSQL ServerµÄÏîÄ¿£¬»òÕßÄã¸Õ¸Õ½Ó´¥SQL Server£¬Ä㶼ÓпÉÄÜÒªÃæÁÙһЩÊý¾Ý¿âÐÔÄܵÄÎÊÌ⣬ÕâƪÎÄÕ»áΪÄãÌṩһЩÓÐÓõÄÖ¸µ¼£¨ÆäÖдó¶àÊýÒ²¿ÉÒÔÓÃÓÚÆäËüµÄDBMS£©¡£
ÔÚÕâÀÎÒ²»´òËã½éÉÜʹÓÃSQL ServerµÄÇÏÃÅ£¬Ò²²»ÄÜÌṩһ¸ö°üÖΰٲ¡µÄ·½°¸£¬ÎÒËù×öµÄÊÇ×ܽáһЩ¾Ñé----¹ØÓÚÈçºÎÐγÉÒ»¸öºÃµÄÉè¼Æ ......