I have a csv file that has been exported from a sql database. The file has 2 columns with 100 records: FunctionName and DateCreated
So I want to see each and every object that is referenced by every function in the database.
Here is my code I have written so far:
$Query= "SELECT space(iteration * 4) + TheFullEntityName + ' (' + rtrim(TheType) + ')', *
FROM dbo.fn_DependantObjects('$FunctionName', 1, 0)
ORDER BY ThePath"
please note: dbo.fn_DependantObjects, is a function I have already created.
$fileName = 'c:\CurrentDate.csv'
foreach ($pattern in (Import-Csv $filename | % {$_.FunctionName})) {
Invoke-Sqlcmd -ServerInstance "ServerName" -Database "DatabaseName" -Query $Query
I am still new to powershell and would really appreciate if anyone can help me in any other way. I am stuck and this project is behind schedule.
Let me know.
Thanks Immortal