Since Twitter made the switch to use oAuth the single most requested feature for Tweet-SQL has been for better handling of multiple twitter accounts. While it was possible to use multiple accounts, with no restriction, you had to go through the oAuth process every time you wanted to change usernames. Obviously this won’t do so I’ve improved this in the next version of Tweet-SQL.

Firstly, assuming you’ve already gone through the oAuth process for Tweet-SQL once we need to copy the current active account. Just run the below TSQL in SSMS against the database you have installed the software in.

EXEC dbo.tweet_cfg_copy_oauth_account;

This will copy the Twitter account details from the registry to a table called dbo.tweet_oauth_accounts. This account remains active for Tweet-SQL.

Next we need to authorise the additional account with the Tweet-SQL configuration program. Launch the tool, change the username field to the new account screen name, click File > Save Config.

tweet-sql_configuration_program

Click oAuth > Get Access Token to begin the oAuth process. The following dialog will appear. Click ‘Yes’. Provided you have executed the dbo.tweet_cfg_copy_oauth_account procedure the old account details will be saved.

tweet-sql_popup_dialog

In a few moments your browser will launch and you will be prompted to login to Twitter. Login with the appropriate account, authorise Tweet-SQL and copy the pin.

twitter_oauth_pin

Return to the Tweet-SQL configuration program and paste the pin into the dialog box.

tweet-sql_oauth_pin_dialog

Click ‘OK’ and a success dialog should appear.

tweet-sql_oauth_successful

Return to SSMS and run the below TSQL to add the new account to the dbo.tweet_oauth_accounts table

EXEC dbo.tweet_cfg_copy_oauth_account;

Now you should have two accounts available for Tweet-SQL.

SELECT twitter_username
FROM dbo.tweet_oauth_accounts;

tweet-sql_oauth_two_accounts

To select a particular twitter account we run….

EXEC dbo.tweet_cfg_change_oauth_account 'rhyscampbell';

Then we can post a status from this account;

EXEC dbo.tweet_sts_update 'Sending a test status...', null;

Then to change accounts…

EXEC dbo.tweet_cfg_change_oauth_account 'tweetsql';
EXEC dbo.tweet_sts_update 'Testing the new multiple account support for oAuth in Tweet-SQL.', null;

Change back once more…

EXEC dbo.tweet_cfg_change_oauth_account 'rhyscampbell';
EXEC dbo.tweet_sts_update 'Sending another test status...!', null;

That’s it! There’s no limits to the number of accounts this method will support, 2 or 2, 000! The next version of Tweet-SQL will be released in the coming weeks. In the meantime have some fun with the current version.