sql server2005·µ»ØÖµÎÊÌâ
(1)¹ØÓÚ´æ´¢¹ý³Ì·µ»ØÖµÎÊÌ⣨output,ruturn£©
output´æ´¢¹ý³Ì£º
alter proc usp_update
@count int output
as
set @count=(select count(*) from stu)
return´æ´¢¹ý³Ì£º
alter proc usp_update
as
declare @count int
set @count=(select count(*) from stu)
return @count
.net´úÂ루output£©£º
SqlConnection con = new SqlConnection ("server=95F188CF1A24424;uid=jinzhiyuan;pwd=jinzhiyuan;database=student");
con.Open();
SqlCommand cmd = new SqlCommand("usp_update",con);
cmd.Parameters.Add("@count", SqlDbType.Int);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters["@count"].Direction = ParameterDirection.Output;
cmd.ExecuteNonQuery();
int j=(int)cmd.Parameters["@count"].Value;
Response.Write("ÎÒÊǸողÅÖ´ÐеÄÖµ£º"+j);
con.Close();
.net´úÂ루return£©
SqlConnection con = new SqlConnection("server=95F188CF1A24424;uid=jinzhiyuan;pwd=jinzhiyuan;database=student");
con.Open();
SqlCommand cmd = new SqlCommand("usp_update",con);
cmd.Parameters.Add("@count", SqlDbType.Int);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters["@count"].Direction = ParameterDirection.Ret
Ïà¹ØÎĵµ£º
ÒÔÇ°Ò»Ö±¾õµÃlinq to sqlÉú³ÉÀàËÆwhere id not in (1,3,5)»òwhere id not in (select id from ...)ÕâÑùµÄÌõ¼þ²»ÊǺܷ½±ã£¬Ã¿´ÎÎÒ¶¼ÊÇ°ÑÌõ¼þIDÊÂÏÈÈ¡µ½Ò»¸öÊý×éÀȻºóÓà !Arr.Contains(c.Id)ÕâÑù´¦Àí£¬½ñÌìͻȻ·¢ÏÖÕâÑùºÃɵ£¬Æäʵ¿ÉÒÔÍêÈ«Ö±½ÓÓÃlinqд³ÉÒ»¾ä£¬Ìù¸öʾÀýÔÚÕâÀÒԺ󱸲é
from a in TableA where !(fr ......
in µÄ»°£¬ Èç¹ûÊÇnull ¾Í²»±È½ÏÁË£¬¼È²»ÊÇin Ò²²»ÊÇ not in
existsµÄ»° ÒòΪÓà = ¼ÓÔÚÌõ¼þÀï±È½ÏÁË£¬ËùÒÔ null ÊÇ not exists
select *
from pricetemp
where cast(ÉÌÆ·¥³ー¥É as varchar(10))not in(
select shohin_cd
&nbs ......
´úÂëÈçÏ£º
EXEC sp_rename '±íÃû.[ÔÁÐÃû]', 'ÐÂÁÐÃû', 'column'
*************************************************************************
Transact-SQL ²Î¿¼
sp_rename
¸ü¸Äµ±Ç°Êý¾Ý¿âÖÐÓû§´´½¨¶ÔÏó£¨Èç±í¡¢ÁлòÓû§¶¨ÒåÊý¾ÝÀàÐÍ£©µÄÃû³Æ¡£
ʾÀý
A. ÖØÃüÃû±í
ÏÂÀý½«±í customers ÖØÃüÃûΪ custs¡£ ......
ͨÅä·û_
"_"ºÅ±íʾÈÎÒâµ¥¸ö×Ö·û,¸Ã·ûºÅÖ»ÄÜÆ¥ÅäÒ»¸ö×Ö·û."_"¿ÉÒÔ·ÅÔÚ²éѯÌõ¼þµÄÈÎÒâλÖÃ,ÇÒÖ»ÄÜ´ú±íÒ»¸ö×Ö·û.Ò»¸öºº×ÖֻʹÓÃÒ»¸ö"_"±íʾ.
Àý×Ó£º
if PATINDEX('%[ß¹-×ö]%','ÐèÒªÅжϵÄ×Ö·û')>0 -- ÅжÏÊÇ·ñÓÐ×Ö·û
print 'Óкº×Ö'
else
print 'ÎÞºº×Ö'
ͨÅä·û%
"%"·ûºÅÊÇ×Ö·ûÆ¥Åä·û,ÄÜÆ¥Åä0¸ö»ò¸ü¶à×Ö·ûµÄÈÎÒⳤ¶ ......
SQL×¢Èë¹¥»÷·À·¶¼¼ÇÉ
Ò»°ãµÄSQL×¢Èë¹¥»÷¶¼ÊÇͨ¹ý¹¹½¨Ò»Ìõ¸´ÔÓµÄsqlÓï¾ä£¬
ͨ¹ýÍøҳ©¶´À´Ö´ÐÐsqlÓï¾ä£¬´ïµ½¹¥»÷Êý¾Ý¿âµÄÄ¿µÄ¡£
Èçͨ¹ýÎÄÕÂIDÀ´²éѯijһƪÎÄÕµÄÍøÒ³£¬
ͨ³£²ÉÓõÄsqlÓï¾äΪ£º
sql="select top 1 * from articles where articId="&request("id")
ÄÇô¿ÉÒÔ¼òµ ......