SSIS Expression to Server Name from a Connection String

Hi,
I have an SSIS variable which contains a connection string as follows; -
User::strD​YNconnecti​on {Data Source=myServer;Init​ial Catalog=myDatabase;Provider​=SQLNCLI10​.1;Integra​ted Security=XXXX} String
I need to get the server name from the above variable using an SSIS expression so I can pass the server name to another function.
Thanks in advance,
Kieran.
Kieran Patrick Wood http://www.innovativebusinessintelligence.com http://uk.linkedin.com/in/kieranpatrickwood http://kieranwood.wordpress.com/

Hi Kieran,
This works fine when the Data source comes first in the connection string (which it usualy does). but when it doesn't,
e.g.
Init​ial Catalog=myDatabase;Data Source=myServer;Provider​=SQLNCLI10​.1;Integra​ted Security=XXXX}
you will get 'myDatabase' as an answer
I would add 'Data source =' in the find string (and adjust for length of this search string to add sufficient offset)
e.g.
SUBSTRING(RIGHT(@[User::strDYNconnection],LEN(@[User::strDYNconnection]) - 11 - FINDSTRING(@[User::strDYNconnection],"Data Source=",1)),1,FINDSTRING((RIGHT(@[User::strDYNconnection],LEN(@[User::strDYNconnection]) - 11 - FINDSTRING(@[User::strDYNconnection],"Data
Source=",1))),";",1) - 1)
Even this is not foolproof, when the Data source is the last element in the string and there is no ending ;
e.g.
Init​ial Catalog=myDatabase;Provider​=SQLNCLI10​.1;Integra​ted Security=XXXX;Data Source=myServer}
the formula needs to be extended further with a ( ? : ) operator around the last operator to see if the last ";" was found or not.
Jan D'Hondt - SQL server BI development

Similar Messages

  • Changing the server name on package connection string.

    I have a connection string in a package which is a local connection string and not in project connection manager and isn't parameterize as well. Now I need to change a server name of the connection property without using editor. Can I do that and how ?
    Moyz Khan

    I agree about using configuration for connection string but unfortunately this is an inherited project/packages . And my task it to make these run as currently I don't have luxury to modified it.
    So I was able to change most of the connection string with below update
    update[SSISDB].[internal].[execution_parameter_values]
    setparameter_value=replace(cast(parameter_valueasvarchar),'OldServer',NEwServer)
    update[SSISDB].[internal].[object_parameters]
    set[design_default_value]= 
    replace( 
    cast([design_default_value]asvarchar(1000)),'OldServer','NEwServer')
    Now the only one its complaining is the Project connection string . If I know where to look and update that I might be able to run these packages .
    Moyz Khan

  • Server name problem-jdbc connection string

    hi..
    my server name is SERKANPROX\LOCALHOST .. i couldn't connect to this server with this server name . how can i write the server name in connection string?. this is the part my code:
    Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver").newInstance();
    Connection con = DriverManager.getConnection("jdbc:microsoft:sqlserver://serkanprox//localhost:1 433;DatabaseName=NorthWind","serkan","serkan");
    the exception is : [Microsoft][SQLServer 2000 Driver for JDBC]Error establishing socket.
    i can connect to the server which name is "serkan" . but when there is a '\' character ,i couldn't..
    how can i can change the connection string for connecting to this server ..
    thanksss

    hi..
    my server name is SERKANPROX\LOCALHOST No it isn't. Get the right server name. This problem has nothing to do with your username and password and such.

  • How to get the SQL Primary and Mirrored Database Server Name from Witness Server

    Hello,
                    Can Someone help me with the way to get SQL Primary and Mirrored server name from Witness server?
    Any Powershell script/SQL Query..etc or share the alternative?
    Regards,
    Julie

    select principal_server_name,mirror_server_name,* from sys.database_mirroring_witnesses
    -Prashanth

  • Dynamically Setting a Variable from a Connection String that has been set by a Config File

    Hi Guys
    I'm setting up a Master / Slave (Parent / Child) dtsx environment but I'm unable to work out how to dynamically set a variable in the Master dtsx from a connection string that has had its value set by a config file. I'm sure it's possible.
    Below is the what I'm hoping to achieve. I've set up everything apart from the highlighted section.
    Any ideas?

    First, what version of SQL Server are you using?
    You could switch the problem around.  You could set the value of a variable from the config file, then it is easy to use that variable as the connection string source for your connection manager.  At the same time you can use a parent variable
    configuration to map that variable to variables in your child package.
    Russel Loski, MCT, MCSE Data Platform/Business Intelligence. Twitter: @sqlmovers; blog: www.sqlmovers.com

  • How to get IDL file name from CORBA IOR string

    hi, is it possible to get IDL file name from the IOR string? how?
    regards

    Hi,
    I don't think so.
    And if it was possible, which interface should be returned if
    the referenced object implements more than one?
    Regards.
    Karl

  • Specify Default Schema Name in HANA Connection string

    Hi,
    I have connection string like this.
    DRIVER={HDBODBC32};UID=uid;PWD=pwd; SERVERNODE=x.com:30015;
    I want to include default schema name in the connection string.
    Please help me

    Hi S V
    there is no option for that available.
    To change the current schema it's required to run SET SCHEMA <schema_name> after you logged on.
    - Lars

  • SQL Server Express 2014 - Server Name

    Hi Guys,
    I just now installed the free edition of SQL Server 2014 (Management Studio only edition).
    During installation I was not allowed to provide an instance name. Post installation when I am trying to connect the server using the management  studio it fails consistently.
    I have tried using LocalDB, (local), SQLExpress and all other combinations (machine\LocalDB) etc.
    When I open the SQL Config Manager there "SQL Server Services" has no entries.
    Can someone help me in getting the server name to connect to?
    Regards,
    HTH, Krishnan

    Hey Dan,
    I am not facing a different kind of challenge. I am trying to connect to this instance using a different product. I tried the following:
    - Provided the same instance name as Mgmt Studio
    - Tried using both Windows / SQL Authentication
    When I did a netstat, it does not show that 1433 is listening. The SQL Configuration Manager has 2 sections:
    1. SQL Native Client 11.0 Config - Here the TCP/IP is listening to 1433
    2. SQL Server Network Configuration -> Protocols for SQL Express - TCP / IP -> Dynamic Ports -> 49819
    Netstat is showing some data for 49819. However my other product is still not able to pick up SQL Server :(
    HTH, Krishnan

  • How to Retrieve Server Name for creating connection pool during startup!

    Hi All,
    I am going thru the edocs documentation of weblogic for creating the connection pool and the datasource dynamically. The URL I referred to was as under
    http://edocs.bea.com/wls/docs81/jdbc/programming.html
    There is a sample given in the above-mentioned URL. The Server MBean is created by passing the server name.
    The code below mentioned was have placed in my dblib.java
    svrAdminMBean = (ServerMBean)adminMBeanHome.getAdminMBean("myserver", "Server");
    I am creating the connection pool from the servlet by invoking the dblib.java
    I cannot hard-code the server name in the dblib.java since the same code was shared across multiple servlets.
    Each Servlet will create its own connection pool during application server startup.
    Is there a way to retrieve the server name in which the dblib.java is invoked.
    Any pointers to info source will be REALLY appreciated.
    Many Thanks in Advance,
    C R Baradwaj

    You can get it from the Java system property weblogic.Name, i.e. System.getProperty("weblogic.Name");
    Cheers
    Feargal

  • Resolving a Server Name from a TNS Service Name

    A computer client has an Oracle ODBC connection that is attached to a TNS Service Name "X". The TNS Service Name is running in Server "Y".
    Does anybody know a quick way to resolve the Server Name "Y" from the TNS Service Name "X" ???
    Our current solution is based on opening the file tnsnames.ora, which is normally located in $ORAHOME\network\ADMIN\TNSNAMES.ORA, and by parsing the file resolve the server name. However, we were wondering if there would be a more reliable way to do this. Is there an Oracle API that we can execute? Something like "GetHostName(TNSServiceName)"?
    Many Thanks

    tring TNSPING <service>
    the outputline contents the HOSTname

  • Resolving the Server Name from a TNS Service name

    A computer client has an Oracle ODBC connection that is attached to a TNS Service Name "X". The TNS Service Name is running in Server "Y".
    Does anybody know a quick way to resolve the Server Name "Y" from the TNS Service Name "X" ???
    Our current solution is based on opening the file tnsnames.ora, which is normally located in $ORAHOME\network\ADMIN\TNSNAMES.ORA, and by parsing the file resolve the server name. However, we were wondering if there would be a more reliable way to do this. Is there an Oracle API that we can execute? Something like "GetHostName(TNSServiceName)"?
    Many Thanks

    Not that I'm aware of.
    If you were using an Oracle Names server to resolve tnsnames, rather than a tnsnames.ora file, this would be a lot easier. You'd just update the Oracle Names server and all the clients would start pointing at the right machine.
    Justin

  • How to change server name from RAS?

    Wshes to All,
    I have designed a report with local server and uploaded into RAS .
    Now i have to change the server name in the RAS itself without touching the report.
    How to achieve this.
    Kindly solve my problem.
    Thanks in advance.
    Saravanakumar

    Hi ,
    Since i cannot figure out what to give in the third parameter in replaceConnection() ,
    I am using SetTableLocation(oldTable,NewTable);
    For that i am setting the following Properties,
            propertyBag.put("Trusted_Connection","False");
            propertyBag.put("Server Type", "JDBC (JNDI)");
            propertyBag.put("Use JDBC","true");
            propertyBag.put("Database DLL","crdb_jdbc.dll");
            //propertyBag.put("JNDIOptionalName",JNDIName);
            propertyBag.put("Connection URL","jdbc:oracle:thin:@xxxxxxxx:xxx");
            propertyBag.put("Database Class Name","oracle.jdbc.driver.OracleDriver");
    But still i cannot establish the connection.
    Is Connection String also required.
    If so how to give the Value for that.
    Thanks,
    Saravanakumar.

  • How to change Server Name on BPC Connection Wizard in Mass

    Hi there,
    I need to know if there's a way to change Server Name in Connection Wizard on a large number of PCs, using a configuration file that can be deployed to the PCs that need the change.
    Thanks for your response.
    Cheers,
    Rodrigo

    Apparently the Server name is stored under:
    HKEY_LOCAL_USER\Software\VB and VBA Program Settings\Outlooksoft
    5\LATEST for each user who uses BPC under the data containing "SERVER"
    So this is going to help on this requirement, previous a registry backup.
    Cheers,
    Rodrigo

  • Server name from adaptive tags

    Is there a adaptive tag that gets the name or url of portal server.
    Thanks in advance.
    Edited by: zaf_viq on Jan 12, 2009 4:24 PM

    If your image and portal server URL are same, then you can make use of the image server url to get the portal url.
    You can make use of "pt://images/" to get the image server url. from this you can strip of the "/imageserver/" to get the prefix portion of the url.
    Example:
    <img src="pt://images/">
    for more info
    http://edocs.bea.com/alui/devdoc/docs60/Portlets/Adaptive_Portlets/Using_Adaptive_Tags/PlumtreeDevDoc_Integration_Portlets_Adaptive_Links.htm
    Thanks,
    Bharat

  • Drop server name from Jabber ID

    The default has the jabber IDs set up as <user>@<servername>.example.com. I'd like to drop the server name so it just lists as <user>@example.com. Is there a way to do this in Lion?

    Anyone?

Maybe you are looking for

  • Missing menu bars in KDE apps

    The menu bars have disappeared in some KDE apps such as Okular and Kdenlive, so I can't use them properly any more! But some apps like KWrite seem to not be affected. I am using Plasma Desktop 5.2.1. Pressing Ctrl+M does nothing. Last edited by shaur

  • Call a portal form from another form

    I have a portal form which needs to call another form using a link and passing parameters .. both of forms are built on tables with a forigen key.. How can i pass parameters from form1 to form2 ? Best Regards

  • VAT PERCENTAGE CHANGE

    Hi, Hungary VAT is getting changed from 20 -25% from July 1st on wards. We have tax condition record active i.e, MWST where they are condition records maintained for domestic as well as export sales Now we have some requirement that if an order has r

  • How timecode counts in 720p24 drop frame ?

    This might be a slightly OT question, since it doesn't apply just to FCP, but its more general. As any +drop frame+ timecode, also p24 drop frame (actually running at 23.976 fps) must have some timecode numbers dropped; I guess about 14 (14,4 in theo

  • Facebook chat and ticker problem

    A few days ago in my macbook the facebook ticker at the right side and also the chat doesn't displaying right. In my imac i don't have this problem. I erased the website data for facebook, also the cache but the problem exists. Any help for that? Tha