Using a for loop to create new columns to a dataframe

Here's an explanation of "why" FJCC's code should work.

With this line of code you provided:

SPC_TABLE$Count_of_row= nrow(sqlQuery(con,F[i]))

You're assigning the number of rows in the data.frame returned by sqlQuery to the entire Count_of_row column. So, each iteration of the loop is replacing the result from before. I'll provide some example data.

for (i in 1:nrow(SPC_TABLE)) {
  SPC_TABLE$Count_of_row <- nrow(tables[[i]])
  SPC_TABLE$Count_of_column <- ncol(tables[[i]])
  message("SPC_TABLE for iteration ", i)
  print(SPC_TABLE)
}
# SPC_TABLE for iteration 1
#   name Count_of_row Count_of_column
# 1    A            3               2
# 2    B            3               2
# 3    C            3               2
# SPC_TABLE for iteration 2
#   name Count_of_row Count_of_column
# 1    A            5               3
# 2    B            5               3
# 3    C            5               3
# SPC_TABLE for iteration 3
#   name Count_of_row Count_of_column
# 1    A            7               1
# 2    B            7               1
# 3    C            7               1

Like I said, this is what should work. To be sure, you'll need to provide a reprex: