Routing Functionality in MS SQL SERVER 2012

I am using postgreSQL for one of my project which use pgrouting functionality to access routing,
but i like to port the data base to MS SQL SERVER 2012,Data got ported successfully but still am facing a problem is Routing
is there any way to use ROUTING in MS SQL Server 2012?

@Tracy Cai
i Gone through the book Pro Spacial and i found A* algorithm for routing which is given below but it producing so many errors,really am new to SQL Server, how i need to run the below code
[Microsoft.SqlServer.Server.SqlProcedure]
public static void GeographyAStar(SqlInt32 StartID, SqlInt32 GoalID)
* INITIALISATION
// The "Open List" contains the nodes that have yet to be assessed
List<AStarNode> OpenList = new List<AStarNode>();
// The "Closed List" contains the nodes that have already been assessed
// Implemented as a Dictionary<> to enable quick lookup of nodes
Dictionary<int, AStarNode> ClosedList = new Dictionary<int, AStarNode>();
using (SqlConnection conn = new SqlConnection("context connection=true;"))
conn.Open();
// Retrieve the location of the StartID
using (SqlCommand cmdGetStartNode = new SqlCommand("SELECT geog4326 FROM Nodes WHERE
NodeID = @id", conn))
SqlParameter param = new SqlParameter("@id", SqlDbType.Int);
param.Value = StartID;
cmdGetStartNode.Parameters.Add(param);
object startNode = cmdGetStartNode.ExecuteScalar();
if (startNode != null)
startGeom = (SqlGeography)(startNode);
else
throw new Exception("Couldn't find start node with ID " + StartID.ToString());
// Retrieve the location of the GoalID;
using (SqlCommand cmdGetEndNode = new SqlCommand("SELECT geog4326 FROM Nodes WHERE
NodeID = @id", conn))
SqlParameter endparam = new SqlParameter("@id", SqlDbType.Int);
endparam.Value = GoalID;
cmdGetEndNode.Parameters.Add(endparam);
object endNode = cmdGetEndNode.ExecuteScalar();
if (endNode != null)
endGeom = (SqlGeography)(endNode);
else
throw new Exception("Couldn't find end node with ID " + GoalID.ToString());
conn.Close();
// To start with, the only point we know about is the start node
AStarNode StartNode = new AStarNode(
(int)StartID, // ID of this node
-1, // Start node has no parent
0, // g - the distance travelled so far to get to this node
(double)startGeom.STDistance(endGeom) // h - estimated remaining distance to the goal
// Add the start node to the open list
OpenList.Add(StartNode);
* TRAVERSAL THROUGH THE NETWORK
// So long as there are open nodes to assess
while (OpenList.Count > 0)
// Sort the list of open nodes by ascending f score
OpenList.Sort(delegate(AStarNode p1, AStarNode p2)
{ return p1.f.CompareTo(p2.f); });
// Consider the open node with lowest f score
AStarNode NodeCurrent = OpenList[0];
* GOAL FOUND
if (NodeCurrent.NodeID == GoalID)
// Reconstruct the route to get here
List<SqlGeography> route = new List<SqlGeography>();
int parentID = NodeCurrent.ParentID;
// Keep looking back through nodes until we get to the start (parent -1)
while (parentID != -1)
conn.Open();
using (SqlCommand cmdSelectEdge = new SqlCommand("GetEdgeBetweenNodes", conn))
// Retrieve the edge from this node to its parent
cmdSelectEdge.CommandType = CommandType.StoredProcedure;
SqlParameter fromOSODRparam = new SqlParameter("@NodeID1", SqlDbType.Int);
SqlParameter toOSODRparam = new SqlParameter("@NodeID2", SqlDbType.Int);
fromOSODRparam.Value = NodeCurrent.ParentID;
toOSODRparam.Value = NodeCurrent.NodeID;
cmdSelectEdge.Parameters.Add(fromOSODRparam);
cmdSelectEdge.Parameters.Add(toOSODRparam);
object edge = cmdSelectEdge.ExecuteScalar();
SqlGeography edgeGeom;
if (edge != null)
edgeGeom = (SqlGeography)(edge);
route.Add(edgeGeom);
conn.Close();
NodeCurrent = ClosedList[parentID];
parentID = NodeCurrent.ParentID;
// Send the results back to the client
SqlMetaData ResultMetaData = new SqlMetaData(
"Route", SqlDbType.Udt, typeof(SqlGeography)
SqlDataRecord Record = new SqlDataRecord(ResultMetaData);
SqlContext.Pipe.SendResultsStart(Record);
// Loop through route segments in reverse order
for (int k = route.Count - 1; k >= 0; k--)
Record.SetValue(0, route[k]);
SqlContext.Pipe.SendResultsRow(Record);
SqlContext.Pipe.SendResultsEnd();
return;
} // End if (NodeCurrent.NodeID == GoalID)
* GOAL NOT YET FOUND - IDENTIFY ALL NODES ACCESSIBLE FROM CURRENT NODE
List<AStarNode> Successors = new List<AStarNode>();
conn.Open();
using (SqlCommand cmdSelectSuccessors = new SqlCommand("GetNodesAccessibleFromNode",
conn))
// Identify all nodes accessible from the current node
cmdSelectSuccessors.CommandType = CommandType.StoredProcedure;
SqlParameter CurrentNodeOSODRparam = new SqlParameter("@NodeID", SqlDbType.Int);
CurrentNodeOSODRparam.Value = NodeCurrent.NodeID;
cmdSelectSuccessors.Parameters.Add(CurrentNodeOSODRparam);
using (SqlDataReader dr = cmdSelectSuccessors.ExecuteReader())
while (dr.Read())
// Create a node for this potential successor
AStarNode SuccessorNode = new AStarNode(
dr.GetInt32(0), // NodeID
NodeCurrent.NodeID, // Successor node is a child of the current node
NodeCurrent.g + dr.GetDouble(1), // Distance from current node to successor
(double)(((SqlGeography)dr.GetValue(2)).STDistance(endGeom))
// Add the end of the list of successors
Successors.Add(SuccessorNode);
conn.Close();
* Examine list of possible nodes to go next
foreach (AStarNode NodeSuccessor in Successors)
// Keep track of whether we have already found this node
bool found = false;
// If this node is already on the closed list, don't examine further
if (ClosedList.ContainsKey(NodeSuccessor.NodeID))
found = true;
// If we didn't find the node on the closed list, look for it on the open list
if (!found)
for (int j = 0; j < OpenList.Count; j++)
if (OpenList[j].NodeID == NodeSuccessor.NodeID)
found = true;
// If this is a cheaper way to get there
if (OpenList[j].h > NodeSuccessor.h)
// Update the route on the open list
OpenList[j] = NodeSuccessor;
break;
// If not on either list, add to the open list
if (!found)
OpenList.Add(NodeSuccessor);
// Once all successors have been examined, weve finished with the current node
// so move it to the closed list
OpenList.Remove(NodeCurrent);
ClosedList.Add(NodeCurrent.NodeID, NodeCurrent);
} // end while (OpenList.Count > 0)
SqlContext.Pipe.Send("No route could be found!");
return;

Similar Messages

  • SQL Server 2012 Always ON routing to particular server based on User Name

    I have configured SQL Server 2012 with AlwaysON availability groups. I could route my connections to Secondary node when I put the applicationintent = readonly on the connection string. However I would like to route all of my connections from particular
    user name to my read only node. How can I accomplish this without changing connection string (Reason is I would like to be able to route connections for read only query to some older application client that doesn't support applicationintent parameter).

    Hello,
    There is nothing built in that will allow you to dynamically re-route connections based on usernames. This may be achieved outside of SQL Server through some sort of network appliance, but I can't say for sure.
    Would it be possible to upgrade the SQL Client (to 2012+) for the old application and then change the connection string?
    Sean Gallardy | Blog |
    Twitter

  • Unable to install SQL server 2012 on windows 7 64bit

    Overall summary:
    Final result: Failed: see details below
    Exit code (Decimal): -2057043966
    Exit facility code: 1380
    Exit error code: 2
    Exit message: There was a failure to calculate the applicability of setting ALLINSTANCES.
    Start time: 2015-03-17 21:43:13
    End time: 2015-03-17 21:43:34
    Requested action: LandingPage
    Exception help link: http://go.microsoft.com/fwlink?LinkId=20476&ProdName=Microsoft+SQL+Server&EvtSrc=setup.rll&EvtID=50000&ProdVer=11.0.2100.60&EvtType=0x4F2D2386%400xE9BC3D64&EvtType=0x4F2D2386%400xE9BC3D64
    Machine Properties:
    Machine name: ELKR-1214-1745
    Machine processor count: 4
    OS version: Windows 7
    OS service pack: Service Pack 1
    OS region: United States
    OS language: English (United States)
    OS architecture: x64
    Process architecture: 64 Bit
    OS clustered: No
    Package properties:
    Description: Microsoft SQL Server 2012
    ProductName: SQL Server 2012
    Type: RTM
    Version: 11
    SPLevel: 0
    Installation location: c:\afaeb7739e47ceedb4b5f79a1e14a784\x64\setup\
    Installation edition:
    User Input Settings:
    ACTION: LandingPage
    CONFIGURATIONFILE:
    ENU: true
    HELP: false
    INDICATEPROGRESS: false
    QUIET: false
    QUIETSIMPLE: false
    UIMODE: AutoAdvance
    X86: false
    Configuration file: C:\Program Files\Microsoft SQL Server\110\Setup Bootstrap\Log\20150317_214254\ConfigurationFile.ini
    Rules with failures:
    Global rules:
    There are no scenario-specific rules.
    Rules report file: The rule result report file is not available.
    Exception summary:
    The following is an exception stack listing the exceptions in outermost to innermost order
    Inner exceptions are being indented
    Exception type: Microsoft.SqlServer.Chainer.Infrastructure.CalculateSettingApplicabilityException
    Message:
    There was a failure to calculate the applicability of setting ALLINSTANCES.
    HResult : 0x85640002
    FacilityCode : 1380 (564)
    ErrorCode : 2 (0002)
    Data:
    SettingId = ALLINSTANCES
    WatsonData = Microsoft.SqlServer.Chainer.Infrastructure.CalculateSettingApplicabilityException@2
    HelpLink.EvtType = 0x4F2D2386@0xE9BC3D64
    DisableWatson = true
    Stack:
    at Microsoft.SqlServer.Chainer.Infrastructure.Setting.CalculateApplicability()
    at Microsoft.SqlServer.Chainer.Infrastructure.InputSettingService.CalculateAllSettings(Boolean chainerSettingOnly)
    at Microsoft.SqlServer.Configuration.SetupExtension.FinalCalculateSettingsAction.ExecuteAction(String actionId)
    at Microsoft.SqlServer.Chainer.Infrastructure.Action.Execute(String actionId, TextWriter errorStream)
    at Microsoft.SqlServer.Setup.Chainer.Workflow.ActionInvocation.ExecuteActionHelper(TextWriter statusStream, ISequencedAction actionToRun, ServiceContainer context)
    Inner exception type: Microsoft.SqlServer.Chainer.Infrastructure.CalculateSettingChangeabilityException
    Message:
    There was a failure to calculate the changeability of setting ALLINSTANCES.
    HResult : 0x85640003
    FacilityCode : 1380 (564)
    ErrorCode : 3 (0003)
    Data:
    SettingId = ALLINSTANCES
    WatsonData = Microsoft.SqlServer.Chainer.Infrastructure.CalculateSettingChangeabilityException@3
    Stack:
    at Microsoft.SqlServer.Chainer.Infrastructure.Setting.CalculateChangeabilityByUser()
    at Microsoft.SqlServer.Deployment.PrioritizedPublishing.PublishingQueue.CallQueuedSubscriberDelegates()
    at Microsoft.SqlServer.Deployment.PrioritizedPublishing.PublishingQueue.Publish(Publisher publisher)
    at Microsoft.SqlServer.Chainer.Infrastructure.Setting.CalculateApplicability()
    Inner exception type: Microsoft.SqlServer.Chainer.Infrastructure.UnableRetrieveConfigObjectForSettingException
    Message:
    Unable to retrieve a public configuration object type Microsoft.SqlServer.Configuration.SetupExtension.SlpInputSettings for setting ALLINSTANCES.
    HResult : 0x85640007
    FacilityCode : 1380 (564)
    ErrorCode : 7 (0007)
    Data:
    SettingId = ALLINSTANCES
    ConfigObjectType = Microsoft.SqlServer.Configuration.SetupExtension.SlpInputSettings
    WatsonData = Microsoft.SqlServer.Chainer.Infrastructure.UnableRetrieveConfigObjectForSettingException@7
    Stack:
    at Microsoft.SqlServer.Chainer.Infrastructure.SettingBridge.GetHostingObject()
    at Microsoft.SqlServer.Chainer.Infrastructure.SettingBridge.ChangeabilityByUser()
    at Microsoft.SqlServer.Deployment.PrioritizedPublishing.PublishingQueue.CallFunctionWhileAutosubscribing[T](SubscriberDelegate subscriberDelegate, Int32 priority, AutosubscribingFunctionDelegate`1 function)
    at Microsoft.SqlServer.Chainer.Infrastructure.Setting.CalculateChangeabilityByUser()
    Inner exception type: Microsoft.SqlServer.Chainer.Infrastructure.ChainerInfrastructureException
    Message:
    Unable to generate a temporary class (result=1).
    error CS0009: Metadata file 'c:\Windows\assembly\GAC_MSIL\System\2.0.0.0__b77a5c561934e089\System.dll' could not be opened -- 'File is corrupt'
    HResult : 0x84b10001
    FacilityCode : 1201 (4b1)
    ErrorCode : 1 (0001)
    Stack:
    at Microsoft.SqlServer.Chainer.Infrastructure.DataStoreService.DeserializeObject(String rootPath, Type type, String elementXPath)
    at Microsoft.SqlServer.Chainer.Infrastructure.DataStoreService.DeserializeObject(String rootPath, Type type)
    at Microsoft.SqlServer.Chainer.Infrastructure.SettingBridge.GetHostingObject()
    Inner exception type: System.InvalidOperationException
    Message:
    Unable to generate a temporary class (result=1).
    error CS0009: Metadata file 'c:\Windows\assembly\GAC_MSIL\System\2.0.0.0__b77a5c561934e089\System.dll' could not be opened -- 'File is corrupt'
    Stack:
    at System.Xml.Serialization.Compiler.Compile(Assembly parent, String ns, XmlSerializerCompilerParameters xmlParameters, Evidence evidence)
    at System.Xml.Serialization.TempAssembly.GenerateAssembly(XmlMapping[] xmlMappings, Type[] types, String defaultNamespace, Evidence evidence, XmlSerializerCompilerParameters parameters, Assembly assembly, Hashtable assemblies)
    at System.Xml.Serialization.TempAssembly..ctor(XmlMapping[] xmlMappings, Type[] types, String defaultNamespace, String location, Evidence evidence)
    at System.Xml.Serialization.XmlSerializer.GenerateTempAssembly(XmlMapping xmlMapping, Type type, String defaultNamespace)
    at System.Xml.Serialization.XmlSerializer..ctor(Type type, String defaultNamespace)
    at Microsoft.SqlServer.Chainer.Infrastructure.DataStoreService.DeserializeObject(String rootPath, Type type, String elementXPath)

    Hi,
    I would like to add that if you see summary.txt file you would see
    Message:
    Unable to generate a temporary class (result=1).
    error CS0009: Metadata file 'c:\Windows\assembly\GAC_MSIL\System\2.0.0.0__b77a5c561934e089\System.dll' could not be opened -- 'File is corrupt'
    HResult : 0x84b10001
    FacilityCode : 1201 (4b1)
    ErrorCode : 1 (0001)
    You can see file is corrupt. So either you have to download the setup file again or there can be chance that Antivirus caused some issue.
    Plus if you see starting of summary.txt you could see
    Requested action: LandingPage
    The error message came while landing page was being loaded/or was in action so again I think it is some thing related to corrupt media or antivirus.
    Please
    1. Download ISO file again and extract using WINRAR, don't use Winzip
    2. Disable Antivirus.
    3. Make a new folder and extract installable there.
    Please mark this reply as answer if it solved your issue or vote as helpful if it helped so that other forum members can benefit from it
    My Technet Wiki Article
    MVP

  • Unable to install SQL Server 2012 Standard: Error code 0x851A0019

    Hi All,
    I am trying to install sql server 2012 standard edition on windows server 2008R2 but at the end of the installation it is giving me the following error message: 
    "The following error has occurred:
    Wait on the Database Engine recovery handle failed. Check the SQL Server error log for potential causes."
    And in the log file I got the following error message:
    Feature:                       Database Engine Services
      Status:                        Failed: see logs for details
      Reason for failure:            An error occurred during the setup process of the feature.
      Next Step:                     Use the following information to resolve the error, uninstall this feature, and then run the setup process again.
      Component name:                SQL Server Database Engine Services Instance Features
      Component error code:          0x851A0019
      Error description:             Wait on the Database Engine recovery handle failed. Check the SQL Server error log for potential causes.
      Error help link:               http://go.microsoft.com/fwlink?LinkId=20476&ProdName=Microsoft+SQL+Server&EvtSrc=setup.rll&EvtID=50000&ProdVer=11.0.2100.60&EvtType=0xD15B4EB2%400x4BDAF9BA%401306%4025&EvtType=0xD15B4EB2%400x4BDAF9BA%401306%4025
    (I have posted part of the log file)
    Need your help to resolve this issue.
    Thanks,
    MKNayeem

    Hi,
    Thanks for your reply.
    I have already followed that article. I have changed the user to local account user, but it did not work.
    Like you said the sql server is installed, but it is not starting the services. Following is the error log file message:
    2015-03-16 10:12:15.27 Server      Microsoft SQL Server 2012 - 11.0.2100.60 (X64) 
    Feb 10 2012 19:39:15 
    Copyright (c) Microsoft Corporation
    Standard Edition (64-bit) on Windows NT 6.1 <X64> (Build 7601: Service Pack 1) (Hypervisor)
    2015-03-16 10:12:15.27 Server      (c) Microsoft Corporation.
    2015-03-16 10:12:15.27 Server      All rights reserved.
    2015-03-16 10:12:15.29 Server      Server process ID is 5724.
    2015-03-16 10:12:15.29 Server      System Manufacturer: 'VMware, Inc.', System Model: 'VMware Virtual Platform'.
    2015-03-16 10:12:15.29 Server      Authentication mode is MIXED.
    2015-03-16 10:12:15.29 Server      Logging SQL Server messages in file 'C:\Program Files\Microsoft SQL Server\MSSQL11.BNG1SECISO\MSSQL\Log\ERRORLOG'.
    2015-03-16 10:12:15.29 Server      The service account is 'NT Service\MSSQL$BNG1SECISO'. This is an informational message; no user action is required.
    2015-03-16 10:12:15.29 Server      Registry startup parameters: 
    -d C:\Program Files\Microsoft SQL Server\MSSQL11.BNG1SECISO\MSSQL\DATA\master.mdf
    -e C:\Program Files\Microsoft SQL Server\MSSQL11.BNG1SECISO\MSSQL\Log\ERRORLOG
    -l C:\Program Files\Microsoft SQL Server\MSSQL11.BNG1SECISO\MSSQL\DATA\mastlog.ldf
    2015-03-16 10:12:15.29 Server      Command Line Startup Parameters:
    -s "BNG1SECISO"
    2015-03-16 10:12:15.57 Server      SQL Server detected 2 sockets with 1 cores per socket and 1 logical processors per socket, 2 total logical processors; using 2 logical processors based on SQL Server licensing. This is an informational message;
    no user action is required.
    2015-03-16 10:12:15.57 Server      SQL Server is starting at normal priority base (=7). This is an informational message only. No user action is required.
    2015-03-16 10:12:15.57 Server      Detected 16383 MB of RAM. This is an informational message; no user action is required.
    2015-03-16 10:12:15.57 Server      Using conventional memory in the memory manager.
    2015-03-16 10:12:15.67 Server      This instance of SQL Server last reported using a process ID of 2452 at 16-03-2015 07:03:13 (local) 16-03-2015 01:33:13 (UTC). This is an informational message only; no user action is required.
    2015-03-16 10:12:15.67 Server      Node configuration: node 0: CPU mask: 0x0000000000000003:0 Active CPU mask: 0x0000000000000003:0. This message provides a description of the NUMA configuration for this computer. This is an informational
    message only. No user action is required.
    2015-03-16 10:12:15.69 Server      Using dynamic lock allocation.  Initial allocation of 2500 Lock blocks and 5000 Lock Owner blocks per node.  This is an informational message only.  No user action is required.
    2015-03-16 10:12:15.69 Server      Software Usage Metrics is disabled.
    2015-03-16 10:12:15.70 spid6s      Starting up database 'master'.
    2015-03-16 10:12:15.78 Server      CLR version v4.0.30319 loaded.
    2015-03-16 10:12:15.82 Server      Common language runtime (CLR) functionality initialized using CLR version v4.0.30319 from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\.
    2015-03-16 10:12:17.36 spid6s      Error: 824, Severity: 24, State: 2.
    2015-03-16 10:12:17.36 spid6s      SQL Server detected a logical consistency-based I/O error: incorrect pageid (expected 1:377; actual 261:2228225). It occurred during a read of page (1:377) in database ID 1 at offset 0x000000002f2000 in
    file 'C:\Program Files\Microsoft SQL Server\MSSQL11.BNG1SECISO\MSSQL\DATA\master.mdf'.  Additional messages in the SQL Server error log or system event log may provide more detail. This is a severe error condition that threatens database integrity and
    must be corrected immediately. Complete a full database consistency check (DBCC CHECKDB). This error can be caused by many factors; for more information, see SQL Server Books Online.
    Thanks
    MKNayeem

  • Need to convert DTS packages to SQL Server 2012 environment.

    Hi Friends,
    As Part of the Project Requirement,we need to convert DTS packages to SQL Server 2012 environment.
    Please sugest me best approach.
    Thanks

    Best approach is to re-design the packages in SSIS 2012 directy if it is feasible. Because most of the DTS feaures are discontinued and also you will have to clean up all errors that you are going to get after migration.
    Discontinued Integration Services Functionality in SQL Server 2012
    Otherwise you need to migrate it first to 2008R2 and then 2012 version.
    Below ones would be helpful for you:
    Migrate DTS packages to SSIS (SSIS2008R2)
    Support of DTS packages in 2008 R2
    Known DTS Package Migration Issues
    Cheers,
    Vaibhav Chaudhari

  • Error rsItemNotFound when using ReportingService2010 endpoint in SharePoint Mode (SQL Server 2012 & SP2013)

    Hi all,
    I installed SQL Server 2012 in SharePoint Mode, with SharePoint 2013 on a Windows Server 2012 virtual machine. The issue occurs when I try to use the ListChildren operation of the ReportService2010 endpoint.
    It manages to connect to the server, but it refuses to list any children. Here's the code I'm using:
    using System;
    using System.Net;
    internal class Test
    public static void Main()
    var rs = new ReportingService2010
    Credentials = new NetworkCredential("username", "password", "machine")
    CatalogItem[] items = null;
    // Retrieve a list of all items from the report server database.
    try
    items = rs.ListChildren("/", true);
    catch (Exception e)
    Console.WriteLine(e.Message);
    When executed, this code throws an exception (which is caught and displayed) : "The item '/' cannot be found. (rsItemNotFound)"
    The same code works (i.e. does not throw any exception and the items variable contains some CatalogItem) when used against a SQL Server 2012 configured in native mode.
    I'm not sure what I'm doing wrong here, maybe the first parameter shouldn't be "/" but something else?
    Thanks for your help
    Aotio

    +1
    I'm getting this error as well.  My test software is connecting to two different servers; one is running on SharePoint 2010 and I have no problems using the ReportingService2010 functions on that, but I am getting this same error when trying to connect
    to a service on SharePoint 2013.

  • Error while install sql server 2012 using powershell

    hello all,
    I am using below function to install sql server and its not working  can some one help me please 
    Function Install-Sql2012
    param
    [Parameter()][string]  $Path ,#= (read-host "Enter Installation Binary Path"),
            [Parameter()][string]  $AddSSIS= (read-host "Do u need SSIS Enter 1 for yes o for no") ,
            [Parameter()][string]  $AddSSRS= (read-host "Do u need SSRS Enter 1 for yes o for no") ,
    [Parameter()][string]  $InstanceName = (read-host "Enter Instance name"),
    [Parameter()][string]  $ServiceAccount= (read-host "Enter Service Account"),
    [Parameter()][string]  $ServicePassword= (read-host -assecurestring "Enter Service Account Password") ,
    [Parameter()][string]  $AgentAccount=(read-host "Enter Agent Account"),
    [Parameter()][string]  $AgentPassword=(read-host "Enter Agent pasword"),
            [Parameter()][string]  $Backuppath= (read-host "Enter Backuppath"),
    [Parameter()][string]  $SaPassword= (read-host -assecurestring "Enter SA Account Passowrd"),
            [Parameter()][string]  $SQLTEMPDBDIR= (read-host  "Enter TempDir"),
            [Parameter()][string]  $SQLUSERDBDIR= (read-host  "Enter User Data Directory"),
            [Parameter()][string]  $SQLUSERDBLOGDIR= (read-host  "Enter User Log Directory"),
    #[Parameter(Position=5,Mandatory=$false)][string] $LicenseKey,
    [Parameter()][string]  $SqlCollation = "SQL_Latin1_General_CP1_CI_AS",
    [Parameter()][switch]  $NoTcp,
    [Parameter()][switch]  $NoNamedPipes
    #Build the setup command using the install mode
    if ($Path -eq $null -or $Path -eq "")
    #No path means that the setup is in the same folder
    $command = '.\setup.exe /Action="Install"'
    else
    #Ensure that the path ends with a backslash
    if(!$Path.EndsWith("\"))
    $Path += "\"
    $command = $path + 'setup.exe /Action="Install"'
    #Accept the license agreement - required for command line installs
    $command += ' /IACCEPTSQLSERVERLICENSETERMS'
    #Use the QuietSimple mode (progress bar, but not interactive)
    $command += ' /QS'
    #Set the features to be installed
    #$command += ' /FEATURES=SQLENGINE,CONN,BC,SSMS,ADV_SSMS'
        If ($AddSSIS -ne '0' -and $AddSSIS -ne '1') {
            throw 'Invalid input. Enter a valid value for SSIS.'
        If ($AddSSRS -ne '0' -and $AddSSRS -ne '1') {
            throw 'Invalid input. Enter a valid value for SSRS.'
       if ($AddSSIS -eq 1 -and $AddSSRS -eq 1)
           $command += ' /FEATURES=SQLENGINE,CONN,BC,SSMS,ADV_SSMS,SSIS,SSRS'
       if ($AddSSIS -eq 1 -and $AddSSRS -eq 0)
       $command += ' /FEATURES=SQLENGINE,CONN,BC,SSMS,ADV_SSMS,SSIS'
       if ($AddSSIS -eq 0 -and $AddSSRS -eq 1)
       $command += ' /FEATURES=SQLENGINE,CONN,BC,SSMS,ADV_SSMS,SSRS'
       if  ($AddSSIS -eq 0 -and $AddSSRS -eq 0)
       $command += ' /FEATURES=SQLENGINE,CONN,BC,SSMS,ADV_SSMS'
    #Set the Instance Name
    $command += (' /INSTANCENAME="{0}"' -f $InstanceName)
    #remove Set the License Key only if a value was provided, otherwise install Evaluation edition
    #if ($LicenseKey -ne $null -and $LicenseKey -ne "")
    # $command += (' /PID="{0}"' -f $LicenseKey)
        #set reporting to off
        $command += ('/SQMREPORTING="0"')
        #Add Browser Account 
        $command +=('/BROWSERSVCSTARTUPTYPE="Disabled"')
        #Add Backup path 
        $command +=('/SQLBACKUPDIR="{0}"' -f $backuppath)
    #Check to see if a service account was specified
    if ($ServiceAccount -ne $null -and $ServiceAccount -ne "")
    #Set the database engine service account
    $command += (' /SQLSVCACCOUNT="{0}" /SQLSVCPASSWORD="{1}" /SQLSVCSTARTUPTYPE="Automatic"' -f $ServiceAccount, $ServicePassword)
    #Set the SQL Agent service account
    $command += (' /AGTSVCACCOUNT="{0}" /AGTSVCPASSWORD="{1}" /AGTSVCSTARTUPTYPE="Automatic"' -f $AgentAccount, $AgentPassword)
    else
    #Set the database engine service account to Local System
    $command += ' /SQLSVCACCOUNT="NT AUTHORITY\SYSTEM" /SQLSVCSTARTUPTYPE="Automatic"'
    #Set the SQL Agent service account to Local System
    $command += ' /AGTSVCACCOUNT="NT AUTHORITY\SYSTEM" /AGTSVCSTARTUPTYPE="Automatic"'
    #Set the server in SQL authentication mode if an SA password was provided
    if ($SaPassword -ne $null -and $SaPassword -ne "")
    $command += (' /SECURITYMODE="SQL" /SAPWD="{0}"' -f $SaPassword)
    #Add current user as SysAdmin
    $command += (' /SQLSYSADMINACCOUNTS="test\ADMIN"')
        #Add Tempdbdata path
    $command += (' /SQLTEMPDBDIR="{0}"' -f $SQLTEMPDBDIR)
        #Add Tempdblog path
        $command += (' /SQLTEMPDBLOGDIR="{0}"' -f $SQLTEMPDBDIR)
         #Add UserDBdata path
        $command += (' /SQLUSERDBDIR="{0}"' -f $SQLUSERDBDIR)
         #Add UserDBlog path
        $command += (' /SQLUSERDBLOGDIR="{0}"' -f $SQLUSERDBLOGDIR)
    #Set the database collation
    $command += (' /SQLCOLLATION="{0}"' -f $SqlCollation)
    #Enable/Disable the TCP Protocol
    if ($NoTcp)
    $command += ' /TCPENABLED="0"'
    else
    $command += ' /TCPENABLED="1"'
    #Enable/Disable the Named Pipes Protocol
    if ($NoNamedPipes)
    $command += ' /NPENABLED="0"'
    else
    $command += ' /NPENABLED="1"'
    if ($PSBoundParameters['Debug']) 
    Write-Output $command
    else
    Invoke-Expression $command
    Install-Sql2012
    Below is the error i am getting 
    PS C:\temp\in> .\Install-Sql2012.ps1
    Do u need SSIS Enter 1 for yes o for no: 0
    Do u need SSRS Enter 1 for yes o for no: 0
    Enter Instance name: MSSQLSERVER
    Enter Service Account:
    Enter Service Account Password:
    Enter Agent Account:
    Enter Agent pasword:
    Enter Backuppath: "C:\Temp\IN\bck"
    Enter SA Account Passowrd: **********
    Enter TempDir: "C:\Temp\IN\bck"
    Enter User Data Directory: "C:\Temp\IN\bck"
    Enter User Log Directory: "C:\Temp\IN\bck"
    Microsoft (R) SQL Server 2012 11.00.2100.60
    Copyright (c) Microsoft Corporation.  All rights reserved.
    The following error occurred:
    Instance name is limited to 16 characters. Yours 'MSSQLSERVER/SQMREPORTING=0/BROWSERSVCSTARTUPTYPE=DISABLED/SQLBACKUPDIR=C:\TEMP\IN\BCK' is 85.
    Error result: -2054422513
    Result facility code: 1420
    Result error code: 15
    Please review the summary.txt log for further details
    Thanks,
    Ashwin.
        

    Line 94, 97 and 100 appear to not have spaces at the beginning of each string, which could cause some issues:
    #set reporting to off
    $command += ('/SQMREPORTING="0"')
    #Add Browser Account
    $command +=('/BROWSERSVCSTARTUPTYPE="Disabled"')
    #Add Backup path
    $command +=('/SQLBACKUPDIR="{0}"' -f $backuppath)
    Probably should be this:
    #set reporting to off
    $command += (' /SQMREPORTING="0"')
    #Add Browser Account
    $command +=(' /BROWSERSVCSTARTUPTYPE="Disabled"')
    #Add Backup path
    $command +=(' /SQLBACKUPDIR="{0}"' -f $backuppath)
    Boe Prox
    Blog |
    Twitter
    PoshWSUS |
    PoshPAIG | PoshChat |
    PoshEventUI
    PowerShell Deep Dives Book

  • Try to do my first XML Schema in SQL Server 2012 Mangement Studio(SSMS2012)-How to execute the xsd and xml files in SSMS2012?

    Hi all,
    I learmed the basic stuff of XML, DTD, DOM, etc. long time ago. Now, I came back to resume my XML journey and try to learn the XML Schemas, XPath and XQuery. I have Microsoft SQL Server 2012 Management Studio (SSMS2012) in our computer network. From
    Page 221 of the old Book "Beginning XML 2nd Edition" written by David Hunter, et.al., (published by Wrox), I copied the name5.xsd and name5.xml :
    <?xml version="1.0"?>
    <schema xmlns=http://www.w3.org/2001/XMLSchema"
    targetNamespace="http://www.wrox.com/name" xmlns:target="http://www.wrox.com/name"
    elementFormDefault="qualified">
    <element name="name">
    <complexType>
    <sequence>
    <element name="first" type="string"/>
    <element name="middle" type="string"/>
    <element name="last" type="string"/>
    </sequence>
    </complexType>
    </element>
    </schema>
    <?xml version="1.0"?>
    <name
    xmlns=http://www.wrox.com/name"
    xmlns:xsi="http://www.wrox.org/2001XMLSchema-instance"
    xsi:schemaLocation="http://www.wrox.com/name name5.xsd"
    title="Mr.">
    <first>John</first>
    <middle>Frizgerald</middle>
    <last>Doe</last>
    </name>
    How can I execute these two files in my SSMS2012 for doing my first XML Schema trial?
    Please kindly help, advise and respond.
    Thanks in advance,
    Scott Chang

    Hi Eric Zhang, Thanks for your nice response.
    1) I saw the CREATE XML SCHEMA COLLECTION (Transact-SQL) and tried  its first example "Create XML schema collection in the database" in my SQL Server 2012 Management Studio (SSMS2012):
    -- Create a sample database in which to load the XML schema collection.
    -- Copied this set of code stsments from Microsoft Library (ms176009)
    -- ColesMS12_20a.sql (saved in C:/Documents/SQL Server Management Studio)
    -- 19 March 2015 1145 AM
    CREATE DATABASE SampleDB
    GO
    USE SampleDB
    GO
    CREATE XML SCHEMA COLLECTION ManuInstructionsSchemaCollection AS
    N'<?xml version="1.0" encoding="UTF-16"?>
    <xsd:schema targetNamespace="http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/ProductModelManuInstructions"
    xmlns ="http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/ProductModelManuInstructions"
    elementFormDefault="qualified"
    attributeFormDefault="unqualified"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema" >
    <xsd:complexType name="StepType" mixed="true" >
    <xsd:choice minOccurs="0" maxOccurs="unbounded" >
    <xsd:element name="tool" type="xsd:string" />
    <xsd:element name="material" type="xsd:string" />
    <xsd:element name="blueprint" type="xsd:string" />
    <xsd:element name="specs" type="xsd:string" />
    <xsd:element name="diag" type="xsd:string" />
    </xsd:choice>
    </xsd:complexType>
    <xsd:element name="root">
    <xsd:complexType mixed="true">
    <xsd:sequence>
    <xsd:element name="Location" minOccurs="1" maxOccurs="unbounded">
    <xsd:complexType mixed="true">
    <xsd:sequence>
    <xsd:element name="step" type="StepType" minOccurs="1" maxOccurs="unbounded" />
    </xsd:sequence>
    <xsd:attribute name="LocationID" type="xsd:integer" use="required"/>
    <xsd:attribute name="SetupHours" type="xsd:decimal" use="optional"/>
    <xsd:attribute name="MachineHours" type="xsd:decimal" use="optional"/>
    <xsd:attribute name="LaborHours" type="xsd:decimal" use="optional"/>
    <xsd:attribute name="LotSize" type="xsd:decimal" use="optional"/>
    </xsd:complexType>
    </xsd:element>
    </xsd:sequence>
    </xsd:complexType>
    </xsd:element>
    </xsd:schema>' ;
    GO
    -- Verify - list of collections in the database.
    select *
    from sys.xml_schema_collections
    -- Verify - list of namespaces in the database.
    select name
    from sys.xml_schema_namespaces
    -- Use it. Create a typed xml variable. Note collection name specified.
    DECLARE @x xml (ManuInstructionsSchemaCollection)
    GO
    --Or create a typed xml column.
    CREATE TABLE T (
    i int primary key,
    x xml (ManuInstructionsSchemaCollection))
    GO
    -- ////The following code statements are not used in order to create SampleDB
    -- Clean up
    ---DROP TABLE T
    ---GO
    ---DROP XML SCHEMA COLLECTION ManuInstructionsSchemaCollection
    ---Go
    ---USE Master
    ---GO
    ---DROP DATABASE SampleDB
    It worked and I got the following results:
    1 4 NULL sys 2009-04-13 12:59:13.390 2012-02-10 20:16:02.097
    65536 1 NULL ManuInstructionsSchemaCollection 2015-03-19 11:47:17.660 2015-03-19 11:47:17.660
    http://www.w3.org/2001/XMLSchema
    http://schemas.microsoft.com/sqlserver/2004/sqltypes
    http://www.w3.org/XML/1998/namespace
    http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/ProductModelManuInstructions
    But, I don't undertand (i) what SCHEMA COECTION is, (ii) what <xsd:schema targetNamespace=.....</xsd:complexType> are, (iii) How I can specify my "project specific" schema in the Microsoft SCHEMA COLLECTION to check my xml file.
    2) I dived in the XQuery programmimng in SSMS2012 in the last few weeks. I used the examles of Ad-Hoc XML File Query by Seth Delconte (in
    httpS://www.simple-talk.com/content/print.aspx?article=1756) in my SSMS2012. They worked. But I don't understand the (i) Importing XML data using a function, (ii) Using the XQuery contans()
    function to find substrings, (iii)Efficiency comparisons in the article.
    Please kindly help me in enlightening me to resolve the difficulties listed in 1) and 2).
    Thanks,
    Scott Chang

  • Compatibility_level on SQL Server 2012 in-place upgrade

    Hi all,
    Based on BOL, master and user databases' compatibility_level will not be changed to 110 on SQL Server 2012 in-place upgrade.
    Database Compatibility Level After Upgrade
    The compatibility levels of the tempdb,
    model, msdb and
    Resource databases are set to 110 after upgrade. The
    master system database retains the compatibility level it had before upgrade.
    If the compatibility level of a user database was 90 or 100 before the upgrade, it remains the same after upgrade. If the compatibility level was 80 or less before upgrade, in the upgraded database, the compatibility level is set to 90, which is the
    lowest supported compatibility level in SQL Server 2012.
    I get the some result in our environment. So in-place upgrade SQL 2008 instance to SQL 2012 (both standalne and clustered), master/user databases' compatibility_level is 100. I also try to use SQL 2012 new function
    OFFSET and FETCH, it works.
    My concern is, whether we have to manually update the compatibility_level to 110? As SQL 2012 new features seem work even with compatibility_level <110, is there any problem if we leave it?
    (I didn't find any document about this, and related change metioned as a step for SQL 2012 in-place upgrade.)
    Any thoughts?
    MCSE:Data Platform

    So the idea is that if you have applications that are dependent on behaviour that changes, you can stay with the old compat level. I believe that there is some upgrade assistant to investigate whether this applies to you.
    On the top of my head, I don't recall any differences between compat levels 100 and 110, but there surely are some. But there are no new reserved keywords as I recall. And some things break even with the old compat level. (COMPUTE BY and the old RAISERROR
    syntax for instance.) So I don't think it is particularly brave to change the compatibility level. Change it back if something really breaks.
    The risk if you don't change it now, is that you have code developed on a dev server with compat level 110, which breaks when you deploy in production. And this happens one year from now, and no one recalls that this server has compat level 100, so it
    causes a lot of confusion and waste of time.
    Erland Sommarskog, SQL Server MVP, [email protected]

  • SQL Server 2012 PowerView & PoverPivot in combination with SharePoint 2013

    Hi,
    I have been reading articles on the internet about this, and I am little bit confused. I understand this is also changed since in SP2013. Could someone with experience clarify.
    1. It looks like Power View has become a part of Reporting Services and can not be installed without Reporting Services, is this correct? If this is true, then what is this
    http://www.microsoft.com/en-us/download/details.aspx?id=35577 If not, why do I see a lot of links referring to PowerView as a part of Reporting Services? for example
    http://www.codeproject.com/Articles/615462/Configure-Power-View-Reporting-Services-Features-o
    2. Do I need Analysis Services in order to use PowerView, is other words is Analysis Services a requirement?
    3. Where do I run the SQL Server 2012 Setup? I was assuming that I need to run it on SharePoint in order to add and register dll's on the SP servers, they are needed in order to create Service Applications (PowerView & PoverPivot). However in pictures
    on the
    http://www.codeproject.com/Articles/615462/Configure-Power-View-Reporting-Services-Features-o link I see they are adding features to SQL instance. So do we run it on SharePoint or SQL server? If we run it on SharePoint server, what to do with instance name?
    If on SQL server, how will SharePoint server get dll's in order to create Service Applications?
    4. Can SQL 2008 be used for PowerView & PoverPivot configuration databases? I mean a scenario when SharePoint has 2012 versions of PowerView & PoverPivot DLLs (i.e. PowerView & PoverPivot Service Applications created
    with SQL2012 version), but  configuration databases itself for these applications are in SQL 2008? I know that such a scenario was supported with SSRS on SP2010(you could simply run the SQL2012 setup on SP server and add SQL2012 SSRS, later when you configure
    SSRS in SharePoint mode SQL 2008 database could be used as a SSRS configuration database)...
    Thanks in advance!
    Tofig

    1. Part of the confusion comes from the fact that there are several versions of powerview: powerview for SharePoint and PowerView for Excel. But yes, for SharePoint integration it's part of SSRS. (If you're not talking about SharePoint, then you can create
    and use PowerView in Excel. No SSRS or SharePoint required. But, the link you provided is for PowerPivot for SharePoint. This provides additional functionality for folks that want to surface PowerPivot workbooks in SharePoint. (which is different than PowerView).
    (PowerPivot = tabular data mode in excel = the ability to create pivottables/charts with millions of rows of data in Excel with jaw dropping performance (sorry for the advertising speak, but in my experience, it's true).  PowerView = the ability to create
    dashboards / eye candy / other neat visualizations like maps for data that is stored in a tabular data model (PowerPivot or SSAS in tabular mode)).
    2. No. PowerView was originally designed to use "tabular data models" as their source of data. There are two ways to create a tabular data model: An SSAS instance in tabular mode, or an Excel Workbook with a powerPivot data model (PowerPivot is the excel
    version of the tabular data model). So, if you have a workbook that has data loaded in through PowerPivot, you can create a PowerView report in that workbook and surface it with excel services, with no SSAS needed.
    3. On a SharePoint box. The only way to install SSRS in SharePoint integrated mode is to install SSRS on a SharePoint WFE. (The databases they use will go on the SQL box, but the bits for SSRS go on the SharePoint box)
    4. According to the following doc, SharePoint 2013 only supports SSRS 2012 SP1 (which means only SQL 2012):
    http://msdn.microsoft.com/en-us/library/gg492257.aspx
    Mike G.

  • Change Tracking System in SQL Server 2012

    Hi,
    I have enabled change tracking to one of the database with retention period 1 day and auto clean is true. As per this setting changed data of one day old should get cleaned up automatically. But i am able to see 4 days
    old data also using CHANGETABLE function. Let me know is there any other setting or is this an issue in SQL server 2012 which quires some patch?
    SQL Server configuration: SQL Server 2012, Enterprise Edition, 64 bit.
    Thanks in advance for the support.
    Aruna Veluru

    please paste out:
    select * from sys.change_tracking_databases

  • SQL Server 2012 Express bulk Insert flat file 1million rows with "" as delimeter

    Hi,
    I wanted to see if anyone can help me out. I am on SQL server 2012 express. I cannot use OPENROWSET because my system is x64 and my Microsoft office suit is x32 (Microsoft.Jet.OLEDB.4.0).
    So I used Import wizard and is not working either. 
    The only thing that let me import this large file, is:
    CREATE TABLE #LOADLARGEFLATFILE
    Column1
    varchar(100), Column2 varchar(100), Column3 varchar(100),
    Column4 nvarchar(max)
    BULK INSERT
    #LOADLARGEFLATFILE
    FROM 'C:\FolderBigFile\LARGEFLATFILE.txt'
    WITH 
    FIRSTROW = 2,
    FIELDTERMINATOR ='\t',
    ROWTERMINATOR ='\n'
    The problem with CREATE TABLE and BULK INSERT is that my flat file comes with text qualifiers - "". Is there a way to prevent the quotes "" from loading in the bulk insert? Below is the data. 
    Column1
    Column2
    Column3
    Column4
    "Socket Adapter"
    8456AB
    $4.25
    "Item - Square Drive Socket Adapter | For "
    "Butt Splice" 
    9586CB
    $14.51
    "Item - Butt Splice"
    "Bleach"
    6589TE
    $27.30
    "Item - Bleach | Size - 96 oz. | Container Type"
    Ed,
    Edwin Lopera

    Hi lgnusLumen,
    According to your description, you use BULK INSERT to import data from a data file to the SQL table. However, to be usable as a data file for bulk import, a CSV file must comply with the following restrictions:
    1. Data fields never contain the field terminator.
    2. Either none or all of the values in a data field are enclosed in quotation marks ("").
    In your data file, the quotes aren't consistent, if you want to prevent the quotes "" from loading in the bulk insert, I recommend you use SQL Server Import and Export Wizard tools in SQL Server Express version. area, it will allow to strip the
    double quote from columns, you can review the following screenshot.
    In other SQL Server version, we can use SQL Server Integration Services (SSIS) to import data from a flat file (.csv) with removing the double quotes. For more information, you can review the following article.
    http://www.mssqltips.com/sqlservertip/1316/strip-double-quotes-from-an-import-file-in-integration-services-ssis/
    In addition, you can create a function to convert a CSV to a usable format for Bulk Insert. It will replace all field-delimiting commas with a new delimiter. You can then use the new field delimiter instead of a comma. For more information, see:
    http://stackoverflow.com/questions/782353/sql-server-bulk-insert-of-csv-file-with-inconsistent-quotes
    Regards,
    Sofiya Li
    Sofiya Li
    TechNet Community Support

  • Could not connect to SQL Server 2012 Remotely

    Hello, 
    I have a situation as follows:
    The Server
    SQL Server 2012 Standard Edition installed on Windows Server 2012 Standard Edition
    Active Directory is installed on the same server as well
    Remote Access Role added and configured to connect VPN 
    DNS Role added
    Windows Firewall is disabled
    The Server is connected to the internet 
    SQL Server Service & SQL Browser both are running under domain accounts
    SQL Server allows remote connections
    The Router
    The router that connects the server to the Internet is configured to:
    Enable VPN Tunnels Protocols (PPTP, L2TP and IPSec)
    Forwarding > Virtual Servers (all requests on TCP and UDP on all ports to the server local IP)
    The Client
    PC running Windows 7 SP1 with SQL Server 2012 Express 
    Joined AD on the server
    Connected to the internet
    VPN Connected to the Server
    Can Remote Desktop the Server
    Can ping the server host name
    Can nslookup the server host name
    The Problem
    If Both the Server and the Client are connected in the same Local Area Network, Client can connect to the SQL Serve
    Once the Client is placed in different location connected to the Interent, VPN connected as described above, I could not connect to the Server using:
    Windows Authentication Domain Users or
    SQL Server users
    and the error message is:
    Cannot connect to SERVER\SQLINSTANCE.
    ADDITIONAL INFORMATION:
    A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider:
    SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified) (Microsoft SQL Server, Error: -1)
    For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft%20SQL%20Server&EvtSrc=MSSQLServer&EvtID=-1&LinkId=20476
    Any thoughts
    Thanks in advance
     

    Hello Hilary,
    I have been working on a small replication test.
    On the Publisher, things went smooth and the Snapshot Agent was able to work and produce a snapshot written in a shared folder located on the Publisher
    On the Subscriber, as I am testing from SQL Server Express, I had run the following command:
    replmerg.exe -Publisher [SERVER\SQLInstance] -PublisherDB [dbRepl] -PublisherSecurityMode 0 -PublisherLogin rplMergeAgent -PublisherPassword p@ssw0rd -Publication [TEST Publication] -Distributor [SERVER\SQLInstance] -DistributorSecurityMode 0 -DistributorLogin
    rplMergeAgent -DistributorPassword p@ssw0rd -Subscriber [SUBSCRIBER\SQLInstance] -SubscriberSecurityMode 0 -SubscriberLogin rplMergeAgent -SubscriberPassword p@ssw0rd -SubscriberDB [dbRepl] -SubscriptionType 1 -OutputVerboseLevel 2 -Output C:\TEMP\mergeagent.log 
    Where 
    SERVER
    Publisher and Distributor
    dbRepl
    Database to replicate
    Merge Agent
    rplMergeAgent
    Subscriber
    SUBSCRIBER
    dbRepl
    Subscriber Database
    Merge Agent
    rplMergeAgent
    Password
    p@ssw0rd
    rplMergeAgent
    SQL Login defined in both Publisher and Subscriber with same password
    Granted the following at Publisher:
    Login to Publication Database (dbRepl)
    Login to Distribution Database (distribution)
    Member of PAL
    Granted the following at Subscriber:
    db_owner fixed database role in Subscription database (dbRepl)
    I couldn't grant rplMergeAgent Read Permission on SnapshotFolder as it is only a SQL Login.
    When I ran the above command line, I received the following error:
    Message: The schema script 'Person_2.sch' could not be propagated to the subscriber.
    I am pasting below the whole log file written by the above command:
    2014-04-11 15:38:07.205 Microsoft SQL Server Merge Agent 11.0.2218.0
    2014-04-11 15:38:07.342 Copyright (c) 2008 Microsoft Corporation
    2014-04-11 15:38:07.389 
    2014-04-11 15:38:07.406 The timestamps prepended to the output lines are expressed in terms of UTC time.
    2014-04-11 15:38:07.433 User-specified agent parameter values:
    -Publisher SERVER\SQLInstance
    -PublisherDB dbRepl
    -PublisherSecurityMode 0
    -PublisherLogin rplMergeAgent
    -PublisherPassword **********
    -Publication TEST Publication
    -Distributor SERVER\SQLInstance
    -DistributorSecurityMode 0
    -DistributorLogin rplMergeAgent
    -DistributorPassword **********
    -Subscriber SUBSCRIBER\SQLInstance
    -SubscriberSecurityMode 0
    -SubscriberLogin rplMergeAgent
    -SubscriberPassword **********
    -SubscriberDB dbRepl
    -SubscriptionType 1
    -OutputVerboseLevel 2
    -Output C:\TEMP\mergeagent.log
    2014-04-11 15:38:07.497 Percent Complete: 0
    2014-04-11 15:38:07.517 Connecting to Subscriber 'SUBSCRIBER\SQLInstance'
    2014-04-11 15:38:07.518 Connecting to OLE DB Subscriber at datasource: 'SUBSCRIBER\SQLInstance', location: '', catalog: 'dbRepl', providerstring: '' using provider 'SQLNCLI11'
    2014-04-11 15:38:07.608 OLE DB Subscriber: SUBSCRIBER\SQLInstance
    DBMS: Microsoft SQL Server
    Version: 10.50.4000
    catalog name: dbRepl
    user name: rplMergeAgent
    API conformance: 0
    SQL conformance: 0
    transaction capable: 1
    read only: F
    identifier quote char: "
    non_nullable_columns: 0
    owner usage: 15
    max table name len: 128
    max column name len: 128
    need long data len: 
    max columns in table: 1000
    max columns in index: 16
    max char literal len: 131072
    max statement len: 131072
    max row size: 131072
    2014-04-11 15:38:07.613 OLE DB Subscriber 'SUBSCRIBER\SQLInstance': select SERVERPROPERTY ('ProductVersion') 
    2014-04-11 15:38:07.617 OLE DB Subscriber 'SUBSCRIBER\SQLInstance': set nocount on declare @dbname sysname select @dbname = db_name() declare @collation nvarchar(255) select @collation = convert(nvarchar(255), databasepropertyex(@dbname, N'COLLATION')) select
    collationproperty(@collation, N'CODEPAGE') as 'CodePage', collationproperty(@collation, N'LCID') as 'LCID', collationproperty(@collation, N'COMPARISONSTYLE') as 'ComparisonStyle',cast(case when convert (int,databasepropertyex (@dbname,'comparisonstyle')) &
    0x1 = 0x1 then 0 else 1 end as bit) as DB_CaseSensitive,cast(case when convert (int,serverproperty ('comparisonstyle')) & 0x1 = 0x1 then 0 else 1 end as bit) as Server_CaseSensitive set nocount off
    2014-04-11 15:38:07.637 OLE DB Subscriber 'SUBSCRIBER\SQLInstance': {?=call sp_helpsubscription_properties (N'SERVER\SQLInstance', N'dbRepl', N'TEST Publication')}
    2014-04-11 15:38:07.681 Distributor security mode: 0, login name: rplMergeAgent, password: ********.
    2014-04-11 15:38:07.682 Percent Complete: 0
    2014-04-11 15:38:07.683 Connecting to Distributor 'SERVER\SQLInstance'
    2014-04-11 15:38:07.684 Connecting to OLE DB Distributor at datasource: 'SERVER\SQLInstance', location: '', catalog: '', providerstring: '' using provider 'SQLNCLI11'
    2014-04-11 15:38:25.062 OLE DB Distributor: SERVER\SQLInstance
    DBMS: Microsoft SQL Server
    Version: 11.00.2100
    catalog name: 
    user name: guest
    API conformance: 0
    SQL conformance: 0
    transaction capable: 1
    read only: F
    identifier quote char: "
    non_nullable_columns: 0
    owner usage: 15
    max table name len: 128
    max column name len: 128
    need long data len: 
    max columns in table: 1000
    max columns in index: 16
    max char literal len: 131072
    max statement len: 131072
    max row size: 131072
    2014-04-11 15:38:28.887 OLE DB Distributor 'SERVER\SQLInstance': select SERVERPROPERTY ('ProductVersion') 
    2014-04-11 15:38:29.842 OLE DB Distributor 'SERVER\SQLInstance': {call sp_helpdistpublisher (N'SERVER\SQLInstance') }
    2014-04-11 15:38:32.198 OLE DB Distributor 'SERVER\SQLInstance': select datasource, srvid from master..sysservers where upper(srvname) = upper(N'SERVER\SQLInstance')
    2014-04-11 15:38:33.199 OLE DB Distributor 'SERVER\SQLInstance': {call sp_MShelp_merge_agentid (0,N'dbRepl',N'TEST Publication',null,N'dbRepl',100,N'SUBSCRIBER\SQLInstance')}
    2014-04-11 15:38:34.451 OLE DB Subscriber 'SUBSCRIBER\SQLInstance': {call sys.sp_MSadd_merge_history90 (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}
    2014-04-11 15:38:34.560 OLE DB Distributor 'SERVER\SQLInstance': {call sp_MShelp_profile (23, 4, N'')}
    2014-04-11 15:38:36.189 OLE DB Subscriber 'SUBSCRIBER\SQLInstance': {call sys.sp_MSadd_merge_history90 (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}
    2014-04-11 15:38:36.499 OLE DB Distributor 'SERVER\SQLInstance': {call sys.sp_get_redirected_publisher(N'SERVER\SQLInstance',N'dbRepl',0)}
    2014-04-11 15:38:37.396 Percent Complete: 0
    2014-04-11 15:38:37.396 OLE DB Subscriber 'SUBSCRIBER\SQLInstance': {call sys.sp_MSadd_merge_history90 (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}
    2014-04-11 15:38:37.399 Initializing
    2014-04-11 15:38:37.401 OLE DB Distributor 'SERVER\SQLInstance': {call sys.sp_MSadd_merge_history90 (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}
    2014-04-11 15:38:37.403 Connecting to OLE DB Publisher at datasource: 'SERVER\SQLInstance', location: '', catalog: 'dbRepl', providerstring: '' using provider 'SQLNCLI11'
    2014-04-11 15:38:38.427 Percent Complete: 0
    2014-04-11 15:38:38.428 Validating publisher
    2014-04-11 15:38:38.429 OLE DB Distributor 'SERVER\SQLInstance': {call sys.sp_MSadd_merge_history90 (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}
    2014-04-11 15:38:39.455 Percent Complete: 0
    2014-04-11 15:38:39.456 Connecting to Publisher 'SERVER\SQLInstance'
    2014-04-11 15:38:39.457 OLE DB Distributor 'SERVER\SQLInstance': {call sys.sp_MSadd_merge_history90 (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}
    2014-04-11 15:38:46.548 OLE DB Publisher: SERVER\SQLInstance
    DBMS: Microsoft SQL Server
    Version: 11.00.2100
    catalog name: dbRepl
    user name: rplMergeAgent
    API conformance: 0
    SQL conformance: 0
    transaction capable: 1
    read only: F
    identifier quote char: "
    non_nullable_columns: 0
    owner usage: 15
    max table name len: 128
    max column name len: 128
    need long data len: 
    max columns in table: 1000
    max columns in index: 16
    max char literal len: 131072
    max statement len: 131072
    max row size: 131072
    2014-04-11 15:38:50.282 OLE DB Publisher 'SERVER\SQLInstance': set nocount on declare @dbname sysname select @dbname = db_name() declare @collation nvarchar(255) select @collation = convert(nvarchar(255), databasepropertyex(@dbname, N'COLLATION')) select collationproperty(@collation,
    N'CODEPAGE') as 'CodePage', collationproperty(@collation, N'LCID') as 'LCID', collationproperty(@collation, N'COMPARISONSTYLE') as 'ComparisonStyle',cast(case when convert (int,databasepropertyex (@dbname,'comparisonstyle')) & 0x1 = 0x1 then 0 else 1 end
    as bit) as DB_CaseSensitive,cast(case when convert (int,serverproperty ('comparisonstyle')) & 0x1 = 0x1 then 0 else 1 end as bit) as Server_CaseSensitive set nocount off
    2014-04-11 15:38:57.393 OLE DB Publisher 'SERVER\SQLInstance': select SERVERPROPERTY ('ProductVersion') 
    2014-04-11 15:38:59.236 Connecting to OLE DB Publisher at datasource: 'SERVER\SQLInstance', location: '', catalog: 'dbRepl', providerstring: '' using provider 'SQLNCLI11'
    2014-04-11 15:39:07.271 OLE DB Publisher: SERVER\SQLInstance
    DBMS: Microsoft SQL Server
    Version: 11.00.2100
    catalog name: dbRepl
    user name: rplMergeAgent
    API conformance: 0
    SQL conformance: 0
    transaction capable: 1
    read only: F
    identifier quote char: "
    non_nullable_columns: 0
    owner usage: 15
    max table name len: 128
    max column name len: 128
    need long data len: 
    max columns in table: 1000
    max columns in index: 16
    max char literal len: 131072
    max statement len: 131072
    max row size: 131072
    2014-04-11 15:39:45.229 OLE DB Subscriber 'SUBSCRIBER\SQLInstance': {call sys.sp_MSadd_merge_history90 (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}
    2014-04-11 15:39:45.234 Percent Complete: 0
    2014-04-11 15:39:45.235 OLE DB Subscriber 'SUBSCRIBER\SQLInstance': {call sys.sp_MSadd_merge_history90 (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}
    2014-04-11 15:39:45.236 Retrieving publication information
    2014-04-11 15:39:45.238 OLE DB Distributor 'SERVER\SQLInstance': {call sys.sp_MSadd_merge_history90 (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}
    2014-04-11 15:39:46.287 Percent Complete: 0
    2014-04-11 15:39:46.288 Retrieving subscription information.
    2014-04-11 15:39:46.290 OLE DB Distributor 'SERVER\SQLInstance': {call sys.sp_MSadd_merge_history90 (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}
    2014-04-11 15:40:00.472 OLE DB Subscriber 'SUBSCRIBER\SQLInstance': {call sys.sp_MSadd_merge_history90 (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}
    2014-04-11 15:40:00.478 Percent Complete: 0
    2014-04-11 15:40:00.479 Applying the snapshot to the Subscriber
    2014-04-11 15:40:00.480 OLE DB Distributor 'SERVER\SQLInstance': {call sys.sp_MSadd_merge_history90 (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}
    2014-04-11 15:40:02.535 OLE DB Distributor 'SERVER\SQLInstance': select datasource, srvid from master..sysservers where upper(srvname) = upper(N'SERVER\SQLInstance')
    2014-04-11 15:40:03.559 OLE DB Distributor 'SERVER\SQLInstance': {call sys.sp_MSadd_mergesubentry_indistdb (0,N'SERVER\SQLInstance',N'dbRepl',N'TEST Publication',N'SUBSCRIBER\SQLInstance',N'dbRepl',1,1,0,N'',?,90)}
    2014-04-11 15:40:04.600 Connecting to OLE DB Subscriber at datasource: 'SUBSCRIBER\SQLInstance', location: '', catalog: 'dbRepl', providerstring: '' using provider 'SQLNCLI11'
    2014-04-11 15:40:04.609 OLE DB Subscriber: SUBSCRIBER\SQLInstance
    DBMS: Microsoft SQL Server
    Version: 10.50.4000
    catalog name: dbRepl
    user name: rplMergeAgent
    API conformance: 0
    SQL conformance: 0
    transaction capable: 1
    read only: F
    identifier quote char: "
    non_nullable_columns: 0
    owner usage: 15
    max table name len: 128
    max column name len: 128
    need long data len: 
    max columns in table: 1000
    max columns in index: 16
    max char literal len: 131072
    max statement len: 131072
    max row size: 131072
    2014-04-11 15:40:04.611 OLE DB Subscriber: SUBSCRIBER\SQLInstance
    DBMS: Microsoft SQL Server
    Version: 10.50.4000
    catalog name: dbRepl
    user name: rplMergeAgent
    API conformance: 0
    SQL conformance: 0
    transaction capable: 1
    read only: F
    identifier quote char: "
    non_nullable_columns: 0
    owner usage: 15
    max table name len: 128
    max column name len: 128
    need long data len: 
    max columns in table: 1000
    max columns in index: 16
    max char literal len: 131072
    max statement len: 131072
    max row size: 131072
    2014-04-11 15:40:07.454 OLE DB Subscriber 'SUBSCRIBER\SQLInstance': sp_MSacquiresnapshotdeliverysessionlock
    2014-04-11 15:40:07.526 OLE DB Subscriber 'SUBSCRIBER\SQLInstance': sp_MStrypurgingoldsnapshotdeliveryprogress
    2014-04-11 15:40:07.530 OLE DB Subscriber 'SUBSCRIBER\SQLInstance': sp_MSissnapshotitemapplied @snapshot_session_token = N'\\SERVER\Snapshot\unc\SERVER$SQLInstance_DBREPL_TEST PUBLICATION\20140411082109\', @snapshot_progress_token = N'\\SERVER\Snapshot\unc\SERVER$SQLInstance_DBREPL_TEST
    PUBLICATION\20140411082109\Person_2.sch'
    2014-04-11 15:40:24.659 OLE DB Subscriber 'SUBSCRIBER\SQLInstance': sp_MSreleasesnapshotdeliverysessionlock
    2014-04-11 15:40:24.663 The schema script 'Person_2.sch' could not be propagated to the subscriber.
    2014-04-11 15:40:24.665 OLE DB Subscriber 'SUBSCRIBER\SQLInstance': {call sys.sp_MSadd_merge_history90 (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}
    2014-04-11 15:40:24.690 Percent Complete: 18
    2014-04-11 15:40:24.692 The schema script 'Person_2.sch' could not be propagated to the subscriber.
    2014-04-11 15:40:24.693 OLE DB Distributor 'SERVER\SQLInstance': {call sys.sp_MSadd_merge_history90 (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}
    2014-04-11 15:40:27.541 Percent Complete: 0
    2014-04-11 15:40:27.542 Category:NULL
    Source:  Merge Replication Provider
    Number:  -2147201001
    Message: The schema script 'Person_2.sch' could not be propagated to the subscriber.
    2014-04-11 15:40:28.563 Percent Complete: 0
    2014-04-11 15:40:28.565 Category:AGENT
    Source:  SUBSCRIBER\SQLInstance
    Number:  0
    Message: The process could not read file '\\SERVER\Snapshot\unc\SERVER$SQLInstance_DBREPL_TEST PUBLICATION\20140411082109\Person_2.sch' due to OS error 1326.
    2014-04-11 15:40:28.566 Disconnecting from OLE DB Subscriber 'SUBSCRIBER\SQLInstance'
    2014-04-11 15:40:28.568 Disconnecting from OLE DB Subscriber 'SUBSCRIBER\SQLInstance'
    2014-04-11 15:40:28.569 Disconnecting from OLE DB Subscriber 'SUBSCRIBER\SQLInstance'
    2014-04-11 15:40:28.570 Disconnecting from OLE DB Subscriber 'SUBSCRIBER\SQLInstance'
    2014-04-11 15:40:28.571 Disconnecting from OLE DB Publisher 'SERVER\SQLInstance'
    2014-04-11 15:40:28.573 Disconnecting from OLE DB Publisher 'SERVER\SQLInstance'
    2014-04-11 15:40:28.575 Disconnecting from OLE DB Publisher 'SERVER\SQLInstance'
    2014-04-11 15:40:28.577 Disconnecting from OLE DB Publisher 'SERVER\SQLInstance'
    2014-04-11 15:40:28.578 Disconnecting from OLE DB Distributor 'SERVER\SQLInstance'
    2014-04-11 15:40:28.579 Disconnecting from OLE DB Distributor 'SERVER\SQLInstance'
    I can say it is about how can the rplMergeAgent read the Shared folder.
    What do you think?

  • Difference between SQL SERVER 2008 & SQL SERVER 2012 & SQL SERVER 2014

    Difference between SQL SERVER 2008 & SQL SERVER 2012 & SQL SERVER 2014 ?

    What sort of databases do you have OLTP? Data warehouse? What requirements do you have for High Availability?
    The main features for SQL 2012/2014, as I see it:
    o  Support for window functions, which makes it possible to write fast queries for running totals, sliding windows etc.
    o  Columnstore indexes, which can speed up your data warehouse enormously. But of no interest for OLTP. Only writable in SQL 2014.
    o  AlwaysOn and Availability Groups, a vastly improve story for high availability and disaster recovery.
    o  try_convert/try_cast, you can now easily filter out values from a column which does not convert to a number. A small but essential feature.
    o  In memory-OLTP, a new in-memory engine in SQL 2014. This far with very limited feature set, and quite specialised.
    Of the points above, the second and third require Enterprise Edition, the first and fourth are in all editions. For the last, I don't think Microsoft has announced anything yet.
    There are also new stuff in the BI area, but that's out of my league.
    And, oh, there is a new licensing model - which I think is holding more than one customer back.
    Erland Sommarskog, SQL Server MVP, [email protected]

  • How to join MS SQL Server 2012 to Dreamweaver CS6

    Hello everyone.
    Here's my question: Is it possible to link a Microsoft SQL Server 2012 Database to Dreamweaver CS6, instead of the default MySQL Database?
    I don't particullarily like MySQL because it's interface isn't familiar to me. Instead, I use s way more professional Database Management software, SQL Server 2012. I know that when I try to connect Dreamweaver CS6 to a database, I only have the option to link it to MySQL and I'd like to change it, or at least, to add the SQL Server to the options list. Is there a way to configure that or a kind of Dreamweaver plug-in or extension?
    Please answear.
    Best regards,
    Vlad Drelciuc
    Web Content Developer

    Since you refer to MySQL as the default database, I presume that you're talking about using PHP.
    Yes, you can link to MS SQL Server - as long as you're willing to code everything by hand. If you're looking for automated code generation, though, the answer is no.
    Even the default PHP/MySQL server behaviors are not really worth considering for professional web development. They're fine for quick prototyping, but they use deprecated functions that are not suitable for a production environment.

Maybe you are looking for

  • Proper WSUS+SCUP on SCCM 2012 SP1 with SQL 2012

    Been pulling my hair out a new build. System: Windows 2012 SQL 2012 SP1 WSUS 4.0 SCUP 2011 WSUS itself will synch if I set source= Microsoft Update. SCCM SUP will synch with if I set source= Microsoft update. SCUP will not connect to "update server"

  • Dynamic selection list based on selection screen values ?

    I have a requirement which I can't solve in one step in a selection screen first field I have to select the contract like you do with me33k in the second field I have to select the position of the contract filled in at the first field ? if the positi

  • Best Practice for unclaimed creditcard receipts

    Dear Guru's, Can any one share their experience, what is the best practice in collecting the amount from employee for the credit card receipts unclaimed and vests in document buffer. Say, credit card receipt is uploaded to document buffer, but employ

  • Cant change my email address

    {please keep your posts courteous} after talking to tech to try and change my email adress i got no were with these **bleep**.  when i move out of were i am   (next year) verizon can kiss my **bleep**, and will lose a customer for life

  • Safari 2.0.4 and Yahoo Messenger Web Interface

    I have been trying Yahoo's messenger web interface, which allows you to use your browswer instead of downloading the actual yahoo messenger. Whenever I goto sign out, safari crashes. I have all latest updates, the latest flash player, etc. Anyone hav