SQL outputʹÓÃ
һֱûÓÐÕÒµ½Ò»Öֺõķ½·¨À´ÒýÓÃÓзµ»ØÖµµÄ´æ´¢¹ý³ÌµÄ·½·¨£¬Ê¹ÎÒÔÚÌí¼ÓÊý¾ÝÖÐ×ßÁ˲»ÉÙµÄÍä·£¬×î½ü£¬ÔÚ²éÔÄÁË´óÁ¿µÄ×ÊÁÏÖ®ºó£¬ÖÕÓÚÔÚ΢ÈíµÄÒ»¸öʵÀýÖÐÕÒµ½ÁËÒ»ÖÖÁ¼ºÃµÄ·½·¨¡£
Ê×ÏȱàдºÃÒ»Óзµ»ØÖµµÄ´æ´¢¹ý³Ì
create procedure proc_name
@para1 nchar(20), --ÊäÈë²ÎÊý
@para2 int = null out¡¡--Êä³ö²ÎÊý£¬¹©³ÌÐòʹÓÃ
as
set nocount on
if ( not exists (select * from employee where em_name=@para1))
begin
insert into employee(name) values(@para1)
select @para2=@@identity --·µ»ØÌí¼Ó¼Ç¼µÄID
return 1 --·µ»ØÊÇ·ñ³É¹¦Ìí¼ÓÊý¾Ý
end
else
return 0 --·µ»Øʧ°Ü
go
È»ºóÊǵ÷Óô洢¹ý³ÌµÄ·½·¨
sqlcommand command;
command = new sqlcommand(proc_name,new sqlconnection(connectionstr));
command.paraments.add("@para1"),"name1"); //ÊäÈë²ÎÊý£¬Ö°Ô±ÐÕÃû
command.paraments.add(new sqlparament("@para2", //Éú³ÉÒ»Êä³ö²ÎÊý
SqlDbType.Int;¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡//²ÎÊýÊý¾ÝÀàÐÍ
ParamenterDirection.OutPut,¡¡¡¡¡¡¡¡¡¡¡¡//ÊäÈëÊä³öÀàÐÍ
0,
0,
string.Emplty,
DataRowVerstion.Default,
null)¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡//²ÎÊýÖµ£¬ÊäÈë²ÎÊýʱÐèÌṩ
);
command.commandtype=commandtype.StoredProcedure;
command.connection.open();
command.executenonQuery();
int pkid=(int)command.Parameters["@para2"].value; //µÃµ½Êä³ö²ÎÊýµÄÖµ
command.connection.close();
´Ë´¦ÊÇÒýÓÃÊä³ö²ÎÊý£¬Èç¹ûÒªÒýÓ÷µ»ØÖµ£¨ÊÇ·ñ³É¹¦Ìí¼ÓÊý¾Ý£©ÔòÖ»Ðè°ÑParamente
Ïà¹ØÎĵµ£º
create PROCEDURE pagelist
@tablename nvarchar(50),
@fieldname nvarchar(50)='*',
@pagesize int output,--ÿҳÏÔʾ¼Ç¼ÌõÊý
@currentpage int output,--µÚ¼¸Ò³
@orderid nvarchar(50),--Ö÷¼üÅÅÐò
@sort int,--ÅÅÐò·½Ê½£¬1±íʾÉýÐò£¬0±íʾ½µÐòÅÅÁÐ
......
SQL SERVER¶¨Ê±×÷ÒµµÄÉèÖ÷½·¨
תÌù×Ô£º http://www.cnblogs.com/stephencat/archive/2006/08/24/484918.html
Èç¹ûÔÚSQL Server ÀïÐèÒª¶¨Ê±»òÕßÿ¸ôÒ»¶Îʱ¼äÖ´ÐÐij¸ö´æ´¢¹ý³Ì»ò3200×Ö·ûÒÔÄÚµÄSQLÓï¾äʱ,
¿ÉÒÔÓùÜÀí->SQL Server´úÀí->×÷ÒµÀ´ÊµÏÖ¡£
1¡¢¹ ......
¶¯Ì¬ÍøÒ³¿ª·¢——ASPÁ¬½ÓSQL2005Êý¾Ý¿â
˵Ã÷£ºa¡¢ÒÔÏÂ×Ö·ûÖÐÊý¾Ý¿âÃûforum£¬Êý¾Ý¿â·þÎñÆ÷ÃûWWW-2443D34E558\SQL2005£¨»òÕß127.0.0.1£©
b¡¢²é¿´sqlÊý¾Ý¿â·þÎñÆ÷Ãû³Æ£º¶ÔÏó×ÊÔ´¹ÜÀíÆ÷->Êý¾Ý¿â->ÓÒ¼üµã»÷×Ô¼º½¨µÄÊý¾Ý¿â->ÊôÐÔ->ȨÏÞ
c¡¢Provider=sqlncliÒ²¿ÉÒÔ,UIDÓë“=”Ö®¼ä²»¿ÉÒÔ ......
ÔÎÄ´«ËÍÃÅ£ºhttp://topic.csdn.net/u/20091119/17/388cd1dd-4018-403f-a97f-0bc135895264.html?85256
Êý¾Ý¿âÀýÈç:
id ÐÕ Ãû ½± ½ð
1 ÕÅÈý 20Íò
2 ÀîËÄ 10Íò
3   ......
´Ó sql server 2000 ÖÐÌáÈ¡×Ö¶Î˵Ã÷ÎÄ×Ö
SELECT
[Table Name] = i_s.TABLE_NAME,
[Column Name] = i_s.COLUMN_NAME,
[Description] = s.value
from
INFORMATION_SCHEMA.COLUMNS i_s
LEFT OUTER JOIN ......