Link to home
Start Free TrialLog in
Avatar of shragi
shragiFlag for India

asked on

sql to access file in different server

Hi,

I have a test file in server A and my DB server is in server B.
Now I want to write query in SSMS from Server B and that query should access the file from server A and parse it to store the data in DB.

I am not sure how to establish the connection to server B and get that file.
I am trying to write a stored procedure for this.
No I should not copy that file.

So any suggestions how to get that file from server B to DB server A.

Thanks,
SOLUTION
Avatar of Matthew Borrusso
Matthew Borrusso
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Again, I just want to say, I know its not clean.. but it should work given limited options.
Avatar of shragi

ASKER

does this command removes the file from original server B
you can add a delete command to be run later. say 10am, or just set the commands to constantly overwrite the file names.
your call..

it just depends on how you want to do this.
ASKER CERTIFIED SOLUTION
Avatar of John_Vidmar
John_Vidmar
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
If the idea it's to import data from a file to a table SSMS already provide this functionality.
Just right-click over the database name, choose Tasks / Import data... and follow the wizard.