Minutes Difference Same Day (T-SQL)

// Get a time in the format : 8:00 AM
// Returns the minute difference in integer using the current time
// (only works for the same day but you can modify to work for any date).

ALTER FUNCTION [dbo].[GetMinutesDifference](@JustTime varchar(50))
RETURNS int
AS
BEGIN
    DECLARE @MinuteDifference int
	Set     @MinuteDifference = (SELECT DATEDIFF(minute, CONVERT(SMALLDATETIME, CONVERT(VARCHAR(8), GETDATE(), 112) + ' ' + @JustTime) , GETDATE()))
	Return  @MinuteDifference
END

OPENVPN Useful Sites

OPENVPN can be very tricky to set up  but with the right resources the setup is not quite as bad.  I tried to follow the OPENVPN manual (http://openvpn.net/index.php/open-source/documentation/howto.html)  but before I know it I was completely lost.  The subject got real complicated real fast; so naturally I turned to my dear friend GOOGLE and i was not disappointed.

These websites below made the process very easy for me  so hopefully they will do the same for you.

OpenVPN Windows HowTo  (A little old but very useful)
http://www.runpcrun.com/howtoopenvpn

How to configure OpenVPN (A little old but very useful)
http://www.itsatechworld.com/2006/01/29/how-to-configure-openvpn

Also did you know that Microsoft Windows comes with VPN out of the BOX?
Check these two videos out

Add a Mysql as a Linked Server

The other day I got a request to migrate some data from Mssql to Mysql.  I am like ok fine, I will just use SSIS and it will take me a second.

This second led to more than four hours of frustrations.  Why?  Apparently Microsoft decided not to put any ODBC destination connectors on

the SQL Server Intelligence Studio (SSIS – 2005 version).

Note that my evironment consists of  the sql server 2005, bids (2005) .

FYI: It seems that on the 2008 version, Microsoft gives us the ODBC provider back.

If you are still running the 2005 version here are the solutions:

Setup SQL Server Linked Server to MySQL
http://www.ideaexcursion.com/2009/02/25/howto-setup-sql-server-linked-server-to-mysql/

Adding Mysql as a linked server
http://www.infi.nl/blog/view/id/4/How_To_MySQL_as_a_linked_server_in_MS_SQL_Server

Insert into a MYSQL linked Server
http://www.youdidwhatwithtsql.com/insert-data-mysql-tsql/4