sql server - Run existing .sql file from Excel -
i have .sql file contains select
statement. there way directly import/run query in excel? can edit "command text" in "connection properties" of existing database connection, requires copying , pasting .sql code. browsing , selecting file want helpful.
i using sql server 2008 r2 , excel 2010.
i read variable first, can use in query. use this:
strpath = "p:\...sql" open strpath binary #1 mydata = space$(lof(1)) #1, , mydata close #1
now have query in mydata variable. may need reformat remove line returns before try run it.
Comments
Post a Comment