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

sqlserverÁ´½Ó·þÎñÆ÷ʹÓ÷½·¨

EXEC sp_addlinkedsrvlogin @rmtsrvname = 'serverontest', @useself = 'false', @locallogin = 'sa', @rmtuser = 'sa', @rmtpassword = 'passwordofsa'
Ìí¼ÓµÇ¼·½Ê½
ÒÔÉÏÁ½¸öÓï¾äÖУ¬@serverΪ·þÎñÆ÷µÄ±ðÃû£¬@datasrcΪҪÁ´½ÓµÄÄ¿±êÊý¾Ý¿âµÄÁ¬½Ó´®£¬@rmtsrvnameΪ±ðÃû,@localloginΪ±¾µØµÇ¼µÄÓû§Ãû£¬@rmtuserºÍ@rmtpasswordΪҪÁ´½ÓµÄÄ¿±êÊý¾Ý¿âµÄµÇ¼Óû§ÃûºÍÃÜÂë
Ìí¼ÓÍêÁ´½Ó·þÎñÆ÷Ö®ºó£¬¿ÉÒÔͨ¹ýselect * from sys.linked_logins ºÍ select * from sys.serversÀ´²é¿´ÒѾ­Ìí¼ÓµÄÁ´½Ó·þÎñÆ÷ºÍµÇ¼½ÇÉ«
Ìí¼ÓÍêÁ´½Ó·þÎñÆ÷ºó£¬Ê¹ÓÃselect * from ±ðÃû.¿âÃû.dbo.±íÃû À´¶ÔÆäÖеÄÊý¾Ý½øÐвéѯ
ɾ³ýÁ´½Ó·þÎñÆ÷µÇ¼ӳÉäºÍÁ´½Ó·þÎñÆ÷µÄ·½·¨£º
¡¡¡¡exec sp_droplinkedsrvlogin 'serverontest' ,'sa' 
¡¡¡¡exec sp_dropserver 'serverontest'
Àý×Ó£º
EXEC sp_addlinkedserver 'xiaoming','','MSDASQL',NULL,NULL,'DRIVER={SQL Server};SERVER=172.18.17.65;UID=sa;PWD=vip;'
--½¨Á¢Á´½Ó·þÎñÆ÷µÇ¼ӳÉä
exec sp_addlinkedsrvlogin @rmtsrvname='xiaoming',@useself='false',@locallogin='sa',@rmtuser='sa',@rmtpassword='vip'
go
¡¡¡¡--²éѯÊý¾Ý   
select * from xiaoming.HR_QustionNew.dbo.T_Organise 
¡¡¡¡--ɾ³ýÁ´½Ó·þÎñÆ÷µÇ¼ӳÉäºÍÁ´½Ó·þÎñÆ÷:   
exec sp_droplinkedsrvlogin 'xiaoming' ,'sa' 
exec sp_dropserver 'xiaoming'   
¡¡¡¡×¢ÒâÊÂÏî:   
¡¡¡¡SET IDENTITY_INSERT [ database.[ owner.] ] { table } { ON | OFF }   
¡¡¡¡ËùÒÔ²»ÄÜͨ¹ýÁ¬½Ó·þÎñÆ÷ÉèÖôËÊôÐÔ   
¡¡¡¡into Ò²´æÔÚÕâÑùµÄÎÊÌâ   
¡¡¡¡select * into xiaoming.northwind.dbo.tt from   
¡¡¡¡xiaoming.northwind.dbo.tt  


Ïà¹ØÎĵµ£º

Sqlserver×Ô¶¯±¸·Ý

Ò»¡£SqlServer×Ô¶¯×÷Òµ±¸·Ý
1¡¢´ò¿ªSQL Server Management Studio
2¡¢Æô¶¯SQL Server´úÀí
3¡¢µã»÷×÷Òµ->н¨×÷Òµ
4¡¢"³£¹æ"ÖÐÊäÈë×÷ÒµµÄÃû³Æ
5¡¢Ð½¨²½Ö裬ÀàÐÍÑ¡T-SQL£¬ÔÚÏÂÃæµÄÃüÁîÖÐÊäÈëÏÂÃæÓï¾ä
DECLARE @strPath NVARCHAR(200)
set @strPath = convert(NVARCHAR(19),getdate(),120)
set @strPath=replace(@ ......

oracleÓësqlserverÖ´ÐÐcount(*)·µ»ØµÄ½á¹û¼æÈÝ

ÓÉÓÚÒÔÇ°¶¼ÊÇÔÚsqlserver 2005´¦Àí£¬ÏÖÔÚ¿Í»§ÒªÇóoracleÊý¾Ý¿â·þÎñÆ÷£¬
×î³õµÄ´úÂëΪ£º
allRecordSize = (Integer) rs1.getObject(1);    //Integer allRecordSize=0;
µ±Ö´ÐеÄʱºò±¨£ºBigDecimalÎÞ·¨×ª»¯ÎªIntegerÀàÐÍ
ΪÁ˼æÈÝÁ½ÕßÐ޸ĺóµÄ´úÂëΪ£º
  Object o = rs1.getObject(1);
 &nbs ......

SqlServer´æ´¢¹ý³Ì·ÖÒ³

--TOP n ʵÏÖµÄͨÓ÷ÖÒ³´æ´¢¹ý³Ì(ת×Ô×Þ½¨)
CREATE PROC sp_PageView
@tbname sysname, --Òª·ÖÒ³ÏÔʾµÄ±íÃû
@FieldKey nvarchar(1000), --ÓÃÓÚ¶¨Î»¼Ç¼µÄÖ÷¼ü(Ωһ¼ü)×Ö¶Î,¿ÉÒÔÊǶººÅ·Ö¸ôµÄ¶à¸ö×Ö¶Î
@PageCurrent int=1, --ÒªÏÔʾµÄÒ³Âë
@PageSize int=10, - ......

Sqlserver È¡ºº×ֵĵÚÒ»¸ö×Öĸ£¬·½±ãÄ£ºý²éѯ

 create function comm_getpy
(
    @str nvarchar(4000)
)
returns nvarchar(4000)
as
begin
declare @word nchar(1),@PY nvarchar(4000)
set @PY=''
while len(@str)>0
begin
    set @word=left(@str,1)
    --Èç¹û·Çºº×Ö×Ö·û£¬·µ»ØÔ­×Ö·û
& ......

SQLserver×Ö·û´®·Ö¸îº¯Êý

SQLserver×Ö·û´®·Ö¸îº¯Êý
Ò»¡¢°´Ö¸¶¨·ûºÅ·Ö¸î×Ö·û´®£¬·µ»Ø·Ö¸îºóµÄÔªËظöÊý£¬·½·¨ºÜ¼òµ¥£¬¾ÍÊÇ¿´×Ö·û´®ÖдæÔÚ¶àÉÙ¸ö·Ö¸ô·ûºÅ£¬È»ºóÔÙ¼ÓÒ»£¬¾ÍÊÇÒªÇóµÄ½á¹û¡£
CREATE function Get_StrArrayLength
(
  @str varchar(1024),  --Òª·Ö¸îµÄ×Ö·û´®
  @split varchar(10)  --·Ö¸ô·ûº ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ