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

SQLserver×Ö·û´®·Ö¸îº¯Êý

SQLserver×Ö·û´®·Ö¸îº¯Êý
Ò»¡¢°´Ö¸¶¨·ûºÅ·Ö¸î×Ö·û´®£¬·µ»Ø·Ö¸îºóµÄÔªËظöÊý£¬·½·¨ºÜ¼òµ¥£¬¾ÍÊÇ¿´×Ö·û´®ÖдæÔÚ¶àÉÙ¸ö·Ö¸ô·ûºÅ£¬È»ºóÔÙ¼ÓÒ»£¬¾ÍÊÇÒªÇóµÄ½á¹û¡£
CREATE function Get_StrArrayLength
(
  @str varchar(1024),  --Òª·Ö¸îµÄ×Ö·û´®
  @split varchar(10)  --·Ö¸ô·ûºÅ
)
returns int
as
begin
  declare @location int
  declare @start int
  declare @length int
  set @str=ltrim(rtrim(@str))
  set @location=charindex(@split,@str)
  set @length=1
  while @location<>0
  begin
    set @start=@location+1
    set @location=charindex(@split,@str,@start)
    set @length=@length+1
  end
  return @length
end
µ÷ÓÃʾÀý£ºselect dbo.Get_StrArrayLength('78,1,2,3',',')
·µ»ØÖµ£º4
¶þ¡¢°´Ö¸¶¨·ûºÅ·Ö¸î×Ö·û´®£¬·µ»Ø·Ö¸îºóÖ¸¶¨Ë÷ÒýµÄµÚ¼¸¸öÔªËØ£¬ÏóÊý×éÒ»Ñù·½±ã
CREATE function Get_StrArrayStrOfIndex
(
  @str varchar(1024),  --Òª·Ö¸îµÄ×Ö·û´®
  @split varchar(10),  --·Ö¸ô·ûºÅ
  @index int --È¡µÚ¼¸¸öÔªËØ
)
returns varchar(1024)
as
begin
  declare @location int
  declare @start int
  declare @next int
  declare @seed int
  set @str=ltrim(rtrim(@str))
  set @start=1
  set @next=1
  set @seed=len(@split)
  
  set @location=charindex(@split,@str)
  while @location<>0 and @index>@next
  begin
    set @start=@location+@seed
    set @location=charindex(@split,@str,@start)
    set @next=@next+1
  end
  if @location =0 select @location =len(@str)+1
--Õâ¶ù´æÔÚÁ½ÖÖÇé¿ö£º1¡¢×Ö·û´®²»´æÔÚ·Ö¸ô·ûºÅ 2¡¢×Ö·û´®ÖдæÔÚ·Ö¸ô·ûºÅ£¬Ìø³öwhileÑ­»·ºó£¬@locationΪ0£¬ÄÇĬÈÏΪ×Ö·û´®ºó±ßÓÐÒ»¸ö·Ö¸ô·ûºÅ¡£
  
  retu


Ïà¹ØÎĵµ£º

SQLServerÊý¾Ý¿â

 Sybase SQL ServerÌåϵ½á¹¹½éÉÜ
ÕªÒª£º±¾ÎÄÖ÷Òª¶ÔSybase SQL ServerÌåϵ½á¹¹½øÐнéÉÜ£¬±ãÓÚ¶ÁÕ߶ÔSybase SQL ServerÓиöÕûÌå´ó¸ÅµÄÁ˽⡣
±êÇ©£ºSybase SQL Server  Sybase  SQL Server  Ìåϵ½á¹¹
 
Sybase SQL ServerÊÇÒ»¸ö¶à¿â½á¹¹µÄRDBMS£¬Ìåϵ½á¹¹´óÖÂÈçÏ£º
1.Êý¾Ý¿â ......

SQLServerµÄCONVERTº¯Êý½éÉÜ

±¾ÎÄÀ´×ÔCSDN²©¿Í£¬×ªÔØÇë±êÃ÷³ö´¦£ºhttp://blog.csdn.net/yf520gn/archive/2008/09/26/2982363.aspx
SELECT * from TB_MILES_CB_ORDER
WHERE convert(varchar(100),ORDER_DATE,102)= £¿
ORDER BY ORDER_NO
SELECT CONVERT(varchar(100), GETDATE(), 0): 05 16 2006 10:57AM
SELECT CONVERT(varchar(100), GETDATE ......

ʹÓÃSQLServerÄ£°åÀ´Ð´¹æ·¶µÄSQLÓï¾ä

Èç¹ûÄã¾­³£Óöµ½ÏÂÃæµÄÎÊÌ⣬Äã¾ÍÒª¿¼ÂÇʹÓÃSQL ServerµÄÄ£°åÀ´Ð´¹æ·¶µÄSQLÓï¾äÁË£º
SQL³õѧÕß¡£
¾­³£Íü¼Ç³£ÓõÄDML»òÊÇDDL SQL Óï¾ä¡£
ÔÚ¶àÈË¿ª·¢Î¬»¤µÄSQLÖУ¬Ã¿¸öÈ˶¼ÓÐ×Ô¼ºµÄSQLÏ°¹ß£¬Ã»ÓÐÒ»Ì×ͳһµÄ¹æ·¶¡£
ÔÚSQL Server Management StudioÖУ¬ÒѾ­¸ø´ó¼ÒÌṩÁ˺ܶೣÓõÄÏÖ³ÉSQL¹æ·¶Ä£°å¡£
SQL Server Management ......

»ñÈ¡sqlserverÖÐÊý¾Ý¿âµ±Ç°Á¬½ÓÊý

ÈçºÎ²é¿´SQL SERVERÊý¾Ý¿âµ±Ç°Á¬½ÓÊý
1.ͨ¹ý¹ÜÀí¹¤¾ß
¿ªÊ¼->¹ÜÀí¹¤¾ß->ÐÔÄÜ£¨»òÕßÊÇÔËÐÐÀïÃæÊäÈë mmc£©È»ºóͨ¹ýÌí¼Ó¼ÆÊýÆ÷Ìí¼Ó SQL µÄ³£ÓÃͳ¼Æ È»ºóÔÚÏÂÃæÁгöµÄÏîÄ¿ÀïÃæÑ¡ÔñÓû§Á¬½Ó¾Í¿ÉÒÔʱʱ²éѯµ½Êý¾Ý¿âµÄÁ¬½ÓÊýÁË¡£²»¹ý´Ë·½·¨µÄ»°ÐèÒªÓзÃÎÊÄÇ̨¼ÆËã»úµÄȨÏÞ£¬¾ÍÊÇҪͨ¹ýWindowsÕË»§µÇ½½øÈ¥²Å¿ÉÒÔÌí¼Ó´Ë¼ÆÊ ......

Sqlserver È¡ºº×ֵĵÚÒ»¸ö×Öĸ£¬·½±ãÄ£ºý²éѯ

 create function comm_getpy
(
    @str nvarchar(4000)
)
returns nvarchar(4000)
as
begin
declare @word nchar(1),@PY nvarchar(4000)
set @PY=''
while len(@str)>0
begin
    set @word=left(@str,1)
    --Èç¹û·Çºº×Ö×Ö·û£¬·µ»ØÔ­×Ö·û
& ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ