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 ......
Access¡¢SQLServer¡¢Oracle³£¼ûSQLÓï¾äÓ¦ÓÃÇø±ð
¹Ø¾¢ËÉ PMP
Èç¹ûÒª¼æÈÝAccess¡¢SQL Server¡¢OracleÈý¸öÊý¾Ý¿â°æ±¾£»ÎÒÃÇÔÚ±àдSQLÓï¾äµÄ¹ý³ÌÖУ¬¾¡Á¿Ê¹ÓÃһЩͨÓõÄÓï¾ä£¬µ«»¹ÊÇÓÐЩ·½ÃæÓÐÐ©Çø±ð±ÜÃâ²»ÁË£¬ÏÖ¼òµ¥×ܽáһϡ£
ÒÔÏÂA´ú±íAccess,S´ú±íSQL Server,O´ú±íOracle
1¡¢È¡µ±Ç°ÏµÍ³Ê±¼ä
A:Select Now()
S:Selec ......
ÈçºÎ»ñµÃ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ÖоßÌåÏß³ ......
1.½¨±í(Create table)ʱʹÓà IDENTITY (SEED,INCREMENT)
ÆäÖÐSEEDÊÇÆðʼֵ£¬INCREMENTÊÇÔöÁ¿¡£
Àý£º
CREATE TABLE mytable1
(
[user_id] BIGINT NOT NULL
IDENTITY(1, 1) ,
......