PDA

View Full Version : Sending a SQL String to SQL Server 2008 from Excel?



ChrisBow
11-07-2011, 11:25 AM
Hi guys, new!

I have a question, couldnt find an answer, maybe ive entered the wrong search terms?

Basically all i want to do is fire off a SQL string to SQL Server 2008 from Excel using VBA. I cant figure out the exact syntax i know its going to be along the lines of

"INSERT INTO table VALUES ('" & myVar & "');" etc. but does anyone know what the exact syntax is to send it off so then i can create a recordset from the sql im firing at it to then bring that recordset back to Excel? Would be a great help.

Thanks all
Chris