Forum Discussion
Dim sqlQuery As New Text.StringBuilder
sqlQuery.Append("Select Count(*) ")
sqlQuery.Append("From INFORMATION_SCHEMA.TABLES " )
sqlQuery.Append("Where 1=1 " )
sqlQuery.Append("AND TABLE_SCHEMA = 'dbo' " )
sqlQuery.Append("AND TABLE_NAME = 'YOUR TABLE NAME'")
' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' Connect To App DB, Execute SQL, obtain a DataTable With all the records returned By the SQL
' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Dim ds As Datatable
Using dbConn As DbConnInfo = BRApi.Database.CreateApplicationDbConnInfo(si)
ds = BRApi.Database.ExecuteSql(dbConn, sqlQuery.ToString, True)
End Using
If ds.Rows.Count > 1 Then
brapi.ErrorLog.LogMessage(si, "Exist")
Else
brapi.ErrorLog.LogMessage(si, "Does not exists")
End If
sql.Append("And TRIM('M' FROM RIGHT(TABLE_NAME, 2)) <= " & monthNo & " ")
Related Content
- 2 years ago
- 3 years ago
- 2 years ago