The ISite interface and its Site implementation has an ID property which will give you the numeric ID of the site. I know you ask about the database table and not the object model, but I don't know those details by heart. Why do you need to dig around in the database for it?
P.S. The Common tables belong to the Common/Community framework rather than CMS, so this isn't really the right forum but I don't think it matters
The reason is that I have a stored procedure that retrieves mailsubscribers from certain site and I need to pass the internal site id for this reason. I dont know any other way to retrieve the mailsubscribers for a certain site. Any suggestions?
It's not the recipients but rather the recipient containers that are associated with a site. The IRecipientSource.GetRecipientContainers takes an Isite as an argument to filter by site. That way you get only lists (and thereby recipients) connected to that site.
How the site is tied to the container depends entierly on the IRecipientSource implementation. If you use only the EPiServer.Mail.Sources.Internal than that uses some database tables in the "core" EPiServer Mail database. The GetRecipientContainers method uses the sproc spEPiServerMailGetRecipientContainers so you could probably look at that for inspiration on how to find containers vs site ID:s and then spEPiServerMailGetRecipientsByContainer for recipient vs container ID:s.
But I still wouldn't recommend using direct database calls unless you absolutely have to, it's not supported.
As I can see from the sp's is that you have to pass the internal site ID "@intSiteID" and I cant find anywhere how to get it from my site. The examples that I have studied shows that you need to pass the internal site ID. The other way round works, e.g if you want to retrieve all container for all sites then u get the siteids, but i just want to find a "connection" between the PageReference.StartPage.ID and internal site id.
At first I thought PageReference.StartPage.ID was the same as siteid but apparently this was not the case.
The Site ID has nothing to do with a page ID. A site is the "Section" that you can create in the EPiServer Mail UI. "int" in the sproc is just hungarian notation for the type of the site ID. Perhaps you can see the site ID in some URL etc in the Secion management.
How do I get the internal siteID for the current site? I'm refering to the table [tblEPiServerCommonSite].