|
Good day all SQL professionals, I have a business need to export all data from tables that have a certain prefix. Im fairly new to powershell and am struggling to get this to work. I think the variable passed to the sql query is actually System.data.datarow instead of what that row contains. Plz help:
(comments are locked)
|
|
How about a little adjustment like this: Awesome stuff grant, slight amendment though otherwise the script writes over the same file repeatedly;
should be
but im sure thats what you meant.
Apr 28 '11 at 05:09 AM
chillw1nston
post seems to have removed the backslashes but you get the idea!
Apr 28 '11 at 05:10 AM
chillw1nston
Yeah, just noticed that myself. I'll edit so that it's clear.
Apr 28 '11 at 05:15 AM
Grant Fritchey ♦♦
@chillw1nston Backslash is used as an escape character, so if you want the post to have your backslashes preserved then escape one backslash with another, much like you would have to do in C# or Java. Input: c:\\temp will then produce c:\
Apr 28 '11 at 06:08 AM
Oleg
Alternatively, wrap text that you want to identify as "code" in ` characters
Feb 05 at 05:26 PM
ThomasRushton ♦
(comments are locked)
|
|
Although Grant's answer does the job (+1), there is more than one way to skin a cat: Take a look at Getting Data out of SQL Server from Powershell to see a few examples.
(comments are locked)
|
|
worked for me, I just had to add the brackets on line 6 [$TableName]
(comments are locked)
|


should probably have mentioned that I have been running this as a .ps1 script file from sqlps