Commit d84f8a0d authored by solho's avatar solho

feat:memo UP

parent 83f7972b
--須開放屬性
exec sp_configure 'show advanced options',1
reconfigure
exec sp_configure 'Ad Hoc Distributed Queries',1
reconfigure
--DROP LinkServer
Exec sp_dropserver 'TestServer1' , 'droplogins';
--exec sp_dropserver '192.168.1.174', 'droplogins';
--Add LinkServer
EXEC master.dbo.sp_addlinkedserver
@server = N'TestServer1',
@srvproduct = N'MysqlLink',
@provider = N'SQLNCLI',
--@provstr = N'DRIVER={MySQL ODBC 8.0 unicode Driver}; SERVER=192.168.1.174; DATABASE=IPEasy; USER=sol; PASSWORD=Sport5000';
--@provstr = N'DRIVER={SQL Server};SERVER=120.78.73.107,6000;UID=account;PWD=accounttp;DATABASE=IPEasy';
--@provstr = N'DRIVER={SQL Server};SERVER=47.91.213.74,6001;UID=account;PWD="accuonttp";DATABASE=IPEasy';
@provstr = N'DRIVER={SQL Server};SERVER=120.79.0.56,6000;UID=sol;PWD=Sport5000;DATABASE=IPEasy';
--check linkedservers
exec sp_linkedservers
--add linkserverloging
--exec master.dbo.sp_addlinkedsrvlogin @rmtsrvname ='TestServer1',@useself =false,@rmtuser='account', @rmtpassword ='accounttp'
exec master.dbo.sp_addlinkedsrvlogin @rmtsrvname ='TestServer1',@useself =false,@rmtuser='sol', @rmtpassword ='Sport5000'
exec sp_serveroption @server='TestServer1', @optname='rpc', @optvalue='true'
exec sp_serveroption @server='TestServer1', @optname='rpc out', @optvalue='true'
exec sp_helpserver
--MSSQL
delete from TestServer1.IPEasy.[dbo].[esn_Customer_Group]
insert into TestServer1.IPEasy.[dbo].[esn_Customer_Group]( Handle_GroupId,Handle_GroupName,GroupId,GroupName,GroupId_parent,CustId)
select Handle_GroupId,Handle_GroupName,GroupId,GroupName,GroupId_parent,CustId from IPEasy.[dbo].[esn_Customer_Group]
select Handle_GroupId,Handle_GroupName,GroupId,GroupName,GroupId_parent,CustId from TestServer1.IPEasy.[dbo].[esn_Customer_Group]
select top 100 * from TestServer1.IPEasy.[dbo].esn_todos
--Mysql
--搜尋語法1 來源需支援4部分名稱結構
select top 10 * FROM TestServer1.IPEasy.dbo.esn_todos
--搜尋語法2 可跨資料庫
select * from openquery(MyLink, 'SELECT * FROM esm.t_pat_cpc_creation;') a
--須排除問題table
select top 100 a into #tmptest from OPENQUERY(TestServer1,
'SET FMTONLY OFF;exec [dbo].[rpt_PerformanceMonth] @p_RptType = ''showemp'',@p_Emp_ID = ''FD67D192-041B-4725-A3E1-CB5E62A5CC61'',@p_DateB = ''2020-03-01'' ,@p_DateE = ''2020-03-31'' , @p_Date_settlement='''' ,@p_gtPoint=0 ' ) a
SELECT * INTO #tempTable from
OPENROWSET('SQLNCLI11',
'Server=localhost;UID=sol;PWD=Sport5000',
'exec IPEasy.[dbo].[rpt_PerformanceMonth] @p_RptType = ''showemp'',@p_Emp_ID = ''FD67D192-041B-4725-A3E1-CB5E62A5CC61'',@p_DateB = ''2020-03-01'' ,@p_DateE = ''2020-03-31'' , @p_Date_settlement='''' ,@p_gtPoint=0 ' ) a
SELECT top 10 *
FROM OPENDATASOURCE( 'SQLOLEDB','Data Source=47.91.213.74,6001\;User ID=account;Password=accounttp' ).IPEasy.dbo.[rpt_CustCaseTot] '2020-05','2020-05' ,'byPeople_board_todos','','Month','All'
EXECUTE TestServer1.IPEasy.[dbo].rpt_CustCaseTot
@p_YM_F='2020-05'
,@p_YM_T='2020-05'
,@p_RptType='byPeople' -- byItem ,bydept,byds,bypeople,byPeople_board
,@p_CustName='',
@DisplayType ='Month',
@DataMode ='All'
--用完須開放屬性
exec sp_configure 'Ad Hoc Distributed Queries',0
reconfigure
exec sp_configure 'show advanced options',0
reconfigure
\ No newline at end of file
SHOW PROCESSLIST;
select GROUP_CONCAT(stat SEPARATOR ' ') from (select concat('KILL ',id,';') as stat
from information_schema.processlist WHERE user='sol' AND HOST LIKE '%michael-dev%') as stats;
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment