ͨ¹ýÈÕÖ¾»Ö¸´MSSQLÊý¾ÝÀý×Ó
Õâ¶Îʱ¼ä¿´Á˹ØÓÚÔÚSQL server ÖÐͨ¹ýÈÕÖ¾ºÍʱ¼äµãÀ´»Ö¸´Êý¾Ý¡£Ò²¿´ÁËһЩÍøÉϵÄÀý×Ó£¬¿´ÈçºÎͨ¹ýÈÕÖ¾À´»Ö¸´Êý¾Ý¡£
Ç°ÌáÌõ¼þ£º
Êý¾Ý¿âµÄ¹ÊÕϻָ´¸ÄΪ·Ç¼òµ¥Ä£Ê½£¬È¥µô×Ô¶¯¹Ø±ÕºÍ×Ô¶¯ÊÕËõÁ½¸öÑ¡Ïî
Èç¹ûÊǼòµ¥Ä£Ê½£º ÀàËÆÏÂÃæµÄÓï¾ä²Ù×÷Êý¾Ý¾Í²»»á¼Ç¼µ½ÈÕÖ¾ÖУº select * into t from [±íÃû]
ÕâʱΪ±£Ö¤Êý¾ÝµÄÍêÕûÒª½«Êý¾Ý¿âµÄ»Ö¸´Ä£Ê½¸Ä³É“ÍêÕû”
²âÊÔ»·¾³£º
1£¬½¨Á¢Êý¾Ý¿âºÍ²âÊÔ±í
create database zp
create table [zping.com](
id int,
name varchar(20)
)
²åÈë²âÊÔÊý¾Ý£º
insert into [zping.com](id,name)
values(1,'zping.com1')
insert into [zping.com](id,name)
values(2,'zping.com2')
insert into [zping.com](id,name)
values(3,'zping.com3')
insert into [zping.com](id,name)
values(4,'zping.com4')
±¸·ÝÊý¾Ý¿â£¬¿ÉÒÔͨ¹ýsql serverµÄ¿ÉÊÓ»¯²Ù×÷£¬ÏÂÃæÊÇÉú³ÉµÄ´úÂ룺
BACKUP DATABASE [zp] TO DISK = N'C:\k.bak' WITH NOFORMAT, NOINIT,
NAME = N'zp-ÍêÕû Êý¾Ý¿â ±¸·Ý', SKIP, NOREWIND, NOUNLOAD, STATS = 10
GO
²é¿´Êý¾Ý£º
×¢Ò⣺ÕâʱÎÒÃÇ×öÒ»¸öÍêÕû±¸·Ý
Õâʱ¿ÉÄÜÒ»²»Ð¡ÐÄɾ³ýÁËһЩÊý¾Ý¡£ÎÒÃÇÄ£Äâһϣº£¨¼Ù¶¨É¾³ýÁË1£¬2µÄÊý¾Ý£©
delete from [zping.com] where (id=1 or id =2)
×¢Ò⣺Ҫ¼Çס´óÌåµÄɾ³ýʱ¼ä
Õâʱ·¢ÏÖɾ³ý´íÎóÁË£¬Ôõô°ÑÊý¾ÝÕÒ»ØÀ´°¡¡£·½·¨ÓÐÁ½¸ö£º
1£¬Í¨¹ýLog Explorer ²éÕÒ½øÐлָ´Êý¾Ý£¨ÎÒÍøÕ¾Óд˹¤¾ß£©
2£¬ÁíÒ»ÖÖ·½·¨Í¨¹ý»Ö¸´ÈÕÖ¾£¨Ö¸¶¨Ê±¼äµã»Ö¸´£©À´»Ö¸´Êý¾Ý¡£
Ïà¹ØÎĵµ£º
SQL Server ÌṩϵͳÊý¾ÝÀàÐͼ¯£¬¶¨ÒåÁË¿ÉÓë SQL Server Ò»ÆðʹÓõÄËùÓÐÊý¾ÝÀàÐÍ¡£ÏÂÃæÁгöϵͳÌṩµÄÊý¾ÝÀàÐͼ¯¡£
¿ÉÒÔ¶¨ÒåÓû§¶¨ÒåµÄÊý¾ÝÀàÐÍ£¬ÆäÊÇϵͳÌṩµÄÊý¾ÝÀàÐ͵ıðÃû¡£ÓйØÓû§¶¨ÒåµÄÊý¾ÝÀàÐ͵ĸü¶àÐÅÏ¢£¬Çë²Î¼û sp_addtype ºÍ´´½¨Óû§¶¨ÒåµÄÊý¾ÝÀàÐÍ¡£
µ±Á½¸ö¾ßÓв»Í¬Êý¾ÝÀàÐÍ¡¢ÅÅÐò¹æÔò¡¢¾«¶È¡¢Ð¡ÊýλÊý»ò³ ......
selectÓï¾äÇ°¼Ó£º
declare @d datetime
set @d=getdate()
²¢ÔÚselectÓï¾äºó¼Ó£º
select [Óï¾äÖ´Ðл¨·Ñʱ¼ä(ºÁÃë)]=datediff(ms,@d,getdate())
ת×Ô£º¶¯Ì¬ÍøÖÆ×÷Ö¸ÄÏ www.knowsky.com
ÕâÊǼòÒ׵IJ鿴ִÐÐʱ¼äµÄ·½·¨¡£
===========================================£¨Ò»ÏÂÄÚÈÝת×Ô£º£Ã£Ó£Ä£Î£©
MSSQL ServerÖÐͨ¹ý²é ......
1.
--½«ºº×Öת»»ÎªÆ´ÒôÊ××Öĸ
CREATE function GetAllPY(@str nvarchar(4000))
returns nvarchar(4000)
--WITH ENCRYPTION
as
begin
declare @intLen int
declare @strRet nvarchar(4000)
declare @temp nvarchar(100)
set @intLen &nb ......
1.°´ÐÕÊϱʻÅÅÐò:
Select * from TableName Order By CustomerName Collate Chinese_PRC_Stroke_ci_as
2.·ÖÒ³SQLÓï¾ä
select * from(select (row_number() OVER (ORDER BY tab.ID Desc)) as rownum,tab.* from ±íÃû As tab) As t where rownum between ÆðʼλÖà And ½áÊøλÖÃ
3.»ñÈ¡µ±Ç°Êý¾ ......