SQL Server Parsing Key Value from Text

i am a novice programmer in sql.
I want to grab some key value pairs from the text in sql column
e.g.
some text[Key1=Val1]some text[Key2=Val2][Key3=Val3]some text
i want a function which takes Keyname as input & returns the value related with it if found.
GetValueFmKey('Key1') should return Val1 and like on.
Note: the specified values are in text it may have pre or post text exists.

The Final code which i used is:
CREATE FUNCTION [dbo].[GetValueFmKey]
@TextToParse Varchar(max),
-- Input Text to be Parsed
@ParsingKey Varchar(max)
-- The Key for which Value to be Parsed
RETURNS VARCHAR(max)
AS
BEGIN
DECLARE @ReturnParsedValue VARCHAR(max)
DECLARE @SemiParsedString VARCHAR(max)
DECLARE @StringFound INT
SET @StringFound =patindex ('%'+@ParsingKey+'%',@TextToParse)
-- IF KEY found in Input Then only Proceed
IF(@StringFound<>0)
BEGIN
SET @SemiParsedString= substring(@TextToParse,patindex ('%'+@ParsingKey+'%',@TextToParse),patindex('%]%',substring(@TextToParse,patindex ('%'+@ParsingKey+'%',@TextToParse)+1,len(@TextToParse)))) 
SET @ReturnParsedValue = substring(@SemiParsedString,patindex('%=%',@SemiParsedString)+1,len(@SemiParsedString))
END
-- ELSE SET RETURN Value to NULL
ELSE
BEGIN
SET @ReturnParsedValue = NULL
END
-- Return the result of the function
RETURN @ReturnParsedValue
END
As It only checks if Key is present in Input Text else it returns NULL.

Similar Messages

  • New install of SQL 2014 Std MSDN. Get "The SQL Server product key is not valid. To proceed, re-enter the product key values from the Certificate of Authenticity (COA) or SQL Server packaging."

    Trying to install a new version of SQL 2014 Std 64 or x86. Installing on Windows 8.1Pro 64bit machine.
    I get:
    "TITLE: SQL Server Setup failure.
    SQL Server Setup has encountered the following error:
    The SQL Server product key is not valid. To proceed, re-enter the product key values from the Certificate of Authenticity (COA) or SQL Server packaging.
    Error code 0x858C0017."
    I looked at the summary log and that is the only error.
    I made sure there were no other instances of SQL on this machine. Uninstalled all VS2013 and sql instances just in case. IF there is somewhere to check if a previous version or license is causing the issue, i would be glad to check.
    Any help would be appreciated.

    Hi,
    Please read this thread with similar issue
    http://social.msdn.microsoft.com/Forums/sqlserver/en-US/bdd94577-515c-49fa-be44-008eacece057/installing-sql-server-2012-on-a-new-vm-error-code-0x858c0017?forum=sqlsetupandupgrade
    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 Articles

  • Passing SQL Server identity attributes values into adf entity objects

    Hi all.
    I'm using Jdeveloper 10g for developing an ADF Swing application based on MS SQL Server DB.
    Does anyone know if it is possible to pass SQL Server identity attributes values into the correspondent attrributes of adf entity objects, like we do with Oracle DB Sequence.
    The problem is that i should somhow implement cascade deleting of detail view objects, so i should use the composition association. But since i cant fill the primary key attribute with appropriate value (that is actually a ms sql server db sequence value) i always get
    the following exception: oracle.jbo.InvalidOwnerException: JBO-25030 as i try to create a new pair of master/detail objects.
    Thanks in advance.
    Alex.

    The approach is good. but i still dont understand how i can address the sql server db sequence (identity field) programmatically...
    The code offered
    SequenceImpl sequence = new SequenceImpl("PRODUCTS_SEQ",getDBTransaction());
    setProdId(sequence.getSequenceNumber());
    generates something like this:
    select deq_name.nextval from dual
    but this syntax works for oracle only... and not for sql server...
    Edited by: Timin on Mar 26, 2009 6:34 AM
    Edited by: Timin on Mar 26, 2009 10:25 AM

  • Failed to set security on SQL Server registry key. Error: 2

    Hi,
    I have a Primary site (mixed mode) running SCCM 2007 SP1 for many months now with no issues.
    This site is made up of two Win 2008 sp2 servers sharing the SCCM roles:-
    SCCM01 - Site server, DP, RP, PXE and SQL2005 hosting the SCCM database
    SCCM02 – SUP, MP, FSP, SLP
    The SQL2005 on SCCM01 is running under a domain service account called
    domain\service_sccm which is also a sysadmin in SQL as is the SCCM02 server.
    In an effort to resolve the isse I have made this account a Domain Admin.
    I have also used this account to log onto SEC01 to run the Secondary Site installation and to be the SQL Service account.
    I'm now trying to add a Secondary Site on a Domain Controller called SEC01 (also Win2008 sp2) and on the same LAN as the SCCM01/02.
    This is where I get problems.
    I run the installation locally on the Sec Site server (DC) as a Domain Admin and the installation completes OK (all green ticks),
    the ComponentSetup.log and Pre-Reqs are all good as well however when I check the ConfigMgrSetup.log I see the below -
    Failed to set security on SQL Server registry key. Error: 2.
    <11-09-2010 22:46:59> SMS Setup full version is 4.00.6221.1000
    <11-09-2010 22:46:59> Successfully set security on Setup registry key.
    <11-09-2010 22:46:59> Failed to set security on SQL Server registry key. Error: 2
    <11-09-2010 22:46:59> Successfully set security on Identification registry key.
    <11-09-2010 22:46:59> Creating SMS Inbox Source registry key ...
    <11-09-2010 22:46:59> Installing SMS Site Component Manager ...
    <11-09-2010 22:46:59> Installing Site Component Manager under acct <NT AUTHORITY\SYSTEM> path <C:\Program Files (x86)\Microsoft
    Configuration Manager\bin\i386\sitecomp.exe>
    <11-09-2010 22:47:01> Started Site Component Manager service
    <11-09-2010 22:47:01> SMS Site Component Manager installation completed.
    <11-09-2010 22:47:01> Done with service installation
    Adding the PMP role to SEC01 also fails to install and no MPSetup or MPControl logs are created.
    WebDav and win2008 roles, features all added and server fully patched.
    Despooler.log on SCCM01 seems good and passing keys.
    Tried installing to default path and to shortened path such as C:\SCCM
    The new secondary site is listed in the console and an address can be added for the Secondary Site
    BITS Server Extensions and Remote Differential Compression Features are enabled.
    The Group memberships all appear ok:-
    SCCM01
    Local Admins    
    contains the sec site server SEC01, SCCM01, installation accounts
    SMS_SiteToSiteConnection_001              
    SEC01 (the sec site server)
    SMS_SiteSystemToSiteServerConnection_001                 
    SCCM02
    SEC01
    No Local Admins as a DC
    SMS_SiteToSiteConnection_002              
    SCCM01
    SMS_SiteSystemToSiteServerConnection_002     
    empty
    SQL 2005
    This has the account logged in during installation as a sysadmin
    SCCM02 is also sysadmin
    The fundamental issue appears to be that the SEC01$ server account is not being added to SQL Logins (and therefore SCCM database Roles)
    therefore the installation cannot complete.
    I have tried to manually add the SEC01 account to SQL Logins before installation of Sec Site but this did not work.
    Not sure if the fact that SEC01 is a DC may be a factor.
    Appreciate any help if anyone has seen this before or can suggest a resolution.
    Thanks

    After a lot of digging around and head scratching I eventually found the resolution.
    The original thread title Error turned out to be a bit of a red herring in that my failure to deploy Sec Sites came down to two separate issues seemingly unrelated to the error message of the thread title.
    The first part of the resolution was to manually create the SQL Server accounts for the Sec Site Servers and assign them to the smsdbrole_MP DB role to
    let the SQL side of the SCCM install complete a s these were not being created automatically.
    This then left the fact that that the installation of the Sec Site completed successfully according to the install logs in C:\ however the DP and MP would
    never install.
    The big clue was eventually contained in the mpfdm.log errors relating to
    **ERROR: Cannot find path for destination inbox SMS_AMT_PROXY_COMPONENT on server REGISTRY SMS_MP_FILE_DISPATCH_MANAGER 
    and
    **ERROR: Cannot find path for destination inbox Asset Intelligence KB Manager on server REGISTRY SMS_MP_FILE_DISPATCH_MANAGER 
    Thankfully the errors led me to these two blogs:
    http://myitforum.com/cs2/blogs/scassells/archive/2009/07/20/error-cannot-find-path-for-destination-inbox-sms-amt-proxy-component-on-server-registry.aspx
    and
    http://social.technet.microsoft.com/Forums/en-US/configmgrsetup/thread/5fcc53d4-8629-4b34-9eaa-6cb020eedc13/
    As it turned out the SCCM installation registry and folder creation does not complete and I had to manually enter the reg settings as detailed in the
    links above to complete the installation. Once I did as described everything worked a treat – all my MPs and DPs are 100% now.
    Solutions
    Add the following reg keys to each of your effected secondary sites.
    Inbox Fix
    Windows Registry Editor Version 5.00
    [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\SMS\MPFDM\Inboxes]
    "Asset Intelligence KB Manager"="E:\\Program Files\\Microsoft Configuration Manager\\inboxes\\AIKbMgr.box"
    "SMS_AMT_PROXY_COMPONENT"="E:\\Program Files\\Microsoft Configuration Manager\\inboxes\\amtproxy.box" 
     Asset Intelligence fix:
     Note: you will need to identify the next largest key value. 
    In my example it was key 49
     Windows Registry Editor Version 5.00
    [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\SMS\Inbox Source\Inbox Definitions\49]
    "Inbox Name"="Asset Intelligence KB Manager"
    "Relative Path"="inboxes\\AIKbMgr.box"
    "NAL Path"=""
    "User Rights"=dword:00000000
    "Service Rights"=dword:00000004
    "Monitoring Enabled"=dword:00000001
    "Location Type"=dword:00000001
    "Guest Rights"=dword:00000001
    AMT registry Fix.
      Note: you will need to identify the next largest key value. 
    In my example it was key 50
    Windows Registry Editor Version 5.00
    [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\SMS\Inbox Source\Inbox Definitions\50]
    "Inbox Name"="SMS_AMT_PROXY_COMPONENT"
    "Relative Path"="inboxes\\amtproxy.box"
    "NAL Path"=""
    "User Rights"=dword:00000000
    "Service Rights"=dword:00000004
    "Monitoring Enabled"=dword:00000001
    "Location Type"=dword:00000001
    "Guest Rights"=dword:00000001
    Big thanks to Shaun Cassells and John Marcum for these blogs

  • How to read the Key value from the Message using the text value.. Urgent

    I need to read the Key valuefrom the message pool using the text value for the Key.. Is it possible.. Please help me with sample code..
    Thanks and Regards
    Avijit

    Avijit,
    I got your requirement. I really dont know the scenario your working on but its possible to do it. There is no direct way to do so, but complexity is in getting to know the Keys dynamically from interface.
    Here you go..
         try
              Class msgClass      = IMessageTestWDApps.class;
    //Replace IMessageTestWDApps with IMessage<Your WD Component name>
              Field keys[]      = msgClass.getFields();
              IWDTextAccessor textAccessor = wdComponentAPI.getTextAccessor();
              if(keys != null)
                   String key = "";
                   for(int index=0;index<keys.length;index++)
                        key = keys[index].getName();
                        wdComponentAPI.getMessageManager().reportSuccess("Key= "+key);
                        if(textAccessor.getText(key).equals("My message text"))
                             //your logic.
         catch(Exception cnfe)
              wdComponentAPI.getMessageManager().reportException("Exe "+cnfe.getMessage(),false);
    Regards
    Abhilash
    Message was edited by:
            Abhilash Gampa

  • Report- Pl/sql function returning sql query parsing page items as text?

    Hi Team,
    I am facing a strange issue .
    I have four page items namely
    1)JOB_CODE
    2)MIN_EXP
    3) MAX_EXP
    4) SOURCES1
    I have a report of the type "Pl/sql function returning sql query"
    declare
    v_sql varchar2(4000);
    begin
    if (:JOB_CODE IS NOT NULL and :MIN_EXP IS NOT NULL and :MAX_EXP IS NOT NULL and :SOURCES1 IS NOT NULL) then
    v_sql:= 'select v_candidate_id, v_fname,v_current_employer,v_Experience_years from candidature where V_REQUIREMENT = :JOB_CODE and v_experience_years >= :MIN_EXP and v_experience_years <= :MAX_EXP and source like ' || '''' || '%'|| ':SOURCES1' || '%' || '''';
    elsif (:JOB_CODE IS NULL and :MIN_EXP IS NOT NULL and :MAX_EXP IS NOT NULL and :SOURCES1 IS NOT NULL) then
    v_sql := 'select v_candidate_id, v_fname,v_current_employer,v_Experience_years from candidature where v_experience_years >= :MIN_EXP and v_experience_years <= :MAX_EXP and source like ' || '''' || '%'|| ':SOURCES1' || '%' || '''';
    elsif (:MIN_EXP IS NULL and :JOB_CODE IS NOT NULL and :MAX_EXP IS NOT NULL and :SOURCES1 IS NOT NULL) then
    v_sql := 'select v_candidate_id, v_fname,v_current_employer,v_Experience_years from candidature where v_experience_years <= :MAX_EXP and V_REQUIREMENT = :JOB_CODE and source like ' || '''' || '%'|| ':SOURCES1' || '%' || '''';
    elsif (:MAX_EXP is null and :JOB_CODE IS NOT NULL and :MIN_EXP IS NOT NULL and :SOURCES1 IS NOT NULL) then
    v_sql := 'select v_candidate_id, v_fname,v_current_employer,v_Experience_years from candidature where V_REQUIREMENT = :JOB_CODE and v_experience_years >= :MIN_EXP and source like ' || '''' || '%'|| ':SOURCES1' || '%' || '''';
    end if;
    insert into query_list values (v_sql);
    insert into debug values (:JOB_CODE , :MIN_EXP , :MAX_EXP , :SOURCES1);
    return v_sql;
    end;
    Please not that I am insertin the query into a table called Query_list and the page item values into the table called Debug thru the pl/sql function which returns teh query.
    Now I select the data from the debug tables.
    select unique(query) from query_list;
    select v_candidate_id, v_fname,v_current_employer,v_Experience_years from candidature where V_REQUIREMENT = :JOB_CODE and v_experience_years >= :MIN_EXP and v_experience_years <= :MAX_EXP and source like '%:SOURCES1%'
    select * from debug;
    JOBCODE     MINEX     MAXEX     SOURCE
    21     1     10     donkeyHire
    And if I run the query in sql I get some records returned
    select v_candidate_id, v_fname,v_current_employer,v_Experience_years from candidature where V_REQUIREMENT = 21 and v_experience_years >= 1 and v_experience_years <= and source like 'donkeyHire'
    V_CANDIDATE_ID     V_FNAME     V_CURRENT_EMPLOYER     V_EXPERIENCE_YEARS
    2     Vengu     Andale Tech     4
    But the record does not show up in the report!
    does this type of report parse page items as text?
    Why is it so?
    Waiting for an early reply.
    Thanks,
    venkat

    Venkat - You don't want to put ':SOURCES1' in quotes like that.
    Scott

  • Reading String (Name-Value) from text file into XML

    Hi,
    I have a requirement for reading a text file and converting each entry of that text file into XML format. I have not came across such thing yet so looking for some ideas. I am using SQL Server 2005 and here is a sample entry from my source text file,
    Jun 4 14:31:00 zzzz64x02 fff:
    INPUT(ty=XYZ,Prefix=15063,dn=78787878787878,sgk=100.139.201.48,xxn=87878,ani=656565656565,ogrp=F7ZX05,ogtxt=NNNNN,ogx=NNNNN,oci=0xe00ac,ogi={NOA=INT,BC=1,SIG-TYPE=ZIP});
    PROCESS(ty=0x100000,cu=32880,Name=XOXOXOX,pc=88017,pd=24,dd=880175,pk=880175,rd=115472,ca=BGD,reg=RW,cdp=1,ai=245359,grp=2648,sl=9);
    OUTPUT(ty=XXXX,ret=0,rl=
    {i=1,su=99999,rizID=61084,skid=06,truckgp=1084,dd=8801,dn=78787878787878}
    I will get multiple entries like this in my source text file which I have to convert into XML (using TSQL).
    Any help will be useful.
    Regards.
    'In Persuit of Happiness' and ..... learning SQL.

    And I'm telling you that this is a bad option. You would use the vaccum cleaner to wash the dishes, would you?
    If you for some reason would do this task in SQL Server, you would implement it as a CLR stored procedure, but from what you have said I don't understand why you would do this server-side at all.
    What's wrong with the current C# solution?
    Erland Sommarskog, SQL Server MVP, [email protected]
    Got it.  I was just looking for the available options, nothing wrong with my C# solution. And yes, I don't use vacuum cleaner to wash dishes.
    'In Persuit of Happiness' and ..... learning SQL.

  • Effective way to parse key-value pair.

    Hi,
    I've a PL/SQL process, in which I've lot of dynamic sql routines planned, to parse input data to a procedure.
    One of the parameter to call or that'd be passed to this procedure is a "key-value pair"
    e.g.
    procedure p ( id in number, state_name in varchar2 )
    Values could be
    20, 'vc1=AZ, vc2=WA, vc3=NY, vc4=NJ'
    My requirement is as follows
    <ol><li>Parse 'state_name', for values of state ( AZ, WA, NY, NJ ) - note that the list could be of variable length</li>
    <li>I'm not interested in 'key' per se ( vc1, vc2, vc3... )</li>
    <li>State names are important as ( as ) part of the process, I want to concatenate them to form tables-name,
         which (already) exists e.g. table_CA, table_AZ, table_WA, table_NJ - so basically I need to
         parse these names and have them in a way to be able to use them as part of other dynamic SQL's.
    </li>
    </ol>
    Please advice.
    Thanks.

    shankariyer wrote:
    Is it possible for me to populate the output of this regex_replace into an array of varchar2 ??
    Sure:
    CREATE OR REPLACE
      TYPE STATE_TBL_TYPE
        AS
          TABLE OF VARCHAR2(2);
    SET SERVEROUTPUT ON
    DECLARE
        v_value_pair VARCHAR2(30) := 'vc1=AZ, vc2=WA, vc3=NY, vc4=NJ';
        v_state_tbl  STATE_TBL_TYPE := STATE_TBL_TYPE();
    BEGIN
        FOR v_i IN 1..NVL(LENGTH(v_value_pair) - LENGTH(REPLACE(v_value_pair,',')) + 1,0) LOOP
          v_state_tbl.EXTEND;
          v_state_tbl(v_i) := LTRIM(REGEXP_SUBSTR(v_value_pair,'=[A-Z]+',1,v_i),'=');
        END LOOP;
        FOR v_i IN 1..v_state_tbl.COUNT LOOP
          DBMS_OUTPUT.PUT_LINE(v_state_tbl(v_i));
        END LOOP;
    END;
    SQL> SET SERVEROUTPUT ON
    SQL> DECLARE
      2      v_value_pair VARCHAR2(30) := 'vc1=AZ, vc2=WA, vc3=NY, vc4=NJ';
      3      v_state_tbl  STATE_TBL_TYPE := STATE_TBL_TYPE();
      4  BEGIN
      5      FOR v_i IN 1..NVL(LENGTH(v_value_pair) - LENGTH(REPLACE(v_value_pair,',')) + 1,0) LOOP
      6        v_state_tbl.EXTEND;
      7        v_state_tbl(v_i) := LTRIM(REGEXP_SUBSTR(v_value_pair,'=[A-Z]+',1,v_i),'=');
      8      END LOOP;
      9      FOR v_i IN 1..v_state_tbl.COUNT LOOP
    10        DBMS_OUTPUT.PUT_LINE(v_state_tbl(v_i));
    11      END LOOP;
    12  END;
    13  /
    AZ
    WA
    NY
    NJ
    PL/SQL procedure successfully completed.
    SQL> SY.

  • Returning sql statement instead of values from database

    hi am reading value from database but my problem is am get sql statement values instead of values in database
    my code is
    java:337)

    There is no doubt: you get what you want:
        return s_getValue;
    bye
    TPD

  • How can i get data from another database SQL Server use database link from

    I have a database link from Oracle connect to SQL Server database with user cdit connect default database NorthWind.How can I get data from another database(this database in this SQL Server use this database link)?

    hi,
    u should see following documentation:
    Oracle9i Heterogeneous Connectivity Administrator's Guide
    Release 1 (9.0.1)
    Part Number A88789_01
    in it u just go to chapter no. 4 (using the gateway),,u'll find ur answer there.
    regards
    umar

  • SQL Server 2005 data pull from Oracle

    Hi, I am learning how to use Oracle and I ran into this problem.
    My database is running on SQL Server 2005.
    I have an ODBC connection to Oracle. I also have a VB .Net script that queries the Oracle table that the data resides in.
    When the job is running, and if it stalls, I do not get a timeout error. It locks down my database and no other source systems can feed data to me; these are back logged in the queue.
    Is there an easier way for me to make a connection that will pull data on a consistent basis? Please help ...
    Student Learner

    Learning how to use Oracle does not include taking data from Oracle and putting it into SQL Server.
    From your description of what is happening I agree with BluShadow. This is not an Oracle issue. This is a coding in VB .NET issue.
    Posting the statements you are executing against some unknown version of Oracle would be a good starting point.

  • PL/SQL 10g - Cannot Insert Values from PL/SQL

    Hi People,
    BACKGROUND (if required):
    I'm trying to write a message threading algorithm for uni, I believe it works so far, it's just matching the subjects at the moment I want to expand it to include email addresses but that will be at a later date.
    A brief run down, at the moment, a user can generate a list of email addresses to filter the corpus with, these are then inserted (via Java) into the table Sender. These addresses are then used in an IF statement, however they are only used if the table sender is populated. The messges that are identified as threads have their Message ID inserted into another table but they also have their values printed to the DBMS output.
    QUESTION:
    What I need help with is although the values print out to the DBMS Output after a great deal of time, normally after the DBMS buffer has maxed out (thus the statement ends in error). The values printed are not inserted into the table.
    Any help on solving this or optimising if would be greatly appreciated, I'm new to PL/SQL i'm afraid so it's probably a really messy statement.
    If this is a badly worded question and I need to supply more information then I gladly will, however i'm not 100% on what information is relevant at the moment.
    Below is the statement in question.
    Thanks and Regards,
    K
    LOOP
    IF sender_cur1%FOUND THEN
    IF sub_One = Sub_two and sub_One_MID != sub_Two_MID and Sub_One_Sender = send_user_cur THEN
    INSERT INTO MATCHING_SUB (MID) VALUES (sub_Two_MID);
    dbms_output.put_line('MID is: ' || sub_Two_MID);
    END IF;
    ELSE
    IF sub_One = Sub_two and sub_One_MID != sub_Two_MID THEN
    INSERT INTO MATCHING_SUB (MID) VALUES (sub_Two_MID);
    dbms_output.put_line('MID is: ' || sub_Two_MID);
    END IF;
    END IF;
    Edited by: user8967525 on 01-Mar-2010 07:27
    Edited by: user8967525 on 01-Mar-2010 08:08

    cd,
    I will most certainly try.
    I have a table of emails that I am attempting to thread by means of comparing the subjects together (for now). However ultimately I want to be able to bring in the recipients as well. However this can be ignored for now.
    The main variables from the Messages table are:
    MID(number) - 0 - 245000
    SENDER(VARCHAR) - Email Address
    SUBJECT_CLN6 - VARCAHR - Cleaned email subject.
    I am creating two instancs of a cursor that contains the subjects and MID's from Messages. I am then looping through cur1 comparing the value against all values in cur2, this continues until all values in cur1 have been compared against cur2. I use the MID to ensure that I am not comparing the same Message. Furthermore I am also filtering the Emails by Sender (if the table has been populated by the user, via a java applet, otherwise if just uses the subject). The variable Send_User_Cur takes takes its values from the Table called Sender, whilst sub_one_sender takes its values from the column Sender in Messages.
    The proposed output of this at the moment is to just have the MID's (and later all the relevant columns, however just for now MID) of all the threaded emails, inserted into the table MATCH_THREAD, such that they can be called upon later for further processing and most likely called from a java applet at some point as well.
    I've pasted the entire code below. I understand that it looks a bit messy on the preview and for that I apologise.
    Thanks all!
    Kev
    DECLARE
    CURSOR sub_cur1 IS
    SELECT MID, Sender, trim(subject_cln6) from MESSAGES;
    sub_One MESSAGES.subject_cln6%TYPE;
    sub_One_MID MESSAGES.MID%type;
    sub_One_Sender MESSAGES.SENDER%type;
    CURSOR sub_cur2 IS
    SELECT MID, trim(subject_cln6) from Messages;
    sub_Two MESSAGES.subject_cln6%TYPE;
    sub_Two_MID MESSAGES.MID%type;
    CURSOR sender_cur1 IS
    SELECT SENDER_ID FROM SENDER;
    Send_User_Cur SENDER.SENDER_ID%type;
    counter number := 0;
    MID_t MESSAGES.MID%TYPE;
    i number := 0;
    j number := 0;
    BEGIN
    SELECT count(subject) INTO counter
    FROM MESSAGES;
    OPEN sub_cur1;
    OPEN sub_cur2;
    OPEN sender_cur1;
    FETCH sub_cur1 INTO sub_One_MID, Sub_One_Sender, Sub_One;
    FETCH sender_cur1 INTO Send_User_Cur;
    WHILE sub_cur1%FOUND
    LOOP
    IF sub_cur2%ISOPEN THEN
    FETCH sub_cur2 INTO sub_Two_MID, SUB_Two;
    dbms_output.put_line('OPEN');
    ELSE
    OPEN sub_cur2;
    FETCH sub_cur2 INTO sub_Two_MID, SUB_Two;
    --dbms_output.put_line('OPENED and FETCHED');
    END IF;
    LOOP
    IF sender_cur1%FOUND THEN
    IF sub_One = Sub_two and sub_One_MID != sub_Two_MID and Sub_One_Sender = send_user_cur THEN
    INSERT INTO MATCH_THREAD (MID) VALUES (sub_Two_MID);
    commit;
    END IF;
    ELSE
    IF sub_One = Sub_two and sub_One_MID != sub_Two_MID THEN
    INSERT INTO MATCH_THREAD (MID) VALUES (sub_Two_MID);
    commit;
    END IF;
    END IF;
    FETCH sub_cur2 INTO sub_Two_MID, SUB_Two;
    i := i + 1;
    EXIT WHEN i = counter;
    END LOOP;
    CLOSE sub_cur2;
    FETCH sub_cur1 INTO sub_One_MID, Sub_One_Sender, SUB_One;
    i := 0;
    dbms_output.put_line('sub_One_MID: ' || sub_one_mid);
    END LOOP;
    CLOSE sub_cur1;
    CLOSE sub_cur2;
    END;

  • Connecting to SQL Server on Windows 8 from WindowsCE

    Hello,
    I need to make a connection to SQLServer 2008 which is on my developer machine, later it will be SQL Server on some production machine from .Net Compact Framework developed app on WindowsCE.
    When I using local sdf file I use SqlCeConnection for DB connection but how to connect from same app local SQL Compact databse and SQL Server on some server.
    Thanks in advance...

    Related blog: How to connect to SQL Server from a Windows Mobile Emulator
    Forum thread:
    Windows mobile connect with sql server 2008 r2
    Kalman Toth Database & OLAP Architect
    Free T-SQL Scripts
    New Book / Kindle: Exam 70-461 Bootcamp: Querying Microsoft SQL Server 2012

  • Read value from text file to JTextField

    Hi,
    I think this is the right place to post this. Although maybe it is not it could be classed as I/O issues?
    I have a JFrame with a JTextField which requires the user to enter a value. When they click a JButton "OK". It writes the value to a text file and closes the frame using FileWriter. If they click clear button it writes the value "" to the file. What I want to do is when the frame opens it reads the value from the text file. I have been trying to use FileReader but have not been able to write the code correctly. Any help would be greatly appreciated.
    Thanks

    File f = yourfile;
    BufferedReader br = new BufferedReader(new FileReader(f));
    String value = br.readLine();Alex.

  • SQL Server Notification Services Removed from SQL Server 2008

    It comes as no surprise to us that 2008 will not be supporting notification services.  Several years ago our company developed our product line of alerting applications and gave some long and serious thought into using SQL Notification services. 
    Besides the fact that the NS desktop alerting component itself was rather bland/limited, (an acknowledge button, image, hyperlink) at the time it just made no sense to create a core component of the business plan around such a 3rd party dependent widget. 
    While a look at this MS page shows only a few companies who have built alerting systems around NS,
    http://www.microsoft.com/sql/technologies/notification/partners/appsoftware.mspx
    ….there is actually quite a few companies who have done this and must now consider a total rewrite of their alert system.
    Quite frankly, looking forward at MS's new family of Communications servers,
    http://msdn2.microsoft.com/en-us/office/aa905499.aspx
    I am not sure that things are changing much.
    "Welcome to the Microsoft Office Live Communications Server developers' home on MSDN. Live Communications Server 2005 provides your business with an enterprise-ready instant messaging, presence awareness, and an extensible platform that connects people, information, and business processes—enabling better decisions faster."
    Remember this?
    MSN Buys MessageCast for Real-Time Alerts
    http://www.eweek.com/c/a/Messaging-and-Collaboration/MSN-Buys-MessageCast-for-RealTime-Alerts/
    MessageCast was a serious product on the up.  They sold out and poof.  The whole fiasco was a joke.
    As it pertains to alerting platforms, the good call just may be having a architecture that is somewhat autonomous ( i.e.  Ok, perhaps Windows OS, .Net Framework and SQL Server as prerequisites is ok) to MS embedded components and not reliant on “Live Server" licenses.  Seems like just a better bet hands down all day long.
    I can tell you that about 5% of all alerts our clients create are sent to inform end users “Exchange is Down”.  It’s hard to get a OutLook Desktop Alert when Exchange is down.
    So, an alert system designed from scratch in-house (the hard way) may just be the heads up alert your customer needs to see.  If for nothing else, you can control your products destiny….unless of course MS Windows is made obsolete.  <wink>  Unlikely.  Hey....without MS products, we would not be in business.  They make some of the best software in the world.  But that does not mean your campany is not capable of the same.

    I'm coming to the discussion of the fate of Notification Services a bit late as it is now December. It is my view that Microsoft should rethink its position on Notification Services, and should continue to support and evolve it until such time as it might be migrated to the future "alerting" solution Microsoft devises for at least the following 2 reasons:
    (1) Notification Services addresses an enterprise application integration need complementary to Microsoft's web service strategy. This is a place Microsoft has not gone before, but needs to go. Why? EAI vendors won't modify their infrastructure to make them web service oriented ... they can't because it is legacy. Instead, they try to buy something and attach it to legacy ... but that doesn't work too well. Microsoft already has started/built greenfield. Further, Microsoft has commoditized such so that with notification services and its other .NET-based products (at least they evolve to such) a full complement of architectural components is being or has been assembled. Why would Microsoft make such an investment ... across the portfolio of server products ... and then back off of it? Microsoft has not been in the enterprise space before to the degree it has wished. It has intimated, at least, that it will be at the periphery with its variety of services and products. An integration broker is necessary for success at the periphery, and it provides a bridge to the enterprise back office that has the property of loose coupling, which is both good for Microsoft and its clients. 
    (2) Microsoft claims to be working to develop a server platform suitable to provision notification services. This server platform could be productized as Microsoft intends, and then notification services could be made to work on that platform and then it could be open sourced. If Microsoft intends to provide a kind of application server foundation that would make it possible for non-Microsoft development teams to build out services on a Microsoft stack that can be hosted with the same set of services as, say, IIS, Biztalk, SQL Server, etc., then it seems that Notification Services could easily be migrated to this server framework once such is ready for prime time. Functional expansion of such could be accomplished by an open source community if Microsoft chooses to not further extend it on its own dime ... maybe even on its own nickel.
    I've read some of the reasons justifying Microsoft's rationale to discontinue its Notification Services product line. One was that not many people used it. Blogs have listed a number of companies that have used it. The number may not be to the scale Microsoft would like ... one could look at Biztalk and suggest that Workflow Foundation represents Microsoft's belief that Biztalk too should be deprecated. Maybe so. But the strategy Microsoft is taking with workflow does not drop support for a core architectural capability. Why not keep Notification Services and give people time to learn how to architect in enterprise fashion with Microsoft infrastructure? Why not use it to seed an open source community? It probably costs you little ... and you have an open source community option that could get Microsoft further into an enterprise than it has previously been ... right into the middle ... leveraging Microsoft web service innovations in spades at substantially less cost than traditional EAI vendors, IBM, and other competitors could afford. People have to learn how to use Microsoft products in an enterprise context ... aside from specialized applications and OS vmware, what products have you put out that systematize infrastructure?
    I've also heard that Microsoft is considering incorporation of Notification Services as part of Reporting Services. Please pardon me but that seems ack basswards ... events are not reports, but reports could be events if you view reports as correlations over critical business activities instead of some statically produced bit of information to be shoved off into someone's mailbox or file system or even web site. Reports are static. Events are part of a dynamic and learning enterprise platform. Isn't that what you're attempting to build infrastructure for? Isn't that exactly what Microsoft needs to secure its position at the back of an enterprise just as it has the front?
    Please reconsider your position. And please contact me at tommy  at zipa dot deedoodah dot com to discuss. I'm as opinionated as everyone else, and I think you have a good product here that you're throwing away. If you don't want it, I will take it ...
    Sincerely,
    Tom Winans

Maybe you are looking for

  • What's the best way to organize media in iTunes?

    I have a new Mac Mini running my iTunes.  I have over 80GB of songs and I have them stored on an outboard 1TB drive (a laCie rugged). Since I installed my new Mac Mini, iTunes has automatically moved my media, so that I seem now to have folders with

  • Need more information regarding RAW JPEG pairs

    I understand the importing of RAW+JPEG pair options. What I am having difficulty finding in any forum or user manual is the workflow using such pairs after the import. If I import a R+J pair with RAW as original, there is an "R" icon in the viewer on

  • Mapviewer Java Class Documentation

    Is the Mapviewer java clase documented anywhere? TIA

  • How to find the moving average for perticular time step for same time series

    Hello everyone, I am new in labview and I have one issue. I have a huge text file with the different pressure value of  different ports. I make the VI in which first I read the text file and identify the perticular port column. In that column there a

  • Problem installing Itunes. (error 2352)

    I have a problem installing Itunes. :S When i try to install it, an error pops up saying that there is an error 2352. Please help ASAP Computer: eMachines T1742 thanks!