SQL Server×Ö·û´®·Ö¸î
Ò»¡¢°´Ö¸¶¨·ûºÅ·Ö¸î×Ö·û´®£¬·µ»Ø·Ö¸îºóµÄÔªËظöÊý£¬·½·¨ºÜ¼òµ¥£¬¾ÍÊÇ¿´×Ö·û´®ÖдæÔÚ¶àÉÙ¸ö·Ö¸ô·ûºÅ£¬È»ºóÔÙ¼ÓÒ»£¬¾ÍÊÇÒªÇóµÄ½á¹û¡£
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&
Ïà¹ØÎĵµ£º
1 £¬¶ÔÓÚÈÕÆÚ×Ö¶Î×Ö¶Î
access±íʾΪ£º#1981-28-12#
SQLSERVER2000±íʾΪ£º''1981-02-12''
2,SQLÓï¾äÇø±ð£¬select ,update ÔÚ¶Ôµ¥±í²Ù×÷ʱ¶¼²î²»¶à£¬
µ«¶à±í²Ù×÷ʱupdateÓï¾äµÄÇø±ðACCESSÓëSQLSERVERÖеÄUpdateÓï¾ä¶Ô±È:
SQLSERVERÖиüжà±íµÄUpdateÓï¾ä:
Update Tab1
SET a.Name = b.Name
from Tab1 a,Tab2 b
Whe ......
--------------------------------------------------------
--sql structured query language
--DML--Data Manipulation Language--Êý¾Ý²Ù×÷ÓïÑÔ
query information (SELECT),
add new rows (INSERT),
modify existing rows (UPDATE),
delete existing rows (DELETE),
perform a conditional update or inse ......
µÚÒ»²½£¬ÔÚÒµÎñ¸ß·åÆÚץȡÑù±¾Êý¾Ý£¨2¸öСʱ×óÓÒ£©¡£²ÉÓõŤ¾ßÊÇsqlserver×Ô´øµÄprofiler£¬Ò²½Ðʼþ̽²éÆ÷£¬ÈçÏÂͼ£º
½øÈëºó£¬µã»÷×î×óÃæµÄ°´Å¥£¬½¨Á¢Ò»¸öеĸú×Ù£º
µÇ¼ÐèÒªÓÃDBOȨÏÞ£¬ËùÒÔ¿ÉÒÔÓÃsaµÇ¼£¬Ò²¿ÉÒÔÓÃwindows¼¯³ÉÑéÖ¤·½Ê½£¨Èç¹ûµ±Ç°µÇ¼µÄ¾ÍÊÇsqlserverµÄ»°£©
н¨¸ú×Ù£¬Ò»¹²ÓÐ4¸ötabÒ³½øÐÐÅ ......