.netѧϰ×ܽᣨ6£©Ö®sqlserver ×Ô¶¨Ò庯ÊýÓë´æ´¢¹ý³Ì
21 Ò»¸öSQLServerµÄ×Ô¶¨Ò庯ÊýÖе÷ÓÃÒ»¸ö×Ô¶¨ÒåµÄ´æ´¢¹ý³Ì£¬Ö´Ðд˺¯Êýºó·¢³öÈçÏÂÌáʾ£º“Ö»Óк¯ÊýºÍÀ©Õ¹´æ´¢¹ý³Ì²ÅÄÜ´Óº¯ÊýÄÚ²¿Ö´ÐÐ"¡£
ÔÒò£ºº¯ÊýÖ»ÄÜʹÓüòµ¥µÄsqlÓï¾ä,Âß¼¿ØÖÆÓï¾ä£¬¸´ÔÓÒ»µãµÄ´æ´¢¹ý³ÌÊDz»Äܵ÷Óõģ¬ÔÚº¯ÊýÀïÒ²²»ÄÜʹÓÃexecute sp_executesql »òÕßexecute ¡£½â¾ö·½·¨°Ñº¯Êý¸ÄΪ´æ´¢¹ý³Ì£¬È»ºóÔÚÁíÒ»¸ö´æ´¢¹ý³ÌÖÐÏóµ÷Óú¯ÊýÒ»ÑùʹÓô˴洢¹ý³Ì¾Í¿ÉÒÔÁË¡£
ÏÂÃæÊÇÒ»¸ö´æ´¢¹ý³Ìµ÷ÓÃÁíÒ»¸ö´æ´¢¹ý³ÌµÄʵÀý£¬ÓвÎÊý´«µÝµÄ¡£
--´æ´¢¹ý³Ìsp_B
create proc sp_B
@A int ,
@B int ,
@C int output
AS
set @C = @A + @B
go
--´æ´¢¹ý³Ìp_A
create proc sp_A
@A int ,
@B int
as
declare @C int
exec sp_B @A , @B , @C output
print @C
go
--²âÊÔ
exec sp_A 3 , 5
22. ÔõÑùÖ´Ðдø²ÎÊýµÄSQLÓï¾ä£¬±ÈÈç˵×Ö¶ÎÊÇÒ»¸ö²ÎÊý£¬ÈçºÎд´æ´¢¹ý³Ì£¿ÊµÀýÈçÏ£º
Create proc [dbo].[jsxs]
(
@zb varchar(5),
@nr varchar(4),
@ID int,
@shu int output
)
AS
BEGIN
declare @sqls nvarchar(1000)--×¢Òâ´ËÀàÐÍ
if @nr='A'
set @zb=@zb+'1'
if @nr='B'
set @zb=@zb+'2'
if @nr='C'
set @zb=@zb+'3'
if @nr='D'
set @zb=@zb+'4'
if @nr='E'
set @zb=@zb+'5'
----------------------------------Ö÷Ìⲿ·Ö------------------------------------
set @sqls='select @a=' +@zb + ' from shumu where peID=' +cast(@ID as char)
exec sp_executesql
@sqls,
N'@a int output',@sh
Ïà¹ØÎĵµ£º
1.oracle»·¾³
create table test
(
id number(4),
name varchar2(20)
)
ÔÚÒ»¸ösessionÖÐ
insert into test values(1,'aa');
ÔÚÁíÒ»¸ösessionÖÐ
select * from test1;
²éѯû±»×èÈû
2.sqlserver»·¾³
ÔÚÒ»¸ösessionÖÐ
insert into test values(1,'aa');
ÔÚÁíÒ»¸ösessionÖÐ
select * from test1;
²éѯ±»×èÈû(Ê ......
bcpÃüÁîÊÇSQL ServerÌṩµÄÒ»¸ö¿ì½ÝµÄÊý¾Ýµ¼Èëµ¼³ö¹¤¾ß¡£Ê¹ÓÃËü²»ÐèÒªÆô¶¯ÈκÎͼÐιÜÀí¹¤¾ß¾ÍÄÜÒÔ¸ßЧµÄ·½Ê½µ¼Èëµ¼³öÊý¾Ý¡£bcpÊÇSQL ServerÖиºÔðµ¼Èëµ¼³öÊý¾ÝµÄÒ»¸öÃüÁîÐй¤¾ß£¬ËüÊÇ»ùÓÚDB-LibraryµÄ£¬²¢ÇÒÄÜÒÔ²¢Ðеķ½Ê½¸ßЧµØµ¼Èëµ¼³ö´óÅúÁ¿µÄÊý¾Ý¡£bcp¿ÉÒÔ½«Êý¾Ý¿âµÄ±í»òÊÓͼֱ½Óµ¼³ö£¬Ò²ÄÜͨ¹ýSELECT fromÓï¾ä¶Ô±í»òÊÓ ......
sqlserver£ºupdate Table_A set Table_A.col1 = (select Table_B.col1 from Table_B where Table_A.col2 = Table_B.col2)
Access: UPDATE Table_ A, Table_B SET Table_ A.×Ö¶Î2 = Table_ B.×Ö¶Î2
WHERE Table_ A.񅧏=Table_ A.񅧏;
×Ô¼º¼ÇÏ£¬ÌáÐÑ×Ô¼º ......
select a.UserName Óû§Ãû,b.LoginName ºÅÂë,c.MenuTitle ±êÌâ,max(a.AccessTime)·ÃÎÊʱ¼ä from JfAccessLog a,OaUser b,JfMenu c where CONVERT(char,a.AccessTime,112)=CONVERT(char,GETDATE(),112) and a.UserId=b.UserId and a.MenuId=c.MenuId and a.MenuId=@menu group by a.UserName,b.LoginName,c.Menu ......
±¾ÎÄת×Ô£ºhttp://blog.csdn.net/jinjazz/archive/2008/07/14/2650506.aspx
½«oledb¶ÁÈ¡µÄexcelÊý¾Ý¿ìËÙ²åÈëµÄsqlserverÖУ¬ºÜ¶àÈËͨ¹ýÑ»·À´Æ´½Ósql£¬ÕâÑù×ö²»µ«ÈÝÒ׳ö´í¶øÇÒЧÂʵÍÏ£¬×îºÃµÄ°ì·¨ÊÇʹÓÃbcp£¬Ò²¾ÍÊÇSystem.Data.SqlClient.SqlBulkCopy ÀàÀ´ÊµÏÖ¡£²»µ«Ëٶȿ죬¶øÇÒ´úÂë¼òµ¥£¬ÏÂÃæ²âÊÔ´ú ......