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

sql server 2005 Ææ¹ÖµÄÎÊÌâ ¹ØÓÚÃû×ֵĶ¨Î»

sql server 2005 ´¥·¢Æ÷ Ö´ÐÐsp_executesql µÄÎÊÌâ
db1,db2ÊÇÒ»¸ö·þÎñÆ÷ server µÄ2¸öÊý¾Ý¿â

db1µÄtable1  ½¨Á¢Ò»¸öafter update´¥·¢Æ÷ ,µ± update  table1 ºó½¨Á¢Ò»¸ö¸´ÖÆ±íµ½  db2µÄtable2ÖÐ

exec  server.db2.dbo.sp_executesql  N'select * into table2 from server.db1.dbo.table1'

µ±ÓÃserver.db1.dbo.table1  ʱ  ÎÞ·¨Õý³£ÔËÐб¨ÊÂÎñÉÏÏÂÎÄÕýÔÚʹÓÃ
µ±Óà     db1.dbo.table1  ʱ  ¿ÉÒÔÕý³£ÔËÐÐ

Èç¹ûÇ°±ß±ØÐë ¼Óserver ÈçºÎ½â¾ö  ÕâÊÇʲôԭÒòÔì³ÉµÄÄØ
SQL code:
--ÏÈ×ö鏈½Ó
--´´½¨Á´½Ó·þÎñÆ÷
exec sp_addlinkedserver 'ITSV', ' ', 'SQLOLEDB', 'Ô¶³Ì·þÎñÆ÷Ãû»òipµØÖ· '
exec sp_addlinkedsrvlogin 'ITSV', 'false ',null, 'Óû§Ãû ', 'ÃÜÂë '

--²éѯʾÀý
select * from ITSV.Êý¾Ý¿âÃû.dbo.±íÃû

--µ¼ÈëʾÀý
select * into ±í from ITSV.Êý¾Ý¿âÃû.dbo.±íÃû


ÄãÊDz»ÊÇ×°¶à¸ösql·þÎñ.ÊÔÊÔ»úÆ÷Ãû+ʵÀýÃûµÄ°ì·¨.

[servername/sqlʵÀýÃû].db1.dbo.table1 

Õâ¸öºÃÏóÊÇÒ»ÖÖ¸ñʽ

[servername\sqlʵÀýÃû].db1.dbo.table1 

ÊDz»ÊÇupdate»¹Ã»½áÊø£¿

·þÎñÆ÷Ãû.Êý¾Ý¿âÃû.dbo.±íÃû

ÒýÓÃ
SQL code--ÏÈ×ö鏈½Ó
--´´½¨Á´½Ó·þÎñÆ÷exec sp_addlinkedserver'ITSV','','SQLOLEDB','Ô¶³Ì·þÎñÆ÷Ãû»òipµØÖ·'exec sp_addlinkedsrvlogin'


Ïà¹ØÎÊ´ð£º

ÈçºÎÓÃc#£¬sql2000 ¿ª·¢c/sÏµĹ¤×÷Á÷£¿

±¾ÈËc#ÐÂÊÖ ¿ÉÊÇÒªÇóÒªÓÃc# £¬sql2000¿ª·¢c/sµÄ¹¤×÷Á÷£¬Ò»Í·ÎíË®£¬Çë´ó¼Ò°ïæ°ï棬¸øµã˼·£¬ËµµÄÔ¼¾ßÌåÔ½ºÃ£¬ÎÒÒ²ºÃÍùÄǸö·½Ãæȥѧϰ
http://www.hxzi.com/view/61402.html
B/S°æµÄ£¬»ù±¾Ë¼ÏëÓ¦¸Ã²î²»¶àµÄ¡£¡£ ......

sql ʱ¼äÎÊÌâ

sql table±íÓиöÎı¾ÀàÐ͵Äa×ֶΣ¬´æ´¢µÄÄÚÈÝÈ«²¿ÊÇÊý×Ö£¬ÀýÈç2009001£¬2008578ÕâÑùµÄ¸ñʽ£»b×Ö¶ÎÎı¾ÀàÐÍ£¬´æµÄÒ²ÊÇÊý×ÖÀýÈç 001£¬123
aspÀïÃæ strday=100£¬strb=001

ÎÒÏë¶Á³ö£¬´Óa×ֶεÄÊý×Ö°´´óµ½Ð¡µÄË ......

ÇóSQLÓï¾ä¿ØÖÆÒ»ÁеÄÖµ

ÄÄλ¸ßÊÖÌṩһ¸öSQlÓï¾ä£¬¿ØÖƱíÖÐÖ¸¶¨ÁеÄÖµ±ØÐëÊÇÕýÊý£¿
ÔÚ³ÌÐòÀïÃæÅжϲ»ºÃÂ𣿣¿

Äã¿ÉÒÔÔÚ½¨±íµÄʱºòÓÃcheckÔ¼Êø±íÖеĸÃ×Ö¶Îѽ£¡
È磺
create table tab_name£¨
name varchar2(20),
age numbe ......

sql server left join ÎÊÌâ

sqlÓï¾ä£º
select loan_plan_id,l_collect_plan.loan_id,l_collect_detail.collect_isfinished from l_collect_plan
left join l_collect_detail on l_collect_plan.return_times=l_collect_detail.collect_vo ......

Çósql´¥·¢Æ÷Óï¾ä

users±í
name  companyId  companyName


company±í
companyId  companyName
1          a¹«Ë¾
2          b¹«Ë¾
......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ