Hi,I need to assign output from SELECT statement to a declared variable. The statement mentioned below works with no issues.SET @TrackCount = (select count(events) from import_temp where @Id= Id)
Now I need to assign the data retrieved from the below mentioned SELECT statements.SELECT MAX(ScanDateTime) FROM import_temp WHERE @Id = IdSELECT MAX(DataDateTime) FROM import_temp WHERE @Id = IdSELECT max(convert(nvarchar,DataDateTime - ScanDateTime,108))FROM import_tempWHERE @Id = IdSELECT convert(nvarchar, convert(datetime, avg(convert(real, DataDateTime))), 108 )FROM import_tempWHERE @Id = Id
Is it possible to store the values returned from the above SELECT statements using SET command ( as shown for 1st SELECT stat above) ??Thanks,Sanchit