I have a switch with 2 SFP port and I want to connect a fiber optic cable to the switch. I need to connect the cable only on one SFP port or on both SFP port?
Each SFP port can host an optical transceiver which has a send and receive port. So you connect one fiberpair to one transceiver. If your switch has room for two transceivers, you need to connect send and receive to one transceiver, and you have room for one more fiber connection.
One will work, but two can provide redundancy as well as doubling the bandwidth (port channel setup required)