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

sql server·ÃÎÊÔ¶³ÌÊý¾Ý¿â

--´´½¨Á´½Ó·þÎñÆ÷
exec sp_addlinkedserver   'ITSV ', ' ', 'SQLOLEDB ', 'Ô¶³Ì·þÎñÆ÷Ãû»òipµØÖ· '
exec sp_addlinkedsrvlogin 'ITSV ', 'false ',null, 'Óû§Ãû ', 'ÃÜÂë '
--²éѯʾÀý
select * from ITSV.Êý¾Ý¿âÃû.dbo.±íÃû
--µ¼ÈëʾÀý
select * into ±í from ITSV.Êý¾Ý¿âÃû.dbo.±íÃû
--ÒÔºó²»ÔÙʹÓÃʱɾ³ýÁ´½Ó·þÎñÆ÷
exec sp_dropserver  'ITSV ', 'droplogins '
--Á¬½ÓÔ¶³Ì/¾ÖÓòÍøÊý¾Ý(openrowset/openquery/opendatasource)
--1¡¢openrowset
--²éѯʾÀý
select * from openrowset( 'SQLOLEDB ', 'sql·þÎñÆ÷Ãû '; 'Óû§Ãû '; 'ÃÜÂë ',Êý¾Ý¿âÃû.dbo.±íÃû)
--Éú³É±¾µØ±í
select * into ±í from openrowset( 'SQLOLEDB ', 'sql·þÎñÆ÷Ãû '; 'Óû§Ãû '; 'ÃÜÂë ',Êý¾Ý¿âÃû.dbo.±íÃû)
--°Ñ±¾µØ±íµ¼ÈëÔ¶³Ì±í
insert openrowset( 'SQLOLEDB ', 'sql·þÎñÆ÷Ãû '; 'Óû§Ãû '; 'ÃÜÂë ',Êý¾Ý¿âÃû.dbo.±íÃû)
select *from ±¾µØ±í
--¸üб¾µØ±í
update b
set b.ÁÐA=a.ÁÐA
from openrowset( 'SQLOLEDB ', 'sql·þÎñÆ÷Ãû '; 'Óû§Ãû '; 'ÃÜÂë ',Êý¾Ý¿âÃû.dbo.±íÃû)as a inner join ±¾µØ±í b
on a.column1=b.column1
--openqueryÓ÷¨ÐèÒª´´½¨Ò»¸öÁ¬½Ó
--Ê×ÏÈ´´½¨Ò»¸öÁ¬½Ó´´½¨Á´½Ó·þÎñÆ÷
exec sp_addlinkedserver   'ITSV ', ' ', 'SQLOLEDB ', 'Ô¶³Ì·þÎñÆ÷Ãû»òipµØÖ· '
--²éѯ
select *
from openquery(ITSV,  'SELECT *  from Êý¾Ý¿â.dbo.±íÃû ')
--°Ñ±¾µØ±íµ¼ÈëÔ¶³Ì±í
insert openquery(ITSV,  'SELECT *  from Êý¾Ý¿â.dbo.±íÃû ')
select * from ±¾µØ±í
--¸üб¾µØ±í
update b
set b.ÁÐB=a.ÁÐB
from openquery(ITSV,  'SELECT * from Êý¾Ý¿â.dbo.±íÃû ') as a 
inner join ±¾µØ±í b on a.ÁÐA=b.ÁÐA
--3¡¢opendatasource/openrowset
SELECT   *
from   opendatasource( 'SQLOLEDB ',  'Data Source=ip/ServerName;User ID=µÇ½Ãû;Password=ÃÜÂë ' ).test.dbo.roy_ta
--°Ñ±¾µØ±íµ¼ÈëÔ¶³Ì±í


Ïà¹ØÎĵµ£º

sql server 2005 ÅäÖÃÔ¶³ÌÁ¬½Ó

ÒÔÏÂ˵Ã÷¾ùÕë¶ÔÆóÒµ°æ»òÕß¿ª·¢°æ£»
1.¿ªÆôsql server ʵÀýµÄÔ¶³ÌÁ¬½Ó£»
    “¿ªÊ¼”-->“³ÌÐò”-->“Microsoft SQL Server 2005”-->“ÅäÖù¤¾ß”-->“SQL Server ÍâΧӦÓÃÅäÖÃÆ÷”-->“·þÎñºÍÁ¬½ÓµÄÍâΧӦÓÃÅäÖÃÆ÷”--> ......

v$sql,v$sqlarea,v$sqltextÓÐʲôÇø±ð

http://inthirties.com:90/thread-1202-1-1.html
v$sqltext
´æ´¢µÄÊÇÍêÕûµÄSQL,SQL±»·Ö¸î
SQL> desc v$sqltext
Name Null? Type
----------------------------------------- -------- ----------------------------
ADDRESS ......

SQLÓï¾ä²éѯÊÇ·ñΪ¿Õ =null¼°null

  a                  b                             c&nb ......

.net³ÌÐòÔ±ËùÐèÕÆÎÕµÄsql£¬»ù±¾¼¼ÇÉ(2)

1. ¼òÊö private¡¢ protected¡¢ public¡¢ internal ÐÞÊηûµÄ·ÃÎÊȨÏÞ¡£
´ð . private :  ˽ÓгÉÔ±, ÔÚÀàµÄÄÚ²¿²Å¿ÉÒÔ·ÃÎÊ¡£
    protected : ±£»¤³ÉÔ±£¬¸ÃÀàÄÚ²¿ºÍ¼Ì³ÐÀàÖпÉÒÔ·ÃÎÊ¡£
    public :    ¹«¹²³ÉÔ±£¬ÍêÈ«¹«¿ª£¬Ã»ÓзÃÎÊÏÞÖÆ¡£
    internal:  ÔÚÍ¬Ò ......

Sql ServerÖÐÈçºÎÅжϱí»òÕßÊý¾Ý¿âµÄ´æÔÚ

sql serverÖÐÈçºÎÅжϱí»òÕßÊý¾Ý¿âµÄ´æÔÚ£¬µ«ÔÚʵ¼ÊʹÓÃÖУ¬ÐèÅжÏStatus״̬λ£º
ÆäÖÐijЩ״̬λ¿ÉÓÉÓû§Ê¹Óà sp_dboption£¨read only¡¢dbo use only¡¢single user µÈ£©½øÐÐÉèÖãº
1 = autoclose£»Ê¹Óà sp_dboption ÉèÖᣠÊý¾Ý¿âÍêÈ«¹Ø±Õ£¬Æä×ÊÔ´ÔÚ×îºóÒ»¸öÓû§×¢ÏúºóÊÍ·Å¡£
4 = select into/bulkcopy£»Ê¹Óà sp_dbopti ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ