quicksqlserver

Web Hosting

Techtracker

Job Search

Quick sql server

Powered by TypePad

« SQL Server restore problem - Error 3154: The backup set holds a backup of a database other than the existing database | Main | Powershell and Batch files »

January 05, 2009

TrackBack

TrackBack URL for this entry:
http://www.typepad.com/services/trackback/6a00d834539b6d69e2010536aa58e2970b

Listed below are links to weblogs that reference Powershell : SQLCMD and invoke-expression:

Comments

How would you execute SQLCMD \Lc so that its results would be used instead of the text list? I tried various versions of get-process, get-command, and get-content with no success.

Thanks

Nevermind:
foreach ($svr in (sqlcmd /Lc))
{
invoke-expression "SQLCMD -E -S $svr -i c:\test.sql"
}

I find the method SQLCMD \Lc not reliable , and in often fails.I've seen it fail for a bunch of different reasons. Which is why I rely on the prepared list

Verify your Comment

Previewing your Comment

This is only a preview. Your comment has not yet been posted.

Working...
Your comment could not be posted. Error type:
Your comment has been posted. Post another comment

The letters and numbers you entered did not match the image. Please try again.

As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.

Having trouble reading this image? View an alternate.

Working...

Post a comment

Author: Jack Vamvas is a full time SQL Server DBA Developer based in the UK. He specialises in Tuning,Optimisation,T-SQL Programming,SSIS ,Database design and is also involved in a fullrange of SQL Server tasks. Currently, he is working on ITjobfeed , which gathers the latest IT vacancies and makes them available to job seekers.