sqlserver 2005 split function
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
GO
create function [dbo].[split](@str nvarchar(1000),@word varchar(5),@no
int) returns nvarchar(500)
as begin
declare @len int
declare @index int
set @index=charindex(@word,@str)
set @index=len(@word)+@index-1
set @len=len(@str)
if @index >0 and @no=2
return substring(@str,@index+1,@len)
else if @index>0 and @no=1
return substring(@str,0,@index-len(@word)+1)
return @str
end
Ïà¹ØÎĵµ£º
½øÀ´ÒòΪ¿ª·¢ÔÒò£¬¾³£ÐèҪʹÓÃÈÕÆÚ·½ÃæµÄ±È½ÏºÍ²Ù×÷£¬ÕûÀíÁËÒ»ÏÂÕâ·½ÃæµÄ×ÊÁÏ£¬¹©´ó¼Ò¹²Ïí£º
SQL ServerÖÐÎİæµÄĬÈϵÄÈÕÆÚ×Ö¶Îdatetime¸ñʽÊÇyyyy-mm-dd Thh:mm:ss.mmm
ÀýÈç:
select getdate()
2004-09-12 11:06:08.177
ÕûÀíÁËÒ»ÏÂSQL ServerÀïÃæ¿ÉÄܾ³£»áÓõ½µÄÈÕÆÚ¸ñʽת»»·½·¨:
¾ÙÀýÈçÏÂ:
select CONVE ......
ÈçºÎ»ñµÃsqlserverÊý¾Ý¿âÖÐÕ¼ÓøßcpuÓû§µÄ»î¶¯ÄÚÈÝ
1¡¢´Ó΢ÈíÕ¾µãÉÏÏÂÔØqslice_setup.exe
2¡¢´ò¿ªQuery Analyzer£¬ÔËÐÐÒÔÏÂÓï¾ä£º
declare @a int
while (1<2)
begin
select @a=1
end
½«»á·¢ÏÖcpuÂíÉÏ´ïµ½100%
3¡¢´ò¿ªqlice.exe£¬½«·¢ÏÖsqlserver.exeµÄcpuÕ¼ÓÃÂʺܸߣ¬Ë«»÷½øÈ룬³öÐÐsqlserver.exeÖоßÌåÏß³ ......
ÈçºÎ¿ªÆôSQLSERVERÊý¾Ý¿â»º´æÒÀÀµÓÅ»¯ÍøÕ¾ÐÔÄÜ
Êý¾Ý¿â, »º´æ, SQLSERVER, ÐÔÄÜ
ºÜ¶àʱºò£¬ÎÒÃÇ·þÎñÆ÷µÄÐÔÄÜÆ¿¾±»áÊÇÔÚ²éѯÊý¾Ý¿âµÄʱºò£¬ËùÒÔ¶ÔÊý¾Ý¿âµÄ»º´æ·Ç³£ÖØÒª£¬ÄÇôÓÐûÓÐÒ»ÖÖ·½·¨£¬¿ÉÒÔʵÏÖSQL SERVERÊý¾Ý¿âµÄ»º´æ£¬µ±Êý¾Ý±íûÓиüÐÂʱ£¬¾Í´Ó»º´æÖжÁÈ¡£¬µ±ÓиüеÄʱºò£¬²Å´ÓÊý¾Ý±íÖжÁÈ¡ÄØ£¬´ð°¸Êǿ϶¨µÄ£¬Õâ ......
´¥·¢Æ÷µÄ¶¨ÒåÓë·ÖÀà:
Ö»Òª´¥·¢Æ÷ËùÔÚ±íÉϵĶÔӦʱ¼ä·¢Éú,¾Í»á×Ô¶¯Ö´Ðиô¥·¢Æ÷µÄ´úÂë.ʵ¼ÊÉÏ,ÎÒÃDz¢²»ÄÜÖ±½Óµ÷Óô¥·¢Æ÷,ΨһµÄ·½·¨ÊÇÔÚ·ÖÅäŶ´¥·¢Æ÷µÄ±íÉÏÖ´ÐÐijÖÖÐÐΪ·½¿É¼¤»î´¥·¢Æ÷. [´¥·¢Æ÷ÊÇÒ»ÖÖÌØÊâµÄ´æ´¢¹ý³Ì,ËûÔÚÖ´ÐÐÌØ¶¨µÄÓïÑÔʼþʱÉúЧ
& ......
1
.¾ø¶ÔÖµ
S:
select
abs
(
-
1
) value
O:
select
abs
(
-
1
) value
from
dual
¡¡¡¡
2
.È¡Õû(´ó)
S:
select
ceiling
(
-
1.001
) value
O:
select
ceil(
-
1.001
) value
from
d ......