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
Ïà¹ØÎĵµ£º
˵Ã÷£ºÔÚSupplyPlan±íÖУ¬´æ´¢×Åÿһ¸öRequestQty¼°Æä¶ÔÓ¦µÄ¿ªÊ¼ÖÕÖ¹ÈÕÆÚ¶Î£»ÒòΪÎÒÔÚÒÔºó´¦ÀíÖÐÒªÅжϵ±Ç°ÌìÊôÓÚÄÄÒ»ÌõRequestQtyµÄÈÕÆÚÇø¼ä²¢½øÐд¦Àí£¬ËùÒÔºǫ́Êý¾Ý¿âÖ»ÄÜÉè¼Æ³ÉÕâÖÖ´æ´¢ÐÎʽ£»µ«ÊÇÔÚÒ³ÃæµÄÏÔʾʱºò£¬ÐèÒª¶¯Ì¬µÄ¸ù¾Ýÿһ¸öSupplyPlanNoÉú³É¶ÔÓ¦µÄ¶àÌõÈÕÆÚÇø¶Î¼°ÆäÊýÁ¿ÏÔʾ£¬ËùÒÔ²ÉÓÃ×Ô¶¨Ò庯ÊýÐÎʽ·µ»Ø´¦ ......
VS2008 Ìí¼ÓSQLServerÎļþ ¾³£»áÅöµ½´íÎó£¬ÏÖÔÚ½«¼¸¸ö³£¼ûµÄ´íÎóÂÞÁÐһϣ¬
“´Ë°æ±¾µÄ sql server ²»Ö§³ÖÓû§ÊµÀýµÇ¼±êÖ¾¡£¸ÃÁ¬½Ó½«¹Ø±Õ¡£”
½â¾ö°ì·¨:
ÔÚÁ¬½ÓÊôÐÔµÄÉèÖÃÀï±ß,µã“¸ß¼¶”,½«User Instance ÉèÖÃΪfalse,ĬÈϵÄtrue,ËùÒԲŵ¼ÖÂÕâ¸öÎÊÌâµÄ³öÏÖ.
“ÓëSQL ServerÎļþ£¨*.m ......
ÈçºÎ»ñµÃ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ÖоßÌåÏß³ ......
Ñ¡ÔñÖ¸¶¨ÌõÊýÓï¾ä£º
db2£ºselect * from tabname fetch frist n rows only
informix£ºselect first n *
from tabname
oralce£ºselect * from tabname where rownum <= n
sql server :select top n * from tabname ......
ÔÚдSQLʱ£¬ÓÐʱҪ¸ù¾ÝÒÑÓеÄÁÐÖµ¹¹ÔìеÄÁÐÖµ£¬Õâʱ¾ÍÒªÓõ½µÄSQLÖеÄcase¹Ø¼ü×Ö¡£ÈçÏÂËùʾ²éѯ¸ºÔðÈËÐÅÏ¢±í£¨T_MS_CustomerCrmInfoDutyPerson£©ÖеÄÊÇ·ñÊÇÖ÷Òª¸ºÔðÈË£¨isMainDuty£©×ֶΣ¬µ«ÊÇÕâ¸ö×ֶεÄÖµÊÇÒÔö¾ÙµÄ·½Ê½´æ´¢µÄ£¬´æ´¢0±íʾÊÇ·ñ£¬1±íʾÊÇ£¬·ñÔò±íʾδÅжϡ£Õâʱֱ½Ó²éѯ³öµÄÖµ²»ÊÇ ......