February 2, 2012 at 12:13 pm
I have more than 200 Sp's files on my folder. I would like to import onto my DB. I tried using BIDS. But it didn't worked out. Do we need to manually run the script for every file? or do we have any procedure to run all the .sql files. Please, let me know thank you.
February 2, 2012 at 12:27 pm
Please look at this msdn example.
http://msdn.microsoft.com/en-us/library/ms170572.aspx
Try adding some kind of looping to that..
Blog -- LearnSQLWithBru
Join on Facebook Page Facebook.comLearnSQLWithBru
Twitter -- BruMedishetty
February 2, 2012 at 12:58 pm
You could also create a job with a powershell step to access the files. I used this the other day for importing a bunch of create object scripts
$folder = "c:\scriptfolder\";$scripts = @(); get-childitem $folder | ?{$_.Extension -eq ".sql"} | %{ if($_) {$scripts += $_.name}}; foreach ($script in $scripts) {invoke-sqlcmd -inputfile "$folder$script" -serverinstance "YourServer" -database "MyDatabase"}
February 2, 2012 at 3:05 pm
got it. Thank you
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply