Friday, September 19, 2014

0 SQLPS

In SQL 2012, SQL Server powershell has been implement as module or individuals executable rather than a snapin.

There are 2 ways to run it.  Import-module or just execute sqlps.exe

Import-Module “sqlps” 

  image

SQLPS.exe

image

Interestingly, it is 32-bit only module. 

image

When we load the sqlps module, it also include the cmdlet for SSAS.

image

Another way to run it is from SSMS.

image

Encode-SqlName

If SQL database object has special character that can not be escape by powershell , we have to use this function to cover to the name that sql server can recognize .

For example, the table test t2:

image

We will get error when try to cd to it and needs to use

cd ('dbo.' + ( Encode-SqlName 'test t2:'))

image

Convert-UrnToPath

This is to covert the database object SMO urn path to the powershell path.

image

0 comments:

Post a Comment

 

SQL Panda Copyright © 2011 - |- Template created by O Pregador - |- Powered by Blogger Templates