_ | 覦覈襦 | 豕蠏手 | 殊螳 | 譯殊碁
FrontPage › Msg7342

Contents

1 Msg
2 T-SQL
3 願屋


1 Msg #

覃讌 7342, 譴 16, 1, 譴 2
郁屋 覯 "LinkedServerA" OLE DB 螻糾 "MSDASQL" "MSDASQL.login" 蠍一 NULL 螳 覦給. 伎 NULL 給.

2 T-SQL #

declare 
	@sql varchar(8000)

set @sql = '
select 
	login
,	logout
from openquery([LinkedServerA], ''
select 
	login
,	logout
from main.log_' + convert(char(6), getdate()-1, 112) + ''')
WHERE login >= CONVERT(char(8), GETDATE()-1 , 112) 
AND logout < CONVERT(char(8), GETDATE() , 112)
'
exec(@sql)

3 願屋 #

declare 
	@sql varchar(8000)

set @sql = '
select 
	cast(login as datetime) login --讌朱 cast 
,	logout
from openquery([LinkedServerA], ''
select 
	cast(login as char(50)) login --覓語朱 cast 
,	logout
from main.log_' + convert(char(6), getdate()-1, 112) + ''')
WHERE login >= CONVERT(char(8), GETDATE()-1 , 112) 
AND logout < CONVERT(char(8), GETDATE() , 112)
'
exec(@sql)
蠍 蠍郁鍵..
企: : るジ讓曙 襦螻豺 企Ν 譯殊語. 襦螻豺
EditText : Print : Mobile : FindPage : DeletePage : LikePages : Powered by MoniWiki : Last modified 2018-04-13 23:12:53

一 覦 蟆 覲企 蟆 . (襴ろ)