1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185
|
DECLARE
@html nvarchar(max)
Set
@html =
N'<!DOCTYPE html>'
+
N'<html><head>'
+
N'<style>'
+
N'#entete{position: absolute;left: 1px;top: 0px;height: 120px;background-color: #9CC;z-index:10;border: 1px solid black;}'
+
N'#entete th{width:100px;border:1px solid #000; display: inline-block;'
+
N' white-space: nowrap;'
+
N' /* IE9+ */'
+
N'-ms-transform: none;'
+
N'-ms-transform-origin: none;'
+
N' /* IE8+ */'
+
N'-ms-writing-mode: tb-rl;'
+
N' /* IE7 and below */'
+
N'*writing-mode: tb-rl; }'
+
N'#table {position: absolute;overflow-x: hidden; overflow-y: auto;left: 1px;top: 120px;width: 1216px;height: 400px;background-color: #99C;z-index:10;border: 1px solid black;}'
+
N'td{width:100px;border:1px solid #000; }'
+
N'#entete table{width:1200px; height:120px;border: 1px solid black;}'
+
N'#table table{width:1200px; height:400px;border: 1px solid black;}'
+
N'#table table tr {height:20px;border: 1px solid black;}'
+
N'#colonne {width:100px;border: 1px solid black;}'
+
N'#table, th, td, tr {border: 1px solid black;}'
+
N'</style>'
+
N'<script type="text/javascript">'
+
N'function doOnScroll(mondiv)'
+
N'{document.getElementById("table table").style.top=(50-mondiv.scrollTop)+"px"}'
+
N'</script>'
+
N'</head>'
+
N'<body>'
+
N'<DIV>'
+
N' <div id="entete">'
+
N'<TABLE>'
+
N'<tr><th>Date</th><th>Heure</th><th>Concentration</th><th>Contamination <30%</th><th>Différence fluorescence</th><th>Etat filtre lampe</th><th>Densité UV > 1500µW/cm²</th><th>Lumière blanche <20 lux lampe</th><th>Lumière blanche <20 lux ambiance</th><th>Lumière ambiante >1000 lux</th><th>x</th></tr>'
+
N'</TABLE></DIV>'
+
N'<div id="table" onscroll="doOnScroll(this);">'
+
N'<TABLE>'
--create proc prsuiviXML
--as
declare @XmlOutput xml
set @XmlOutput = (
Select
td = ISNULL(Date, '' ),''
,td = ISNULL(Heure, '' ),''
,td = ISNULL(Concentration, '' ),''
,td = ISNULL([Contamination <30%], 0),''
,td = ISNULL([Diff fluorescence],0),''
,td = ISNULL([Etat filtre lampe],0),''
,td = ISNULL([Densite UV > 1500uW/cm],0),''
,td = ISNULL([Lumiere blanche <20 lux lampe],0),''
,td = ISNULL([Lumiere blanche <20 lux ambiance],0),''
,td = ISNULL([Lumiere ambiante >1000 lux],0),''
,td = ISNULL([X],0),''
FROM [suivi]
-- WHERE Date >= dateadd(day,datediff(day,30,GETDATE()),0) --query for all of rows from X PREVIOUS DAYS
-- AND Date <= dateadd(day,datediff(day,0,GETDATE()),0) --get yestersday no time:
ORDER BY Date DESC, Heure DESC
For XML PATH('tr'), ELEMENTS)
--select @XmlOutput
--go
--exec prsuiviXML
DECLARE
@html2 nvarchar(max)
Set
@html2 =
N' </TABLE>'
+
N' </div>'
+
N' </div>'
+
N'</body>'
DECLARE @File varchar(300) = 'c:\sql\out.HTML'
--DECLARE @Text varchar(8000) = 'Sample text'
DECLARE @OLE INT
DECLARE @FileID INT
EXECUTE sp_OACreate 'Scripting.FileSystemObject', @OLE OUT
EXECUTE sp_OAMethod @OLE, 'OpenTextFile', @FileID OUT, @File, 8, 1
EXECUTE sp_OAMethod @FileID, 'WriteLine', Null, @html
EXECUTE sp_OAMethod @FileID, 'WriteLine', Null, @XmlOutput
EXECUTE sp_OAMethod @FileID, 'WriteLine', Null, @html2
EXECUTE sp_OADestroy @FileID
EXECUTE sp_OADestroy @OLE |
Partager