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

SqlServerÓαêÀí½â

Óαê²Ù×÷µÄÁù²½Öè:
 ¡ôÔÚÿ´ÎÔÚ´´½¨ÓαêµÄʱºò¶¼ÎÊÎÊ×Ô¼º,ÓÃʲô±ðµÄ·½·¨¿ÉÒÔ±ÜÃâʹÓÃÓαê,ÄÇôÄã¾Í²½ÈçÉè¼ÆµÄÕý¹æÁË.
    1.ÉùÃ÷
    2.´ò¿ª
    3.Ó¦ÓÃ/²Ù×÷
    4.¹Ø±Õ.
    5.ÊÍ·Å
      ÉùÃ÷ÓαêµÄ»ù±¾Óï·¨ÈçÏÂ:
      Declare <cursor name> cursor
      For <select statement>
  
°¸Àý1: MySchool
if exists(select * from sysobjects where name='cursc')
    drop proc cursc
Go
create procedure cursc
as
declare
       @question varchar(210),         --ÎÒÃDZØÐëÉùÃ÷±äÁ¿À´´æ·ÅµÃµ½µÄ¼Ç¼
       @a varchar(50),
       @b varchar(50),
       @c varchar(50),
       @d varchar(50),
       @answer varchar(50),
       @num int
 
declare MyCursor cursor  --ÉùÃ÷ÎÒÃǵÄÓαê
Global --È«¾Ö ÓαêµÄ·¶Î§»¹ÓÐÒ»¸öÊǾֲ¿(Local)
for select question ,OptionA,OptionB,OptionC,OptionD,Answer from question  --¶ÔÓ¦µÄSQLÓï¾ä ºóÃæ´ò¿ªÓαê¾ÍÊÇ´ò¿ª
 
set @num=1 --ÉèÖñêÁ¿±íʾÓαêµÄÒÆ¶¯
 
open MyCursor --´ò¿ªÎÒÃǵÄÓαêÕâʵ¼ÊÖ´ÐÐÁËFor´Ó¾äµÄÖ÷Ìå²éѯ,µ«ÎÒÃÇÈÔȻûÓн«Êý¾Ý
             --·ÅÔÚºÏÊʵÄλÖýøÐкÏÊʵĴ¦Àí,Òò´ËÎÒÃÇÐèÒª´¦ÀíÒ»×éÊÂÇé.
                                                --1.»ñÈ¡µÚÒ»ÌõÀí·»òÕßFetch
              &n


Ïà¹ØÎĵµ£º

Sqlserver ÖÐÁÙʱ±íºÍÈ«¾ÖÁÙʱ±í

SQL Server Ö§³ÖÁÙʱ±í¡£ÁÙʱ±í¾ÍÊÇÄÇЩÃû³ÆÒÔ¾®ºÅ (#) ¿ªÍ·µÄ±í¡£Èç¹ûµ±Óû§¶Ï¿ªÁ¬½ÓʱûÓгýÈ¥ÁÙʱ±í£¬SQL Server ½«×Ô¶¯³ýÈ¥ÁÙʱ±í¡£ÁÙʱ±í²»´æ´¢ÔÚµ±Ç°Êý¾Ý¿âÄÚ£¬¶øÊÇ´æ´¢ÔÚϵͳÊý¾Ý¿â tempdb ÄÚ¡£
ÁÙʱ±íÓÐÁ½ÖÖÀàÐÍ£º 
±¾µØÁÙʱ±í 
ÒÔÒ»¸ö¾®ºÅ (#) ¿ªÍ·µÄÄÇЩ±íÃû¡£Ö»ÓÐÔÚ´´½¨±¾µØÁÙʱ±íµÄÁ¬½ÓÉϲÅÄÜ¿´ ......

SQLSERVERÒÉÎÊ

ÒÉÎÊ£º
1£¬ sqlserverÀïÃæÖ´ÐÐ xp_cmdshell
exec @error=xp_cmdshell 'cmdstr......'
·µ»ØÖµÊÇʲôֵ£¿dosÃüÁîµÄ´íÎó£¿Ê²Ã´ÑùµÄ´íÎó¿ÉÒÔÆË×½µ½£¿
±ÈÈç:
DECLARE @error int
EXEC @error=master.dbo.xp_cmdshell 'bcp CM_DWHSend.dbo.WK_CM_DWHSend_Master in  "D:\Sales\DWH_Onl\2010042_SENDMEMM.csv" -n -t, - ......

vc++ SQLServerÌí¼Ó²Ù×÷ʵÏÖ

/*
*SQLServerÌí¼Ó²Ù×÷ʵÏÖ
*/
void CMFCSQLDlg::OnButton2()
{
// TODO: Add your control notification handler code here
CString strsql;
CString strnum="mynum3";
CString strage="myage3";
HRESULT hResult;
_variant_t RecordsAffected;
CoInitialize(NULL);
_ConnectionPtr  m_pAppConn;
hResul ......

Access¡¢SQLServer¡¢Oracle³£¼ûSQLÓï¾äÓ¦ÓÃÇø±ð


Access¡¢SQLServer¡¢Oracle³£¼ûSQLÓï¾äÓ¦ÓÃÇø±ð
¹Ø¾¢ËÉ PMP
Èç¹ûÒª¼æÈÝAccess¡¢SQL Server¡¢OracleÈý¸öÊý¾Ý¿â°æ±¾£»ÎÒÃÇÔÚ±àдSQLÓï¾äµÄ¹ý³ÌÖУ¬¾¡Á¿Ê¹ÓÃһЩͨÓõÄÓï¾ä£¬µ«»¹ÊÇÓÐЩ·½ÃæÓÐÐ©Çø±ð±ÜÃâ²»ÁË£¬ÏÖ¼òµ¥×ܽáһϡ£
ÒÔÏÂA´ú±íAccess,S´ú±íSQL Server,O´ú±íOracle
1¡¢È¡µ±Ç°ÏµÍ³Ê±¼ä
A:Select Now()
S:Selec ......

ÈçºÎ»ñµÃsqlserverÊý¾Ý¿âÖÐÕ¼ÓøßcpuÓû§µÄ»î¶¯ÄÚÈÝ


ÈçºÎ»ñµÃsqlserverÊý¾Ý¿âÖÐÕ¼ÓøßcpuÓû§µÄ»î¶¯ÄÚÈÝ
1¡¢´Ó΢ÈíÕ¾µãÉÏÏÂÔØqslice_setup.exe
2¡¢´ò¿ªQuery Analyzer£¬ÔËÐÐÒÔÏÂÓï¾ä£º
declare @a int
while (1<2)
begin
select @a=1
end
½«»á·¢ÏÖcpuÂíÉÏ´ïµ½100%
3¡¢´ò¿ªqlice.exe£¬½«·¢ÏÖsqlserver.exeµÄcpuÕ¼ÓÃÂʺܸߣ¬Ë«»÷½øÈ룬³öÐÐsqlserver.exeÖоßÌåÏß³ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ