SqlServerÖÐ×Ô¶¨ÒåÀàËÆSplit½ØÈ¡×ֶκ¯Êý
if exists (select * from dbo.sysobjects where name='SplitStr' )
drop FUNCTION SplitStr
go
CREATE FUNCTION SplitStr (@splitString varchar(8000), @separate varchar(10))
RETURNS @returnTable table(col_Value varchar(20))
AS
BEGIN
declare @thisSplitStr varchar(20)
declare @thisSepIndex int
declare @lastSepIndex int
set @lastSepIndex = 0
if Right(@splitString ,len(@separate)) <> @separate set @splitString = @splitString + @separate
set @thisSepIndex = CharIndex(@separate,@splitString ,@lastSepIndex)
while @lastSepIndex <= @thisSepIndex
begin
set @thisSplitStr = SubString(@splitString ,@lastSepIndex,@thisSepIndex-@lastSepIndex)
set @lastSepIndex = @thisSepIndex + 1
set @thisSepIndex = CharIndex(@separate,@splitString ,@lastSepIndex)
insert into @returnTable values(@thisSplitStr)
end&n
Ïà¹ØÎĵµ£º
1.SQLServerµÄ´´½¨½Å±¾ÈçÏ£º
USE [master]
GO
/****** Object: Database [test] Script Date: 10/29/2009 17:43:10 ******/
CREATE DATABASE [test] ON PRIMARY
( NAME = N'test', FILENAME = N'D:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA\test.mdf' , S ......
ÔÚwindows 7 ÉÏΪ sqlserver 2008 ÆôÓÃÔ¶³Ì·ÃÎÊ£¬ÐèÒªÁ½¸öÖصãµÄ²½Öè¡£
µÚÒ»²½£ºÆôÓÃsqlserver 2008Ô¶³Ì·ÃÎʵŦÄÜ¡£
´ò¿ªMicrosoft SQL Server 2008-ÅäÖù¤¾ß-SQL Server ÅäÖùÜÀíÆ÷
ÆôÓò¢¼¤»îTcp/IP
È»ºóÖØÆôsqlserver·þÎñ¡£ÕâÑùsqlserver 2008¾Í¿ÉÒÔ½øÐÐÔ¶³ÌÁ¬½ÓÁË¡£µ«ÊÇwin7 ·À»ðǽĬÈÏÊÇ×èÖ¹ÁËsqlsever ¿ª· ......
sqlserver µÄntextÀàÐÍÔÚÊý¾Ý¿âÖÐÊÇ¿´²»µ½ÖµµÄ
Æð³õÎÒ»¹ÒÔΪÊý¾ÝûÓвåÈ룬ºóÀ´²ÅÖªµÀntextÀàÐÍÔÚÊý¾Ý¿âÖб¾À´¾Í¿´²»µ½µÄ£¨Êý¾Ý½Ï¶ÌµÄ¿ÉÒÔ¿´µ½£©£»
ÄÇÎÒÒªÏë¿´µ½ntextÊý¾ÝÔõô°ì£¿
ÔÚ²éѯ·ÖÎöÆ÷ÖпÉÒÔ¿´µ½£¨²éѯ·ÖÎöÆ÷ÖÐÒ²Ö»¿´µ½ÁËÇ°¼¸Ê®¸ö×Ö·û£¬¡¡²»ÊÇÈ«²¿µÄ£© ......
¡¡¾³£¿´¼ûÓÐÈËÎÊ£¬MSSQLÕ¼ÓÃÁËÌ«¶àµÄÄڴ棬¶øÇÒ»¹²»¶ÏµÄÔö³¤£»»òÕß˵ÒѾÉèÖÃÁËʹÓÃÄڴ棬¿ÉÊÇËüûÓÐÓõ½ÄÇô¶à£¬ÕâÊÇÔõôһ»ØʶùÄØ£¿
¡¡¡¡Ê×ÏÈ£¬ÎÒÃÇÀ´¿´¿´MSSQLÊÇÔõÑùʹÓÃÄÚ´æµÄ¡£
¡¡¡¡×î´óµÄ¿ªÏúÒ»°ãÊÇÓÃÓÚÊý¾Ý»º´æ£¬Èç¹ûÄÚ´æ×ã¹»£¬Ëü»á°ÑÓùýµÄÊý¾ÝºÍ¾õµÃÄã»áÓõ½µÄÊý¾ÝͳͳÈÓµ½ÄÚ´æÖУ¬Ö±µ½ÄÚ´æ²»×ãµÄʱºò ......
NVL(Expr1,Expr2)Èç¹ûExpr1ΪNULL£¬·µ»ØExpr2µÄÖµ£¬·ñÔò·µ»ØExpr1µÄÖµ
NVL2(Expr1,Expr2,Expr3)Èç¹ûExpr1ΪNULL£¬·µ»ØExpr2µÄÖµ£¬·ñÔò·µ»ØExpr3µÄÖµ
NULLIF(Expr1,Expr2)Èç¹ûExpr1ºÍExpr2µÄÖµÏàµÈ£¬·µ»ØNULL£¬·ñÔò·µ»ØExpr1µÄÖµ ......