mssqlÀïsp_MSforeachtableºÍsp_MSforeachdbµÄÓ÷¨
´Ómssql6.5¿ªÊ¼£¬Î¢ÈíÌṩÁËÁ½¸ö²»¹«¿ª£¬·Ç³£ÓÐÓõÄϵͳ´æ´¢¹ý³Ìsp_MSforeachtableºÍsp_MSforeachdb£¬ÓÃÓÚ±éÀúij¸öÊý¾Ý¿âµÄÿ¸ö±íºÍ±éÀúDBMS¹ÜÀíϵÄÿ¸öÊý¾Ý¿â¡£
ÎÒÃÇÔÚmasterÊý¾Ý¿âÀïÖ´ÐÐÏÂÃæµÄÓï¾ä¿ÉÒÔ¿´µ½Á½¸öprocÏêϸµÄ´úÂë
use master
exec sp_helptext sp_MSforeachtable
exec sp_helptext sp_Msforeachdb
sp_MSforeachtableϵͳ´æ´¢¹ý³ÌÓÐ7¸ö²ÎÊý£¬½âÊÍÈçÏ£º
@command1 nvarchar£¨2000£©, --µÚÒ»ÌõÔËÐеÄT-SQLÖ¸Áî
@replacechar nchar£¨1£© = N'?', --Ö¸¶¨µÄռλ·ûºÅ
@command2 nvarchar£¨2000£©= null,--µÚ¶þÌõÔËÐеÄT-SQLÖ¸Áî
@command3 nvarchar£¨2000£©= null, --µÚÈýÌõÔËÐеÄT-SQLÖ¸Áî
@whereand nvarchar£¨2000£©= null, --¿ÉÑ¡Ìõ¼þÀ´Ñ¡Ôñ±í
@precommand nvarchar£¨2000£©= null, --ÔÚ±íÇ°Ö´ÐеÄÖ¸Áî
@postcommand nvarchar£¨2000£©= null --ÔÚ±íºóÖ´ÐеÄÖ¸Áî
sp_MSforeachdb³ýÁË@whereandÍ⣬ºÍsp_MSforeachtableµÄ²ÎÊýÊÇÒ»ÑùµÄ¡£
--ÎÒÃÇÀ´¿´¿´sp_MSforeachtableµÄÓ÷¨£¨sp_MSforeachdbµÄÓ÷¨ÀàËÆ£©£º
--ͳ¼ÆÊý¾Ý¿âÀïÿ¸ö±íµÄÏêϸÇé¿ö£º
exec sp_MSforeachtable @command1="sp_spaceused '?'"
--¼ì²éÊý¾Ý¿âÀïÿ¸ö±í»òË÷ÒýÊÓͼµÄÊý¾Ý¡¢Ë÷Òý¼°text¡¢ntext ºÍimage Ò³µÄÍêÕûÐÔ
--ÏÂÁÐÓï¾äÐèÔÚµ¥Óû§Ä£Ê½ÏÂÖ´ÐУ¨sp_dboption 'db_name', 'single user', 'true'£©,½«true¸Ä³Éfalse¾ÍÓÖ±ä³É¶àÓû§ÁË
exec sp_msforeachtable "dbcc checktable('?',repair_rebuild)"
Ïà¹ØÎĵµ£º
ÍøÕ¾¸ü»»¿Õ¼äµÄʱºò£¬¾³£»áÒòΪMSSQLÊý¾Ý¿âÃû²»Í¬£¬µ¼Ö´Ӿɿռ䱸·ÝµÄÊý¾Ý¿âÔÚпռ仹ԺóÎÞ·¨Õý³£Ê¹Óá£Õâʱºò£¬ÎÒÃÇ¿ÉÒÔͨ¹ý½«Êý¾Ý¿â±íµÄËùÓÐÕßÐÞ¸ÄΪ"dbo"À´½â¾öÕâ¸öÎÊÌ⣬¾ßÌåµÄ·½·¨ÈçÏ£º
´ò¿ª"Microsoft SQL Server"µÄ“ÆóÒµ¹ÜÀíÆ÷”£¬µã¿ªÒªÐ޸ĵÄÊý¾Ý¿â£¬Ñ¡Ôñ¹¤¾ßÀ¸Éϵē¹¤¾ß” ......
ÏÂÃæÊÇORACLEÐÐÁÐת»»Í¨Óô洢¹ý³Ì£º
1¡¢
Function Fun_Split_Str(p_Str Varchar2, p_Division Varchar2, p_Seq Int)
Return Varchar2 Is
v_First Int;
v_Last Int;
Begin
If p_Seq < 1 Then
&nbs ......
xtype ´ú±íÀàÐÍ
C = CHECK Ô¼Êø
D = ĬÈÏÖµ»ò DEFAULT Ô¼Êø
F = FOREIGN KEY Ô¼Êø
L = ÈÕÖ¾
FN = ±êÁ¿º¯Êý
IF = ÄÚǶ±íº¯Êý
P = ´æ´¢¹ý³Ì
PK = PRIMARY KEY Ô¼Êø£¨ÀàÐÍÊÇ K£©
RF = ¸´ÖÆɸѡ´æ´¢¹ý³Ì
S = ϵͳ±í
TF = ±íº¯Êý
TR = ´¥· ......
sql´æ´¢¹ý³Ì½Ì³Ì
[ËѼ¯ÕûÀí]sql´æ´¢¹ý³ÌÍêÈ«½Ì³Ì
Ŀ¼
1.sql´æ´¢¹ý³Ì¸ÅÊö
2.SQL´æ´¢¹ý³Ì´´½¨
3.sql´æ´¢¹ý³Ì¼°Ó¦ÓÃ
4.¸÷ÖÖ´æ´¢¹ý³ÌʹÓÃÖ¸ÄÏ
5.ASPÖд洢¹ý³Ìµ÷ÓõÄÁ½ÖÖ·½Ê½¼°±È½Ï
6.SQL´æ´¢¹ý³ÌÔÚ.NETÊý¾Ý¿âÖеÄÓ¦ÓÃ
7.ʹÓÃSQL´æ´¢¹ý³ÌÒªÌرð×¢ÒâµÄÎÊÌâ
1.sql´æ´¢¹ý³Ì¸ÅÊö
ÔÚ´óÐÍÊý¾Ý¿âϵͳÖУ¬´æ´ ......