Retornar dia atual em coluna [SQL]
09/09/2022
0
Prezados, estou tentando retornar a data atual em uma coluna porém estou tendo muita dificuldade.
Bem.. segue o script :
Select tblassets.Assetname,
tblassets.Lastseen As data
From tblassets
Inner Join tblassetcustom On tblassets.AssetID = tblassetcustom.AssetID
Inner Join tsysassettypes On tsysassettypes.AssetType = tblassets.Assettype
Inner Join tsysIPLocations On tsysIPLocations.LocationID =
tblassets.LocationID
Left Outer Join tsysOS On tblassets.OScode = tsysOS.OScode
Inner Join tblState On tblState.State = tblassetcustom.State
Where tblassets.AssetID Not In (Select tblQuickFixEngineering.AssetID
From tblQuickFixEngineering Inner Join tblQuickFixEngineeringUni On
tblQuickFixEngineeringUni.QFEID = tblQuickFixEngineering.QFEID
Where tblQuickFixEngineeringUni.HotFixID Like '%KB5012170%') And
tblassets.Assettype In ( -1, 11, 13) And tblassetcustom.State = 1 And
tblassets.FQDN Like 'UCS%' And tsysOS.OSname = 'Win 10' And
tsysIPLocations.iplocation In ('Hospital Centro', 'Rio das Ostras',
'Posto Coleta 4', 'Posto Coleta 6', 'Manutenção', 'Hospital Glória',
'Galpão Almox') And tblState.Statename = 'Active'
Retorno :
Assetname Data
UCS101344D 09/09/2022 15:04:26
UCS101383D 09/09/2022 12:00:06
UCS101364D 09/09/2022 15:05:25
UCS101384D 08/09/2022 20:39:29
UCS101380D 08/09/2022 20:41:18
UCS101650D 12/07/2022 18:31:17
UCS101714D 25/08/2022 11:42:57
UCS101803D 31/08/2022 17:58:21
Oque posso fazer para que a coluna data, traga apenas os micros scaneados na rede, na data atual ?
Neste exemplo, a data atual seria dia 09
plataforma : Lansweeper
Bem.. segue o script :
Select tblassets.Assetname,
tblassets.Lastseen As data
From tblassets
Inner Join tblassetcustom On tblassets.AssetID = tblassetcustom.AssetID
Inner Join tsysassettypes On tsysassettypes.AssetType = tblassets.Assettype
Inner Join tsysIPLocations On tsysIPLocations.LocationID =
tblassets.LocationID
Left Outer Join tsysOS On tblassets.OScode = tsysOS.OScode
Inner Join tblState On tblState.State = tblassetcustom.State
Where tblassets.AssetID Not In (Select tblQuickFixEngineering.AssetID
From tblQuickFixEngineering Inner Join tblQuickFixEngineeringUni On
tblQuickFixEngineeringUni.QFEID = tblQuickFixEngineering.QFEID
Where tblQuickFixEngineeringUni.HotFixID Like '%KB5012170%') And
tblassets.Assettype In ( -1, 11, 13) And tblassetcustom.State = 1 And
tblassets.FQDN Like 'UCS%' And tsysOS.OSname = 'Win 10' And
tsysIPLocations.iplocation In ('Hospital Centro', 'Rio das Ostras',
'Posto Coleta 4', 'Posto Coleta 6', 'Manutenção', 'Hospital Glória',
'Galpão Almox') And tblState.Statename = 'Active'
Retorno :
Assetname Data
UCS101344D 09/09/2022 15:04:26
UCS101383D 09/09/2022 12:00:06
UCS101364D 09/09/2022 15:05:25
UCS101384D 08/09/2022 20:39:29
UCS101380D 08/09/2022 20:41:18
UCS101650D 12/07/2022 18:31:17
UCS101714D 25/08/2022 11:42:57
UCS101803D 31/08/2022 17:58:21
Oque posso fazer para que a coluna data, traga apenas os micros scaneados na rede, na data atual ?
Neste exemplo, a data atual seria dia 09
plataforma : Lansweeper
Pedro Costa
Curtir tópico
+ 0
Responder
Post mais votado
12/09/2022
Select tblassets.Assetname, tblassets.Lastseen As data From tblassets Inner Join tblassetcustom On tblassets.AssetID = tblassetcustom.AssetID Inner Join tsysassettypes On tsysassettypes.AssetType = tblassets.Assettype Inner Join tsysIPLocations On tsysIPLocations.LocationID = tblassets.LocationID Left Outer Join tsysOS On tblassets.OScode = tsysOS.OScode Inner Join tblState On tblState.State = tblassetcustom.State Where not tblassets.AssetID In ( Select tblQuickFixEngineering.AssetID From tblQuickFixEngineering Inner Join tblQuickFixEngineeringUni On tblQuickFixEngineeringUni.QFEID = tblQuickFixEngineering.QFEID Where tblQuickFixEngineeringUni.HotFixID Like '%KB5012170%') and tblassets.Assettype In ( -1, 11, 13) and tblassetcustom.State = 1 and tblassets.FQDN Like 'UCS%' and tsysOS.OSname = 'Win 10' and tsysIPLocations.iplocation In ( 'Hospital Centro', 'Rio das Ostras', 'Posto Coleta 4', 'Posto Coleta 6', 'Manutenção', 'Hospital Glória', 'Galpão Almox') and tblState.Statename = 'Active' and convert(date, tblassets.Lastseen) = convert(date, getdate()) -- aqui compara com o dia atual (SQL Server)
Emerson Nascimento
Responder
Mais Posts
Clique aqui para fazer login e interagir na Comunidade :)