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

SqlServer´æ´¢¹ý³Ì·ÖÒ³

--TOP n ʵÏÖµÄͨÓ÷ÖÒ³´æ´¢¹ý³Ì(ת×Ô×Þ½¨)
CREATE PROC sp_PageView
@tbname sysname, --Òª·ÖÒ³ÏÔʾµÄ±íÃû
@FieldKey nvarchar(1000), --ÓÃÓÚ¶¨Î»¼Ç¼µÄÖ÷¼ü(Ωһ¼ü)×Ö¶Î,¿ÉÒÔÊǶººÅ·Ö¸ôµÄ¶à¸ö×Ö¶Î
@PageCurrent int=1, --ÒªÏÔʾµÄÒ³Âë
@PageSize int=10, --ÿҳµÄ´óС(¼Ç¼Êý)
@FieldShow nvarchar(1000)='', --ÒÔ¶ººÅ·Ö¸ôµÄÒªÏÔʾµÄ×Ö¶ÎÁбí,Èç¹û²»Ö¸¶¨,ÔòÏÔʾËùÓÐ×Ö¶Î
@FieldOrder nvarchar(1000)='', --ÒÔ¶ººÅ·Ö¸ôµÄÅÅÐò×Ö¶ÎÁбí,¿ÉÒÔÖ¸¶¨ÔÚ×ֶκóÃæÖ¸¶¨DESC/ASC
ÓÃÓÚÖ¸¶¨ÅÅÐò˳Ðò
@Where nvarchar(1000)='', --²éѯÌõ¼þ
@PageCount int OUTPUT --×ÜÒ³Êý
AS
SET NOCOUNT ON
--¼ì²é¶ÔÏóÊÇ·ñÓÐЧ
IF OBJECT_ID(@tbname) IS NULL
BEGIN
RAISERROR(N'¶ÔÏó"%s"²»´æÔÚ',1,16,@tbname)
RETURN
END
IF OBJECTPROPERTY(OBJECT_ID(@tbname),N'IsTable')=0
AND OBJECTPROPERTY(OBJECT_ID(@tbname),N'IsView')=0
AND OBJECTPROPERTY(OBJECT_ID(@tbname),N'IsTableFunction')=0
BEGIN
RAISERROR(N'"%s"²»ÊÇ±í¡¢ÊÓͼ»òÕß±íÖµº¯Êý',1,16,@tbname)
RETURN
END
--·ÖÒ³×ֶμì²é
IF ISNULL(@FieldKey,N'')=''
BEGIN
RAISERROR(N'·ÖÒ³´¦ÀíÐèÒªÖ÷¼ü£¨»òÕßΩһ¼ü£©',1,16)
RETURN
END
--ÆäËû²ÎÊý¼ì²é¼°¹æ·¶
IF ISNULL(@PageCurrent,0)<1 SET @PageCurrent=1
IF ISNULL(@PageSize,0)<1 SET @PageSize=10
IF ISNULL(@FieldShow,N'')=N'' SET @FieldShow=N'*'
IF ISNULL(@FieldOrder,N'')=N''
SET @FieldOrder=N''
ELSE
SET @FieldOrder=N'ORDER BY '+LTRIM(@FieldOrder)
IF ISNULL(@Where,N'')=N''
SET @Where=N''
ELSE
SET @Where=N'WHERE ('+@Where+N')'
--Èç¹û@PageCountΪNULLÖµ,Ôò¼ÆËã×ÜÒ³Êý(ÕâÑùÉè¼Æ¿ÉÒÔÖ»ÔÚµÚÒ»´Î¼ÆËã×ÜÒ³Êý,ÒÔºóµ÷ÓÃʱ,°Ñ×ÜÒ³Êý´«»Ø¸ø´æ´¢¹ý³Ì,±ÜÃâÔٴμÆËã×ÜÒ³Êý,¶ÔÓÚ²»Ïë¼ÆËã×ÜÒ³ÊýµÄ´¦Àí¶øÑÔ,¿ÉÒÔ¸ø@PageCount¸³Öµ)
IF @PageCount IS NULL
BEGIN
DECLARE @sql nvarchar(4000)
SET @sql=N'SELECT @PageCount=COUNT(*)'
+N' from '+@tbname
+N' '+@Where
EXEC sp_executesql @sql,N'@PageCount int OUTPUT',@PageCount OUTPUT
SET @PageCo


Ïà¹ØÎĵµ£º

È«ÎÄË÷ÒýÔ­Àí¼°ÆäʾÀý£¨sqlserver£©

È«ÎļìË÷ÊǶԴóÊý¾ÝÎı¾½øÐÐË÷Òý£¬ÔÚ½¨Á¢µÄË÷ÒýÖжÔÒª²éÕҵĵ¥´Ê½øÐнøÐÐËÑË÷£¬¶¨Î»ÄÄЩÎı¾Êý¾Ý°üÀ¨ÒªËÑË÷µÄµ¥´Ê¡£Òò´Ë£¬È«ÎļìË÷µÄÈ«²¿¹¤×÷¾ÍÊǽ¨Á¢Ë÷ÒýºÍÔÚË÷ÒýÖÐËÑË÷¶¨Î»£¬ËùÓеŤ×÷¶¼ÊÇΧÈÆÕâÁ½¸öÀ´½øÐеġ£ÏÂÃæ¾ÍÖð¸ö½éÉÜ¡£
¡¡¡¡½¨Á¢È«ÎÄË÷ÒýÖÐÓÐÁ½Ïî·Ç³£ÖØÒª£¬Ò»¸öÊÇÈçºÎ¶ÔÎı¾½øÐзִʣ¬Ò»Êǽ¨Á¢Ë÷ÒýµÄÊý¾Ý½á¹¹¡ ......

C#¹ØÓÚsqlserverÖжÁÈ¡imageÀàÐÍ

½ñÌìÔÚÍøÉÏÕÒÁËÐí¾Ã¹ØÓÚsqlserverÖд洢imageÀàÐͺͶÁÈ¡imageµÄ·½·¨£¬¿ÉÊǶ¼ÊÇÄÇôһµã£¬¹ÊÔÚ´ËÂÞÁÐһϣ¬Ï£Íû¿ÉÒÔ°ïÖú´ó¼Ò¡£
Ê×ÏÈÊǹØÓÚdataGridViewµÄ°ó¶¨¡£´úÂë¼ûÏÂ
private void button_show_Click(object sender, EventArgs e)
{
string sqlText = "server=localhost;initial catalog=Test; ......

c#ÖиßЧµÄexcelµ¼ÈësqlserverµÄ·½·¨

±¾ÎÄת×Ô£ºhttp://blog.csdn.net/jinjazz/archive/2008/07/14/2650506.aspx
    ½«oledb¶ÁÈ¡µÄexcelÊý¾Ý¿ìËÙ²åÈëµÄsqlserverÖУ¬ºÜ¶àÈËͨ¹ýÑ­»·À´Æ´½Ósql£¬ÕâÑù×ö²»µ«ÈÝÒ׳ö´í¶øÇÒЧÂʵÍÏ£¬×îºÃµÄ°ì·¨ÊÇʹÓÃbcp£¬Ò²¾ÍÊÇSystem.Data.SqlClient.SqlBulkCopy ÀàÀ´ÊµÏÖ¡£²»µ«Ëٶȿ죬¶øÇÒ´úÂë¼òµ¥£¬ÏÂÃæ²âÊÔ´ú ......

SQLserverÖÐÓÃconvertº¯Êýת»»ÈÕÆÚ¸ñʽ

SQLserverÖÐÓÃconvertº¯Êýת»»ÈÕÆÚ¸ñʽ
2008-01-23 15:47
SQLserverÖÐÓÃconvertº¯Êýת»»ÈÕÆÚ¸ñʽ2008-01-15 15:51SQLserverÖÐÓÃconvertº¯Êýת»»ÈÕÆÚ¸ñʽ
SQL ServerÖÐÎÄ°æµÄĬÈϵÄÈÕÆÚ×Ö¶Îdatetime¸ñʽÊÇyyyy-mm-dd Thh:mm:ss.mmm
ÀýÈç:
select getdate()
2004-09-12 11:06:08.177
ÕûÀíÁËÒ»ÏÂSQL ServerÀïÃæ¿ÉÄÜ ......

SqlServer²åÈëÂýµÄÎÊÌâ½â¾ö

Õâ¸öÊÇÎÒ¼ÓÈëµÄQQȺÀïÃæÒ»¸öÍøÓÑÎʵÄÎÊÌâ¡£Ëû˵һ¸ö±í×öÒ»¸öINSERT¶¼»á³¬Ê±¡£ÕýÀ§»óÄØ£¬ÏòȺÀïÃæµÄÈËÇóÖú¡£ÎҸպöÔÕâ·½ÃæÖªµÀµã£¬¾Í»Ø´ðÁË˵ҪÓÅ»¯¾Û¼¯Ë÷Òý¡£Ëû²»Ã÷°×¾ßÌå¸ÃÔõô×ö£¬ËƺõÒ²²»ÖªµÀʲôÊǾۼ¯Ë÷Òý¡£ÎÒ¶ÔËû˵Äã¿ÉÒÔ¿´¿´Äã²åÈë¼Ç¼ʱµÄ´ÅÅÌIOÊÇ·ñ±È½Ï¶à£¬Ëû˵ËûµÄ´ÅÅÌÒѾ­»»³ÉÁËRAID£¬²»ºÃ²é¿´´ÅÅÌIO¡£OK, ÎÒ¼Ì ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ