ÓÃSQLÉú³ÉÁ÷Ë®ºÅ
ÓÃSQLÉú³ÉÁ÷Ë®ºÅ
ת£ºÎ¤½ÌÎ ·¢±íÓÚ2010Äê02ÔÂ03ÈÕ 09:38 ÔĶÁ(4) ÆÀÂÛ(0)
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[fn_FillNumberWithZero]') and xtype in (N'FN', N'IF', N'TF'))
drop function [dbo].[fn_FillNumberWithZero]
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[fn_FormatDate]') and xtype in (N'FN', N'IF', N'TF'))
drop function [dbo].[fn_FormatDate]
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[fn_GetNewFlowNumber]') and xtype in (N'FN', N'IF', N'TF'))
drop function [dbo].[fn_GetNewFlowNumber]
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[fn_GetNowDate]') and xtype in (N'FN', N'IF', N'TF'))
drop function [dbo].[fn_GetNowDate]
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/*
Éú³ÉÁ÷Ë®ºÅºóÃæ¼¸Î»Êý×Ö×Ö·ûµÄÏà¹Øº¯Êý
²»×ãλÊýÔÚ×ó±ßÓÃ0Ìî³ä
*/
CREATE FUNCTION dbo.fn_FillNumberWithZero
(
--Ìî³äµÄÊý×Ö
@num int,
--×ÜλÊý
@len int
)
RETURNS varchar(50) AS
BEGIN
--Èç¹û´«ÈëµÄÁ÷Ë®ºÅ´óÓÚ×ܵij¤¶È£¬ÄÇôֱ½Ó·µ»ØÁ÷Ë®ºÅ×Ö·û´®¸ñʽ
if(len(Convert(varchar(50),@num))>@len)
return Convert(varchar(50),@num)
ELSE
BEGIN
--ÐèÒªÌî³ä0µÄλÊý
declare @NeedFillLen int
set @NeedFillLen=@Len-len(Convert(varchar(50),@num))
--»ñÈ¡ÐèÒªÌî³äµÄ0µÄ×Ö·û´®
declare @i int
set @i=0
declare @temp varchar(50)
set @temp=N''
while @i<@NeedFillLen
BEGIN
SET @temp=@temp+'0'
SET @i=@i+1
END
--·µ»Ø×éºóµÄ×Ö·û´®
return @temp+Convert(varchar(50),@num)
END
return ''
END
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER OFF
GO
Ïà¹ØÎĵµ£º
ÔÚGoogleÉÏʹÓÓsql ·ÖÒ³”¹Ø¼ü×Ö½øÐÐËÑË÷£¬¼¸ºõËùÓеĴ𰸶¼ÊÇÄÇÈýÌõ¡£Æä¶þЧÂÊ×î¸ß£¬ÆäÈýʹÓÃÓα꣬ЧÂÊ×î²î¡£
ÏÂÃæÊÇÄÇÈýÖÖ·½·¨ £¨²åÈë´úÂëûÓÐsqlÑ¡Ï
·½·¨1£º
ÊÊÓÃÓÚ SQL Server 2000/2005
SELECT TOP Ò³´óС *
from table1
WHERE ......
ϱí˵Ã÷ÔÚ Microsoft SQL Server Êý¾Ý¿âÖж¨ÒåµÄ£¬»òÔÚ Transact-SQL
Óï¾äÖÐÒýÓõĸ÷ÖÖ¶ÔÏóµÄ×î´óÖµ£¨ÊýÁ¿»ò´óС£©¡£ÏÂ±í²»°üº¬ Microsoft® SQL Server 2000™ Windows® CE °æ¡£
×î´óÖµ£¨ÊýÁ¿»ò´óС£©
¶ÔÏó
SQL Server 7.0
SQL Server 2000
Åú´¦Àí´óС
65,536 * ÍøÂçÊý¾Ý°ü´óС1
65,536 * Í ......
SQLÊÖ¹¤×¢Èë´óÈ«
2006Äê08ÔÂ11ÈÕ ÐÇÆÚÎå 21:00
±È·½ËµÔÚ²éѯidÊÇ50µÄÊý¾Ýʱ£¬Èç¹ûÓû§´«½üÀ´µÄ²ÎÊýÊÇ50 and 1=1£¬Èç¹ûûÓÐÉèÖùýÂ˵ϰ£¬¿ÉÒÔÖ±½Ó²é³öÀ´£¬SQL ×¢ÈëÒ»°ãÔÚASP³ÌÐòÖÐÓöµ½×î¶à£¬
¿´¿´ÏÂÃæµÄ
1.ÅжÏÊÇ·ñÓÐ×¢Èë
;and 1=1
;and 1=2
2.³õ²½ÅжÏÊÇ·ñÊÇmssql
;and user>0
3.ÅжÏÊý¾Ý¿âϵͳ
;and ......
declare @p int
declare @p1 int
declare @count int
set @p=0
set @p1=10
set @count=2
if(@count<>0 or @count<>1)
set @p=@p1*@count-10
SELECT [t1].[userid], [t1].[username], [t1].[userorder]
from (
SELECT ROW_NUMBER() OVER (ORDER BY [t0].[userorder]) AS [ROW_NU ......