Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Alter Query to get file location

Author  Topic 

Anne Troy
Starting Member

3 Posts

Posted - 2012-01-09 : 12:26:04
Can SQL, like VBA, request the location of a file with a userform or browse dialog? I am running 2008 R2, but that forum group didn't seem to have a place to ask code questions. Please move the post if necessary. :)

OPENROWSET('Microsoft.Jet.OLEDB.4.0',
'Excel 8.0;Database=C:\import.xls;IMEX=1',


I want to be able to let the user, on-the-fly, change the name and path of the import file or, better yet, browse to it.

Either the code or a pointer toward an example or how I can do this would be wonderful. I am nearly brand-new to SQL, but do a bit of VBA. Thanks in advance for any help!

X002548
Not Just a Number

15586 Posts

Posted - 2012-01-09 : 12:28:19
Why would that be a sql server question?

Aren't you creating your own dialog, THEN calling a stored procedure?



Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx


Want to help yourself?

http://msdn.microsoft.com/en-us/library/ms130214.aspx

http://weblogs.sqlteam.com/brettk/

http://brettkaiser.blogspot.com/


Go to Top of Page

Anne Troy
Starting Member

3 Posts

Posted - 2012-01-09 : 12:36:05
Can you tell me which forum I would ask the question? Or am I in a completely wrong site altogether?

The only purpose for the dialog would be to choose the file from which I want to import. I didn't write the code, I'm just trying to alter it to make it more user friendly. I don't want the user to have to always rename a file to "import" because it's never clear whose data is in that import. I have other stored procedures that use the file import.xls and it's different data altogether. I'm trying to get away from the generic use of import.xls.
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2012-01-09 : 12:45:26
what are you trying to modify? management studio?

Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx


Want to help yourself?

http://msdn.microsoft.com/en-us/library/ms130214.aspx

http://weblogs.sqlteam.com/brettk/

http://brettkaiser.blogspot.com/


Go to Top of Page

Anne Troy
Starting Member

3 Posts

Posted - 2012-01-09 : 13:04:23
Yes. That is what it is. LOL Sorry!

It's a *.sql file.
Go to Top of Page
   

- Advertisement -