The usual way to force a database connection is to use the NOPROMPT option. This is how you do it via a CONNECT statement if you are using ODBC to connect to SQL Server and are using Windows authentification, assuming your SAS server runs on Windows:
connect to odbc (noprompt = "server=MySQLserver;DRIVER=SQL Server;Trusted Connection=yes;DATABASE=Mydatabase;" readbuff = 32767);
If you want more specific help then you need to provide details of how you connect to your SQL Server database.