SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Cannot open file because the current provider (SqlServer) cannot open a file.


Cannot open file because the current provider (SqlServer) cannot open a file.

Author
Message
hayden_jones
hayden_jones
SSC-Addicted
SSC-Addicted (419 reputation)SSC-Addicted (419 reputation)SSC-Addicted (419 reputation)SSC-Addicted (419 reputation)SSC-Addicted (419 reputation)SSC-Addicted (419 reputation)SSC-Addicted (419 reputation)SSC-Addicted (419 reputation)

Group: General Forum Members
Points: 419 Visits: 257
Server has SQL 2012
Opened powershell
sqlps
got PS SQLSERVER:\> prompt
PS SQLSERVER:\> echo "xxxx" > tempps.txt

This works fine in normal powershell. In sqlps I get error:
Cannot open file because the current provider (SqlServer) cannot open a file.

Well, I must have left out a step. Can somebody tell me how to get sqlps permission to open a file?
bruce 1565
bruce 1565
Mr or Mrs. 500
Mr or Mrs. 500 (513 reputation)Mr or Mrs. 500 (513 reputation)Mr or Mrs. 500 (513 reputation)Mr or Mrs. 500 (513 reputation)Mr or Mrs. 500 (513 reputation)Mr or Mrs. 500 (513 reputation)Mr or Mrs. 500 (513 reputation)Mr or Mrs. 500 (513 reputation)

Group: General Forum Members
Points: 513 Visits: 1028
Add a path for the file. For example
echo 'xxxx' > C:\temp\tempps.txt

hayden_jones
hayden_jones
SSC-Addicted
SSC-Addicted (419 reputation)SSC-Addicted (419 reputation)SSC-Addicted (419 reputation)SSC-Addicted (419 reputation)SSC-Addicted (419 reputation)SSC-Addicted (419 reputation)SSC-Addicted (419 reputation)SSC-Addicted (419 reputation)

Group: General Forum Members
Points: 419 Visits: 257
The full path works, though I am wondering why the command works in normal powershell without the path
and sqlps needs the path. I would ask why the error message lies and says sqlps doesn't have permission to open a file
but I figure, hey, this is Microsoft.

I don't quite follow the > syntax. What is that intended to do? I find that
echo 'xxxx' > C:\temp\tempps.txt errors out and that
echo 'xxxx' > C:\temp\tempps.txt does work.
hayden_jones
hayden_jones
SSC-Addicted
SSC-Addicted (419 reputation)SSC-Addicted (419 reputation)SSC-Addicted (419 reputation)SSC-Addicted (419 reputation)SSC-Addicted (419 reputation)SSC-Addicted (419 reputation)SSC-Addicted (419 reputation)SSC-Addicted (419 reputation)

Group: General Forum Members
Points: 419 Visits: 257
I just noticed that the Ampersand gt in my last post translated as ">" so I guess that the forum kind of messed with the command you suggested.
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search