Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

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 *


Ïà¹ØÎĵµ£º

ÀûÓö¯Ì¬¹ÜÀíÊÓͼÌá¸ßSQL ServerË÷ÒýЧÂÊ

¡¡¾ÍÈçͬÊý¾Ý¿âDBAÁ˽âµÄÒ»Ñù£¬ºÏÊʵÄË÷ÒýÄܹ»Ìá¸ß²éѯÐÔÄܺÍÓ¦ÓóÌÐò¿É²âÁ¿ÐÔ¡£µ«ÊÇÿ¸ö¸½¼ÓµÄË÷Òý£¬¶¼¸øϵͳÔö¼ÓÁ˶îÍ⿪Ïú£¬ÒòΪËæ×ÅÊý¾Ý´Ó±íºÍÊÓͼÖ⻶ÏÔö¼Ó¡¢Ð޸ĻòÇå³ý£¬SQL ServerÐèҪά»¤ÕâЩË÷Òý¡£
¡¡¡¡Ö®Ç°£¬ÎÒ½éÉÜÁËһ϶¯Ì¬¹ÜÀíÊÓͼ(DMV)¡£ËüÊÇÒ»ÖÖºÜÓÐÓõļà¿ØºÍ½â¾öSQL Server¹ÊÕϵŤ¾ß¡£±¾ÎÄÊÇËüµÄÐøƪ£¬ ......

Statement µÄ execute(sql) ·½·¨µÄ·µ»ØÖµ

Statement µÄ  execute(sql) ·½·¨µÄ·µ»ØÖµ
 true   if   the   first   result   is   a   ResultSet   object;  
 
 false   if   it   is   an   update   count   or   there   are   no ......

SQLËø»úÖƺÍÊÂÎñ¸ôÀ뼶±ð£¨×ª£©

NOLOCKºÍREADPASTµÄÇø±ð¡£
1.¿ªÆôÒ»¸öÊÂÎñÖ´ÐвåÈëÊý¾ÝµÄ²Ù×÷¡£
BEGIN TRAN t
INSERT INTO Customer
SELECT 'a','a'
2.Ö´ÐÐÒ»Ìõ²éѯÓï¾ä¡£
SELECT * from Customer WITH (NOLOCK)
½á¹ûÖÐÏÔʾ”a”ºÍ”a”¡£µ±1ÖÐÊÂÎñ»Ø¹öºó£¬ÄÇôa½«³ÉΪÔàÊý¾Ý¡£(×¢:1ÖеÄÊÂÎñδÌá½») ¡£NOLOCK±íÃ÷ûÓжÔÊý¾Ý±íÌ ......

Linq To Sql½ø½×ϵÁУ¨Ò»£© ´ÓÓ³Éä½²Æð

±¾ÏµÁУ¬»ò¶à»òÉÙ£¬Ö±½Ó»ò¼ä½ÓÒÀÀµÈëÃÅϵÁÐ֪ʶ¡£µ«£¬ÒÀÈ»×·Çó¶ÀÁ¢³ÉÕ¡£Òò±¾ÎÄ×÷ÕßˮƽÓÐÏÞ£¬ÎÄÖдíÎóÄÑÃ⣬¾´Çë¶ÁÕßÖ¸³ö²¢Á½⡣±¾ÏµÁн«»áºÍÈëÃŲ¢´æ¡£
°¸Àý
ij¾ý±»ÑûΪһ³¬ÊÐÉè¼ÆÊý¾Ý¿â£¬ÓÃÀ´´æ´¢Êý¾Ý¡£¸Ã¾ý¸ù¾Ý¸Ã³¬ÊÐÖÐʵ¼Ê³öÏֵĶÔÏó£¬Éè¼ÆÁËCustomer, Employee£¬Order, ProductµÈ±í£¬ÓÃÀ´±£´æÏàÓ¦µÄ¿Í»§£¬Ô±¹¤£¬¶© ......

SQL ͬʱ¿´µ½Ã÷ϸºÍºÏ¼Æ

SELECT  ¡¡ ¡¡ ¡¡
CenterCD ¡¡ ¡¡ ¡¡
,UseUnitCD ¡¡ ¡¡
,SUM(UseUnitUnitPrice) 'totaladvance'
, GROUPING(UseUnitCD) 'grp' ¡¡
from dbo.T_MMaterialGroupUnitPrice_SLS
GROUP BY CenterCD,UseUnitCD
WITH ROLLUP ¡¡ ¡¡
¡¡ ¡¡ ¡¡ ¡¡
¡¡ ¡¡ ¡¡ ¡¡
SELECT  ¡¡ ¡¡ ¡¡
CenterCD ¡¡ ¡¡ ¡¡
, ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ