SqlÓï¾ä´´½¨±í
н¨±í£º
create table [±íÃû]
(
[×Ô¶¯±àºÅ×Ö¶Î] int IDENTITY (1,1) PRIMARY KEY ,
[×Ö¶Î1] nVarChar(50) default \'ĬÈÏÖµ\' null ,
[×Ö¶Î2] ntext null ,
[×Ö¶Î3] datetime,
[×Ö¶Î4] money null ,
[×Ö¶Î5] int default 0,
[×Ö¶Î6] Decimal (12,4) default 0,
[×Ö¶Î7] image null ,
)
ɾ³ý±í£º
Drop table [±íÃû]
²åÈëÊý¾Ý£º
INSERT INTO [±íÃû] (×Ö¶Î1,×Ö¶Î2) VALUES (100,\'51WINDOWS.NET\')
ɾ³ýÊý¾Ý£º
DELETE from [±íÃû] WHERE [×Ö¶ÎÃû]>100
¸üÐÂÊý¾Ý£º
UPDATE [±íÃû] SET [×Ö¶Î1] = 200,[×Ö¶Î2] = \'51WINDOWS.NET\' WHERE [×Ö¶ÎÈý] = \'HAIWA\'
ÐÂÔö×ֶΣº
ALTER TABLE [±íÃû] ADD [×Ö¶ÎÃû] NVARCHAR (50) NULL
ɾ³ý×ֶΣº
ALTER TABLE [±íÃû] DROP COLUMN [×Ö¶ÎÃû]
ÐÞ¸Ä×ֶΣº
ALTER TABLE [±íÃû] ALTER COLUMN [×Ö¶ÎÃû] NVARCHAR (50) NULL
ÖØÃüÃû±í£º(Access ÖØÃüÃû±í£¬Çë²Î¿¼ÎÄÕ£ºÔÚAccessÊý¾Ý¿âÖÐÖØÃüÃû±í)
sp_rename \'±íÃû\', \'бíÃû\', \'OBJECT\'
н¨Ô¼Êø£º
ALTER TABLE [±íÃû] ADD CONSTRAINT Ô¼ÊøÃû CHECK ([Ô¼Êø×Ö¶Î] <= \'2000-1-1\')
ɾ³ýÔ¼Êø£º
ALTER TABLE [±íÃû] DROP CONSTRAINT Ô¼ÊøÃû
н¨Ä¬ÈÏÖµ
ALTER TABLE [±íÃû] ADD CONSTRAINT ĬÈÏÖµÃû DEFAULT \'51WINDOWS.NET\' FOR [×Ö¶ÎÃû]
ɾ³ýĬÈÏÖµ
ALTER TABLE [±íÃû] DROP CONSTRAINT ĬÈÏÖµÃû
ɾ³ýSql Server ÖеÄÈÕÖ¾£¬¼õСÊý¾Ý¿âÎļþ´óС
dump transaction Êý¾Ý¿âÃû with no_log
backup log Êý¾Ý¿âÃû with no_log
dbcc shrinkdatabase(Êý¾Ý¿âÃû)
exec sp_dboption \'Êý¾Ý¿âÃû\', \'autoshrink\', \'true\'
\\\'Ìí¼Ó×Ö¶ÎͨÓú¯Êý
Sub AddColumn(TableName,ColumnName,ColumnType)
Conn.Execute(\"Alter Table \"&TableName&\" Add \"&ColumnName&\" \"&ColumnType&\"\")
End Sub
\\\'¸ü¸Ä×Ö¶ÎͨÓú¯Êý
Sub ModColumn(TableName,ColumnName,ColumnType)
Conn.Execute(\"Alter Table \"&TableName&\" Alter Column \"&ColumnName&\" \"&ColumnType&\"\")
End Sub
\\\'¼ì²é±íÊÇ·ñ´æÔÚ
sql=\"select count(*) as dida from sysobjects where id = object_id(N\'[ËùÓÐÕß].[±íÃû]\') and OBJECTPROPERTY(id, N\'IsUserTable\') = 1\"
set rs=conn.execute(sql)
response.write rs(\"dida\")\'·µ»ØÒ»¸öÊýÖµ£¬0´ú±íûÓУ¬1´ú±í´æÔÚ
ÅжϱíµÄ´æÔÚ:
select *
Ïà¹ØÎĵµ£º
¡¡Äã¿ÉÄܳ£³£»áÐèÒªÔËÐÐÒ»¸öad hoc²éѯ´ÓÔ¶³ÌOLE DBÊý¾ÝÔ´ÌáÈ¡Êý¾Ý£¬»òÕßÅúÁ¿ÏòSQL Server±íµ¼ÈëÊý¾Ý¡£ÔÚÕâÖÖÇé¿öÏ£¬Äã¿ÉÒÔÔÚT-SQL(Transact-SQL£¬Î¢Èí¶ÔSQLµÄÀ©Õ¹)ÖÐÓÃOPENROWSETº¯Êý¸øÊý¾ÝÔ´´«ÈëÒ»¸öÁ¬½Ó´®ºÍ²éѯÀ´ÌáÈ¡ÐèÒªµÄÊý¾Ý¡£
¡¡¡¡Äã¿ÉÄܳ£³£»áÐèÒªÔËÐÐÒ»¸öad hoc²éѯ´ÓÔ¶³ÌOLE DBÊý¾ÝÔ´ÌáÈ¡Êý¾Ý£¬»òÕßÅúÁ¿ÏòSQL ......
¶ÔÓÚSQL ServerÊý¾Ý¿â¹ÜÀíÔ±À´½²£¬ÒÑÂúÊÂÎñÈÕÖ¾ÊÇÒ»¸öËöËéµÄ£¬µ«Óֺܳ£¼ûµÄÎÊÌâ¡£ËüÄÜÒý·¢ÊÂÎñµÄÌáÇ°ÖÕÖ¹£¬ÉõÖÁͨ¹ý×èÖ¹ËùÓÐÊÂÎñµÄÒýÈ룬´Ó¶øÒýÆðϵͳµÄ±ÀÀ£¡£¶ÔÓÚÊý¾Ý¿â¹ÜÀíÔ±À´Ëµ£¬¹Ø¼üÊÇÀí½â½«Òª·¢ÉúµÄÇé¿ö£¬ÒÔ±ãËûÃÇ¿ÉÒÔ×·×ÙÒýÆðÎÊÌâµÄÔÒò¡£ ÊÂÎñÈÕÖ¾Ìî³ä·½Ê½
¡¡¡¡ÒÔÏÂÊÇһЩ¿ÉÄÜÒýÆðÊÂÎñÈÕÖ¾ÌîÂúµÄÔÒò£º
¡¡¡¡ÌîÂúµ ......
¡¡¡¾IT168 ¼¼ÊõÎĵµ¡¿¹ÊÊ¿ªÆª£ºÄãºÍÄãµÄÍŶӾ¹ý²»Ð¸Å¬Á¦£¬ÖÕÓÚʹÍøÕ¾³É¹¦ÉÏÏߣ¬¸Õ¿ªÊ¼Ê±£¬×¢²áÓû§½ÏÉÙ£¬ÍøÕ¾ÐÔÄܱíÏÖ²»´í£¬µ«Ëæ×Å×¢²áÓû§µÄÔö¶à£¬·ÃÎÊËٶȿªÊ¼±äÂý£¬Ò»Ð©Óû§¿ªÊ¼·¢À´Óʼþ±íʾ¿¹Ò飬ÊÂÇé±äµÃÔ½À´Ô½Ô㣬ΪÁËÁôסÓû§£¬Ä㿪ʼ×ÅÊÖµ÷²é·ÃÎʱäÂýµÄÔÒò¡£
¡¡¡¡¾¹ý½ôÕŵĵ÷²é£¬Äã·¢ÏÖÎÊÌâ³öÔÚÊý¾Ý¿âÉÏ£¬µ±Ó¦ ......
×÷ΪһÃûÊý¾Ý¿âDBA£¬¿Ï¶¨»áÌý˵¹ý“tempdbÊý¾Ý¿âÂúÁË”¡£Í¨³£ÎÒÃǺÜÈÝÒ×È·¶¨Ôì³ÉÕâÒ»ÎÊÌâµÄÔÒò¡£µ«ÊǸü¶àµÄʱºòÕâÒ»ÎÊÌâÖ÷ÒªÔ´ÓÚÒ»×éÇëÇó£¬Éæ¼°µ½Ð´úÂ벿Êð»òÖð½¥Ôö¼ÓµÄÊý¾Ý¡£
¡¡¡¡“TempdbÂúÁË”Òâζ×Åʲô?
¡¡¡¡µ±SQL Server tempdbÂúÁËʱ£¬Éϲã¹ÜÀí³£³£ÐèÒª¾ö²ß¡¢Ò»Ð©¿ª·¢ÈËÔ±¿ÉÄÜ»áÍÆжÔðÈΣ¬¾ ......