you need to create a subroutine called writesql - with the following code .. then you call the subroutine with the paramters sub WriteSQL(Location,DeviceName,UpTime,DownTime) On Error Resume Next Dim conn Set conn = createobject("Adodb.Connection") Dim sConnString Dim SqlStatement sConnString = "Provider=SQLOLEDB;Data Source=" & SQLServer01 & "; Initial Catalog=" & MerakiDB & "; Integrated Security=SSPI;" conn.Open sConnString conn.CommandTimeout = 900 SqlStatement = "INSERT INTO [dbo.TheTable] Location,DeviceName,UpTime,DownTime) VALUES (Location,DeviceName,UpTime,DownTime)" conn.Execute(SqlStatement) conn.close Set conn = Nothing If Err.Number <> 0 Then WScript.Echo "Error Writing to SQL " & Err.Description Err.Clear End If end sub then you call the above For i = 0 to Ubound(apiData) < process your data > call WriteSQL(Location,DeviceName,UpTime,DownTime) NEXT May I ask, do you have any software development experience
... View more