How to use auto increment with "nchar" data type

Hello
I have a table that I want the value in one column to be generated automatically with "T-XXX" pattern which
"XXX" is a number. Can Microsoft SQL Server do that?

Hello,
Not directly.
You could use an integer column with "Identity" and then add a calculated column to generate the required pattern, like
'T' + convert(varchar, YourIntColumn)
Olaf Helper
[ Blog] [ Xing] [ MVP]

Similar Messages

  • How to use INVOKE function with INT parameter types

    Can you tell me how to use invoke function with int parameter type ?

    Pass the int as an Integer.

  • How to use a queue with dynamic data

    When using a collector I have found that it significantly slows down my loop times. I am using LabView7.1 on a Dell PC with Windows XP.  If I use a queue with dynamic data do you think that will require less of my processor and allow for faster loop speeds?
    I have created a queue using dynamic data in one loop and I want to retrieve all available samples each iteration in a slower loop. If I use the flush queue I get a 1d array of dynamic data. What is the best way to convert the 1d array of dynamic data so that the array of dynamic data is consolidated back into a single dynamic data type? Any help would be much appreciated.

    Hi Dennis,
    You could for instance wire the array to an auto-indexed for loop. I attach an example. I assume you wish to concatenate the arrays a singel waveform.
    Hope it helps,
    Pelle S
    District Sales Manager
    National Instruments Sweden
    Attachments:
    Dynamic queue.vi ‏245 KB

  • How to use "Auto increment" in temp table Oracle

    Pleas tell me yaar,
    In MS Sql for Auto increment i am using like this "seqid int identity" for temp table
    t_seq_tbl table(seqid int identity,EVENT_SEQ_NO varchar(30))
    In oracle how to use....

    As far as I know there is not any auto increment data type in Oracle. Instead of this you should create a sequence and get the next value of the sequence while creating a row in your table.
    CREATE SEQUENCE Test_Sequence ;
    CREATE TABLE Test_Table ( Id NUMBER , Foo VARCHAR2(4) ) ;
    ALTER TABLE Test_Table ADD CONSTRAINT Test_Table_PK_Id PRIMARY KEY ( Id ) ;
    INSERT INTO Test_Table ( Id , Information ) VALUES ( Test_Sequence.NEXTVAL , 'FOO' ) ;

  • How to use auto incremented tabe to create a CMP Entity Bean

    hi,
    I want create a CMP entitybean with an auto incremented table in
    Oracel. So I need to know
    - how to create a table with an auto-incremented field in oracel and
    - how to change the create() method according to that.
    I am using Sun studio enterprise for EJB developing.
    kaushalya

    For auto increment in Oracle you should use Sequence/Trigger combination.
    And useful thread from EJB forum:
    http://forum.java.sun.com/thread.jspa?forumID=13&threadID=478783

  • How to use auto-increment and search option for MS Access DB

    Dear All,
               I have configured our invoice in Adobe Livecycle and connected it to MS Acess 2007 as per http://forms.stefcameron.com/2006/09/18/connecting-a-form-to-a-database/.
    All is working fine, I can insert, retrieve data from DB to invoice and vice versa.
    Now I want few things to be implemented on our invoice.
    When ever I open our invoice, it populate the first entry from DB, Is it possible to populate the last entry ?
    Auto increment invoice number from MS Access DB every time we open our invoice after save.
    How to implement search option from DB for invoice number ?
    Please let me know if someone can provide me help on my scenario, so that I can share more stuff related to invoice and DB.
    Look forward to hearing soon from experts and other team members.
    Thanks & Regards
    Riyad...

    As far as I know there is not any auto increment data type in Oracle. Instead of this you should create a sequence and get the next value of the sequence while creating a row in your table.
    CREATE SEQUENCE Test_Sequence ;
    CREATE TABLE Test_Table ( Id NUMBER , Foo VARCHAR2(4) ) ;
    ALTER TABLE Test_Table ADD CONSTRAINT Test_Table_PK_Id PRIMARY KEY ( Id ) ;
    INSERT INTO Test_Table ( Id , Information ) VALUES ( Test_Sequence.NEXTVAL , 'FOO' ) ;

  • How to use auto numbering with ENG_ECO_PUB.PROCESS_ECO (EBS version 12.1.1)

    Hi All,
    I'm trying to create a new ECO using the PL/SQL API "ENG_ECO_PUB.PROCESS_ECO". I want the ECO name to be automatically assigned by the system but when leaving the ECO_NAME empty (in paramter P_ECO_REC) I get the error message:
    "You must enter an ECO name and organization because they are the primary identifiers of a business object. Please ensure that these values exist in all your records and re-run the import process."
    I have set the profile option "ENG: Change Order Autonumbering - System Administrator access" to yes.
    I have set following fields in P_ECO_REC:
    p_eco_rec.organization_code := 'V1';
    p_eco_rec.change_type_code := 'ECO';
    p_eco_rec.description := 'Test';
    p_eco_rec.transaction_type := 'CREATE';
    p_eco_rec.plm_or_erp_change := 'ERP'; -- also tried with 'PLM'
    p_eco_rec.approval_status_name := 'Approved';
    Do I need to set anything else?
    Thanks,
    Carolin

    Hi Helios,
    thanks for reply.
    I checked note 1242524.1, but there's no advice what to configure for using auto numbering.
    I tried it again with adapted sample code and leaving the ECO_NAME empty:
    DECLARE
    -- API Input variables
    l_eco_name VARCHAR2(9) := '';
    l_org_code VARCHAR2(3) := 'V1';
    l_rev_item_number VARCHAR2(20):= 'CS_Test_Assem_10';
    l_eff_date DATE := '8-SEP-2011';
    l_new_revised_item_revision VARCHAR2(2) := 'A';
    l_eco_rec Eng_Eco_Pub.Eco_Rec_Type := Eng_Eco_Pub.g_miss_eco_rec;
    l_eco_revision_tbl Eng_Eco_Pub.Eco_Revision_Tbl_Type := Eng_Eco_Pub.g_miss_eco_revision_tbl;
    l_revised_item_tbl Eng_Eco_Pub.Revised_Item_Tbl_Type := Eng_Eco_Pub.g_miss_revised_item_tbl;
    l_rev_component_tbl Bom_Bo_Pub.Rev_Component_Tbl_Type := Eng_Eco_Pub.g_miss_rev_component_tbl;
    l_sub_component_tbl Bom_Bo_Pub.Sub_Component_Tbl_Type := Eng_Eco_Pub.g_miss_sub_component_tbl;
    l_ref_designator_tbl Bom_Bo_Pub.Ref_Designator_Tbl_Type := Eng_Eco_Pub.g_miss_ref_designator_tbl;
    l_rev_operation_tbl Bom_Rtg_Pub.Rev_Operation_Tbl_Type := Eng_Eco_Pub.g_miss_rev_operation_tbl;
    l_rev_op_resource_tbl Bom_Rtg_Pub.Rev_Op_Resource_Tbl_Type := Eng_Eco_Pub.g_miss_rev_op_resource_tbl;
    l_rev_sub_resource_tbl Bom_Rtg_Pub.Rev_Sub_Resource_Tbl_Type := Eng_Eco_Pub.g_miss_rev_sub_resource_tbl;
    -- API output variables
    x_eco_rec Eng_Eco_Pub.Eco_Rec_Type := Eng_Eco_Pub.g_miss_eco_rec;
    x_eco_revision_tbl Eng_Eco_Pub.Eco_Revision_Tbl_Type := Eng_Eco_Pub.g_miss_eco_revision_tbl;
    x_revised_item_tbl Eng_Eco_Pub.Revised_Item_Tbl_Type := Eng_Eco_Pub.g_miss_revised_item_tbl;
    x_rev_component_tbl Bom_Bo_Pub.Rev_Component_Tbl_Type := Eng_Eco_Pub.g_miss_rev_component_tbl;
    x_sub_component_tbl Bom_Bo_Pub.Sub_Component_Tbl_Type := Eng_Eco_Pub.g_miss_sub_component_tbl;
    x_ref_designator_tbl Bom_Bo_Pub.Ref_Designator_Tbl_Type := Eng_Eco_Pub.g_miss_ref_designator_tbl;
    x_rev_operation_tbl Bom_Rtg_Pub.Rev_Operation_Tbl_Type := Eng_Eco_Pub.g_miss_rev_operation_tbl;
    x_rev_op_resource_tbl Bom_Rtg_Pub.Rev_Op_Resource_Tbl_Type := Eng_Eco_Pub.g_miss_rev_op_resource_tbl;
    x_rev_sub_resource_tbl Bom_Rtg_Pub.Rev_Sub_Resource_Tbl_Type := Eng_Eco_Pub.g_miss_rev_sub_resource_tbl;
    -- Other API variables for return status / error handling / debugging
    l_error_table Error_Handler.Error_Tbl_Type;
    l_return_status VARCHAR2(1) := NULL;
    l_msg_count NUMBER := 0;
    l_output_dir VARCHAR2(500) := 'C:\temp';
    l_debug_filename VARCHAR2(60) := 'su_debug_10_15.dbg';
    -- WHO columns
    l_user_id          NUMBER := -1;
    l_resp_id          NUMBER := -1;
    l_application_id     NUMBER := -1;
    l_row_cnt          NUMBER := 1;
    l_user_name          VARCHAR2(30) := 'MFG';
    l_resp_name          VARCHAR2(30) := 'MFG_AND_DIST_SUPER_USER_APS';
    BEGIN
    -- Get the user_id
    SELECT user_id
    INTO l_user_id
    FROM fnd_user
    WHERE user_name = l_user_name;
    -- Get the application_id and responsibility_id
    SELECT application_id, responsibility_id
    INTO l_application_id, l_resp_id
    FROM fnd_responsibility
    WHERE responsibility_key = l_resp_name;
    FND_GLOBAL.APPS_INITIALIZE(l_user_id, l_resp_id, l_application_id); -- Mfg / Mfg & Dist Mgr / INV
    dbms_output.put_line('Initialized applications context: '|| l_user_id || ' '|| l_resp_id ||' '|| l_application_id );
    Error_Handler.Initialize;
    l_return_status := NULL;
    l_eco_rec.eco_name := l_eco_name;
    l_eco_rec.organization_code := l_org_code;
    l_eco_rec.change_type_code := 'ECO';
    l_eco_rec.eco_department_name := NULL;
    l_eco_rec.priority_code := NULL; --'Medium';
    l_eco_rec.approval_list_name := NULL; --'SU_ONLY';
    l_eco_rec.reason_code := NULL;
    l_eco_rec.Approval_Status_Name:= 'Approved'; -- will default to Not submitted for Approval
    l_eco_rec.Status_Name := 'Open';
    l_eco_rec.description := 'ECO - '||l_eco_rec.eco_name||' API Test';
    l_eco_rec.transaction_type := 'CREATE';
    l_eco_rec.plm_or_erp_change := 'ERP'; -- or 'PLM'
    l_eco_rec.return_status := NULL;
    dbms_output.put_line('Initialized ECO Header');
    l_revised_item_tbl(l_row_cnt).eco_name := l_eco_name;
    l_revised_item_tbl(l_row_cnt).organization_code := l_org_code;
    l_revised_item_tbl(l_row_cnt).revised_item_name := l_rev_item_number;
    l_revised_item_tbl(l_row_cnt).new_revised_item_revision := l_new_revised_item_revision;
    l_revised_item_tbl(l_row_cnt).start_effective_date := l_eff_date;
    l_revised_item_tbl(l_row_cnt).alternate_bom_code := NULL;
    l_revised_item_tbl(l_row_cnt).status_type := 1; -- 'Open'
    l_revised_item_tbl(l_row_cnt).change_description := 'Test';
    l_revised_item_tbl(l_row_cnt).transaction_type := 'CREATE'; -- transaction type : CREATE / UPDATE
    dbms_output.put_line('Initialized ECO revised items');
    -- Add RS_BOM_C3, acd_type = 1
    l_rev_component_tbl(l_row_cnt).eco_name := l_eco_name;
    l_rev_component_tbl(l_row_cnt).organization_code:= l_org_code;
    l_rev_component_tbl(l_row_cnt).revised_item_name := l_rev_item_number;
    l_rev_component_tbl(l_row_cnt).new_revised_item_revision := l_new_revised_item_revision;
    l_rev_component_tbl(l_row_cnt).start_effective_date := l_eff_date;
    l_rev_component_tbl(l_row_cnt).operation_sequence_number := 1;
    l_rev_component_tbl(l_row_cnt).component_item_name := 'CS_Sub_Item_10_D'; -- Add RS_BOM_C3
    l_rev_component_tbl(l_row_cnt).alternate_bom_code := NULL;
    l_rev_component_tbl(l_row_cnt).acd_type := 1;
    l_rev_component_tbl(l_row_cnt).item_sequence_number := 40; -- new item sequence number
    l_rev_component_tbl(l_row_cnt).quantity_per_assembly := 5;
    l_rev_component_tbl(l_row_cnt).transaction_type := 'CREATE'; -- transaction type : CREATE / UPDATE
    -- Change RS_BOM_C1, acd_type = 2
    l_row_cnt := l_row_cnt + 1;
    l_rev_component_tbl(l_row_cnt).eco_name := l_eco_name;
    l_rev_component_tbl(l_row_cnt).organization_code:= l_org_code;
    l_rev_component_tbl(l_row_cnt).revised_item_name := l_rev_item_number;
    l_rev_component_tbl(l_row_cnt).new_revised_item_revision := l_new_revised_item_revision;
    l_rev_component_tbl(l_row_cnt).start_effective_date := l_eff_date; -- effective date
    l_rev_component_tbl(l_row_cnt).operation_sequence_number := 1;
    l_rev_component_tbl(l_row_cnt).component_item_name := 'CS_Sub_Item_10_B'; -- Change qty for RS_BOM_C1
    l_rev_component_tbl(l_row_cnt).alternate_bom_code := NULL;
    l_rev_component_tbl(l_row_cnt).acd_type := 2;
    l_rev_component_tbl(l_row_cnt).old_effectivity_date := to_date('29-APR-2011 10:09:38', 'dd-MON-yyyy hh24:mi:ss'); -- old effectivity date from bill
    l_rev_component_tbl(l_row_cnt).old_operation_sequence_number := 1; -- old operation sequence number from bill
    l_rev_component_tbl(l_row_cnt).item_sequence_number := 20;
    l_rev_component_tbl(l_row_cnt).quantity_per_assembly := 5; -- existing comp qty on Bill = 2
    l_rev_component_tbl(l_row_cnt).transaction_type := 'CREATE'; -- transaction type : CREATE / UPDATE
    -- Disable RS_BOM_C2, acd_type = 3
    l_row_cnt := l_row_cnt + 1;
    l_rev_component_tbl(l_row_cnt).eco_name := l_eco_name;
    l_rev_component_tbl(l_row_cnt).organization_code:= l_org_code;
    l_rev_component_tbl(l_row_cnt).revised_item_name := l_rev_item_number;
    l_rev_component_tbl(l_row_cnt).new_revised_item_revision := l_new_revised_item_revision;
    l_rev_component_tbl(l_row_cnt).start_effective_date := l_eff_date;
    l_rev_component_tbl(l_row_cnt).disable_date := l_eff_date + 2; -- disable date is 2 day from effective_date
    l_rev_component_tbl(l_row_cnt).operation_sequence_number := 1;
    l_rev_component_tbl(l_row_cnt).component_item_name := 'CS_Sub_Item_10_C'; -- disable RS_BOM_C2
    l_rev_component_tbl(l_row_cnt).alternate_bom_code := NULL;
    l_rev_component_tbl(l_row_cnt).acd_type := 3;
    l_rev_component_tbl(l_row_cnt).old_effectivity_date := to_date('29-APR-2011 10:09:38', 'dd-MON-yyyy hh24:mi:ss'); -- old effectivity date from bill
    l_rev_component_tbl(l_row_cnt).old_operation_sequence_number := 1; -- old operation sequence number from bill
    l_rev_component_tbl(l_row_cnt).transaction_type := 'CREATE'; -- transaction type : CREATE / UPDATE
    dbms_output.put_line('Initialized ECO revised components');
    -- call API to create eco
    DBMS_OUTPUT.PUT_LINE('=======================================================');
    DBMS_OUTPUT.PUT_LINE('Calling Eng_Eco_PUB.Process_Eco API');
    Eng_Eco_PUB.Process_Eco( p_api_version_number => 1.0
    , p_init_msg_list => TRUE
    , x_return_status => l_return_status
    , x_msg_count => l_msg_count
    , p_bo_identifier => 'ECO'
    , p_eco_rec => l_eco_rec
    , p_eco_revision_tbl => l_eco_revision_tbl
    , p_revised_item_tbl => l_revised_item_tbl
    , p_rev_component_tbl => l_rev_component_tbl
    , p_ref_designator_tbl => l_ref_designator_tbl
    , p_sub_component_tbl => l_sub_component_tbl
    , p_rev_operation_tbl => l_rev_operation_tbl
    , p_rev_op_resource_tbl => l_rev_op_resource_tbl
    , p_rev_sub_resource_tbl => l_rev_sub_resource_tbl
    , x_eco_rec => x_eco_rec
    , x_eco_revision_tbl => x_eco_revision_tbl
    , x_revised_item_tbl => x_revised_item_tbl
    , x_rev_component_tbl => x_rev_component_tbl
    , x_ref_designator_tbl => x_ref_designator_tbl
    , x_sub_component_tbl => x_sub_component_tbl
    , x_rev_operation_tbl => x_rev_operation_tbl
    , x_rev_op_resource_tbl => x_rev_op_resource_tbl
    , x_rev_sub_resource_tbl => x_rev_sub_resource_tbl
    , p_debug => 'Y'
    , p_output_dir => l_output_dir
    , p_debug_filename => l_debug_filename
    dbms_output.put_line('x_eco_rec.eco_name:'|| x_eco_rec.eco_name );
    dbms_output.put_line('x_eco_rec.org_code:'|| x_eco_rec.organization_code);
    DBMS_OUTPUT.PUT_LINE('=======================================================');
    DBMS_OUTPUT.PUT_LINE('Return Status: '||l_return_status);
    IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
    dbms_output.put_line('x_msg_count:' || l_msg_count);
    Error_Handler.GET_MESSAGE_LIST(x_message_list => l_error_table);
    DBMS_OUTPUT.PUT_LINE('Error Message Count :'||l_error_table.COUNT);
    FOR i IN 1..l_error_table.COUNT LOOP
    DBMS_OUTPUT.PUT_LINE(to_char(i)||':'||l_error_table(i).entity_index||':'||l_error_table(i).table_name);
    DBMS_OUTPUT.PUT_LINE(to_char(i)||':'||l_error_table(i).message_text);
    END LOOP;
    END IF;
    DBMS_OUTPUT.PUT_LINE('=======================================================');
    EXCEPTION
    WHEN OTHERS THEN
    DBMS_OUTPUT.PUT_LINE('Exception Occured :');
    DBMS_OUTPUT.PUT_LINE(SQLCODE ||':'||SQLERRM);
    DBMS_OUTPUT.PUT_LINE('=======================================================');
    RAISE;
    END;
    But with this example I again get same error message...
    Any idea?
    Thanks,
    Carolin

  • How to add a UDF with picture data type by using metadata object?

    Hi guys,
    does anybody have a clue on how to code user fields metadata object (via VB6) in order to add a picture type field? I can't find the enum number for this data type in the DI help file.
    Best Regards,
    Oki

    Hi,
    The field type should be BoFieldTypes.db_Alpha , and the subtype BoFldSubTypes.st_Image .
    And it is in the DI documentation (look at the SubType property).
    Regards,
    Ibai Peñ

  • How to use Bind Variables in Essbase data control

    Hi,
    I am trying to use Bind Variables in MDX query while creating the Essbase Data Control. I have used the below query with the Bind Variable.. this query is working in Essbase admin console..but it is throwing error (*Invalid MDX Query)* while creating Essbase Datacontrol in JDeveloper.
    MDX Query : SELECT {[Measures].Msr_2} ON COLUMNS, [Time].Children ON ROWS FROM cube
    where ($name)
    Could any body suggest me on how to use bind variables with Essbase Data control.
    Thanks,
    Swathi

    Hello Swathi, can you please help me how you created Essbase DataControl? Also were you able to figure out this?
    Thanks, Praveen.

  • How to use TRUNC function with dates in Expression Builder in OBIEE.

    Hi There,
    How to use TRUNC function with dates in Expression Builder in OBIEE.
    TRUNC (SYSDATE, 'MM') returns '07/01/2010' where sysdate is '07/15/2010' in SQL. I need to use the same thing in expression builder in BMM layer logical column.
    Thanks in advance

    use this instead:
    TIMESTAMPADD(SQL_TSI_DAY, ( DAYOFMONTH(CURRENT_DATE) * -1) + 1, CURRENT_DATE)

  • How to use Oracle partitioning with JPA @OneToOne reference?

    Hi!
    A little bit late in the project we have realized that we need to use Oracle partitioning both for performance and admin of the data. (Partitioning by range (month) and after a year we will move the oldest month of data to an archive db)
    We have an object model with an main/root entity "Trans" with @OneToMany and @OneToOne relationships.
    How do we use Oracle partitioning on the @OneToOne relationships?
    (We'd rather not change the model as we already have millions of rows in the db.)
    On the main entity "Trans" we use: partition by range (month) on a date column.
    And on all @OneToMany we use: partition by reference (as they have a primary-foreign key relationship).
    But for the @OneToOne key for the referenced object, the key is placed in the main/source object as the example below:
    @Entity
    public class Employee {
    @Id
    @Column(name="EMP_ID")
    private long id;
    @OneToOne(fetch=FetchType.LAZY)
    @JoinColumn(name="ADDRESS_ID")
    private Address address;
    EMPLOYEE (table)
    EMP_ID FIRSTNAME LASTNAME SALARY ADDRESS_ID
    1 Bob Way 50000 6
    2 Sarah Smith 60000 7
    ADDRESS (table)
    ADDRESS_ID STREET CITY PROVINCE COUNTRY P_CODE
    6 17 Bank St Ottawa ON Canada K2H7Z5
    7 22 Main St Toronto ON Canada     L5H2D5
    From the Oracle documentation: "Reference partitioning allows the partitioning of two tables related to one another by referential constraints. The partitioning key is resolved through an existing parent-child relationship, enforced by enabled and active primary key and foreign key constraints."
    How can we use "partition by reference" on @OneToOne relationsships or are there other solutions?
    Thanks for any advice.
    /Mats

    Crospost! How to use Oracle partitioning with JPA @OneToOne reference?

  • How to use my itunes with a new pc

    how to use my itunes with a new pc?

    These are two possible approaches that will normally work to move an existing library to a new computer.
    Method 1
    Backup the library with this User Tip.
    Deauthorize the old computer if you no longer want to access protected content on it.
    Restore the backup to your new computer using the same tool used to back it up.
    Keep your backup up-to-date in future.
    Method 2
    Connect the two computers to the same network. Share your <User's Music> folder from the old computer and copy the entire iTunes library folder into the <User's Music> folder on the new one. Again, deauthorize the old computer if no longer required.
    Both methods should give the new computer a working clone of the library that was on the old one. As far as iTunes is concerned this is still the "home" library for your devices so you shouldn't have any issues with iTunes wanting to erase and reload.
    I'd recommend method 1 since it establishes an ongoing backup for your library.
    If you have an iOS device that syncs with contact & calendar data on your computer you should migrate this information too. If that isn't possible create a dummy entry of each type in your new profile and iTunes should offer to merge the existing data from the device into the computer, otherwise the danger is that it will wipe the information from the device.
    If your media folder has been split out from the main iTunes folder you may need to do some preparatory work to make it easier to move. See make a split library portable.
    Should you be in the unfortunate position where you are no longer able to access your original library, or a backup of it, then see Recover your iTunes library from your iPod or iOS device for advice on how to set up your devices with a new library with the maximum preservation of data. If you don't have any Apple devices then see HT2519 - Downloading past purchases from the App Store, iBookstore, and iTunes Store.
    tt2

  • How to insert data in a column with uniqueidefier data type

    Guys,
    I need insert data in a column with uniqueidefier data type, when i am trying to that getting error.
    error message says: "Conversion failed when converting from a character string to uniqueidentifier."
    I have data in table a col1,col2,col3,col4 - col3,col4 has datatype as varchar and i am updating table b columns col1,col2 with table a col3 and col4.
    Please guide how to do it.

    Hi,
    Not any String can be convert to uniqueidentifier.
    1. you have to make sure u use a value which is fir to be uniqueidentifier
    2. Use convert or cast in the insert query in order to convert the string into uniqueidentifier
    insert X ... convert(uniqueidentifier, 'string which fit to be convert to uniqueidentifier')
    Please post DDL+DML for more specific help
    DDL = Data Definition Language. In our case that is, CREATE TABLE statements for your tables and other definitions that are needed to understand your tables structure and there for let us to test and reproduce the problem in our server. Without DDL no one
    can execute any query.
    How to get DDL: Right click on the table in Object Explorer and select script table as CREATE. Post these create table scripts here.
    DML = data manipulation language is a family of queries used for manipulating the data it self like: inserting, deleting and updating data. In our case we need some sample data in order to check the query and get result, so we need some indert query for
    sample data.
    If you post a "create query" for the tables and "insert query" with some sample, then we could help you without Assuming/Guessing. There is a reason that DDL is generally asked for and expected when discussing query problems - it helps
    to identify issues, clarify terminology and prevent incorrect assumptions.  Sample data also provides a common point of reference for the discussion. A script that can be used to illustrate or reproduce the issue you have, will encourage others to help.
    [Personal Site] [Blog] [Facebook]

  • How to use union statement with declare & set function?

    Hi Experts,
            i  have small query about how to use union statement with declare & set function?
    Example as below :
    DECLARE @name AS date
    Declare @name2  AS date
    /* SELECT FROM [2013].[dbo].[OINV] T0 */
    /* WHERE */
    SET @name = /* T0.DocDate */ '[%1]'
    SET @name2 = /* T0.DocDate */ '[%2]'
    select  '2013',t5.U_salmannm,t1.CardName,t2.sumapplied as CollectionAmount,t2.DcntSum ,t3.DocTotal as InvoiceTotal,
    datediff(dd,t3.DocDate,t1.Docdate) as Days
    from 2013.dbo.orct t1
    inner join 2013.dbo.RCT2 t2 on t1.DocNum = t2.DocNum
    left join 2013.dbo.oinv t3 on
    t3.docentry = t2.baseAbs
    inner join 2013.dbo.ocrd t4 on t1.Cardcode = t4.CardCode
    inner join [2013].[dbo].[@CQ_RTSM] t5 on t4.U_BeatCode = t5.U_RoutCode
    where t2.DcntSum <> 0.000000 and t3.DocDate between [%1] and [%2]
    Union
    /* SELECT FROM [2014].[dbo].[OINV] T0 */
    /* WHERE */
    SET @name = /* T0.DocDate */ '[%1]'
    SET @name2 = /* T0.DocDate */ '[%2]'
    select  '2014',t5.U_salmannm,t1.CardName,t2.sumapplied as CollectionAmount,t2.DcntSum ,t3.DocTotal as InvoiceTotal,
    datediff(dd,t3.DocDate,t1.Docdate) as Days
    from 2014.dbo.orct t1
    inner join 2014.dbo.RCT2 t2 on t1.DocNum = t2.DocNum
    left join 2014.dbo.oinv t3 on
    t3.docentry = t2.baseAbs
    inner join 2014.dbo.ocrd t4 on t1.Cardcode = t4.CardCode
    inner join [2014].[dbo].[@CQ_RTSM] t5 on t4.U_BeatCode = t5.U_RoutCode
    where t2.DcntSum <> 0.000000 and t3.DocDate between [%1] and [%2]

    You have to create stored procedure in SQL only .
    Like u must have create for Crystal .
    You can execute procedure in query manager but you have to enter parameter manually..
    example
    Exec @Test '20140101' '20140501'
    Every time user has to enter it manually in yyyymmdd format in case of date parameters.
    Example
    Create Proc [@Test]
    as begin
    DECLARE @name AS date
    Declare @name2  AS date
    /* SELECT FROM [2013].[dbo].[OINV] T0 */
    /* WHERE */
    select  '2013',t5.U_salmannm,t1.CardName,t2.sumapplied as CollectionAmount,t2.DcntSum ,t3.DocTotal as InvoiceTotal,
    datediff(dd,t3.DocDate,t1.Docdate) as Days
    from 2013.dbo.orct t1
    inner join 2013.dbo.RCT2 t2 on t1.DocNum = t2.DocNum
    left join 2013.dbo.oinv t3 on
    t3.docentry = t2.baseAbs
    inner join 2013.dbo.ocrd t4 on t1.Cardcode = t4.CardCode
    inner join [2013].[dbo].[@CQ_RTSM] t5 on t4.U_BeatCode = t5.U_RoutCode
    where t2.DcntSum <> 0.000000 and t3.DocDate between @Name and @Name2
    Union
    /* SELECT FROM [2014].[dbo].[OINV] T0 */
    /* WHERE */
    select  '2014',t5.U_salmannm,t1.CardName,t2.sumapplied as CollectionAmount,t2.DcntSum ,t3.DocTotal as InvoiceTotal,
    datediff(dd,t3.DocDate,t1.Docdate) as Days
    from 2014.dbo.orct t1
    inner join 2014.dbo.RCT2 t2 on t1.DocNum = t2.DocNum
    left join 2014.dbo.oinv t3 on
    t3.docentry = t2.baseAbs
    inner join 2014.dbo.ocrd t4 on t1.Cardcode = t4.CardCode
    inner join [2014].[dbo].[@CQ_RTSM] t5 on t4.U_BeatCode = t5.U_RoutCode
    where t2.DcntSum <> 0.000000 and t3.DocDate between
    between @Name and @Name2
    end

  • How to  use  Stylesheet (XSL) with JSPX ?

    Hi!
    How to use XSL stylesheets with JSPX pages?
    I want use an xsl transformations with jspx pages, I tried using the following syntax, but it didn't work....
    <?xml version='1.0' stylesheet type="text/xsl" href="mathml.xsl" encoding='UTF-8'?>
    <tr:html xmlns="http://www.w3.org/1999/xhtml">
    what is the best way to use xslt with jspx pages?
    Thanking you in advance,
    Samba

    Thanks Ric,
    But My problem is not solved..
    I'm getting the transformation working in plain HTML
    The file given below :
    <?xml-stylesheet type="text/xsl" href="mathml.xsl"?>
    <!--
    Copyright David Carlisle 2001, 2002.
    Use and distribution of this code are permitted under the terms of the <a
    href="http://www.w3.org/Consortium/Legal/copyright-software-19980720"
    W3C Software Notice and License</a>.-->
    <html xmlns="http://www.w3.org/1999/xhtml"
    >
    <head>
    <title>Content MathML Examples</title>
    </head>
    <body>
    <div style="border-style:solid; border-width:1px; margin: 1em 1em 1em 1em; padding: 1em 1em 1em 1em;color:gold;background:grey;">
    <pre><![CDATA[<math xmlns="http://www.w3.org/1998/Math/MathML">
    <apply>
    <eq/>
    <apply>
      <abs/>
      <ci> x </ci>
    </apply>
    <piecewise>
      <piece>
          <apply><minus/><ci> x </ci></apply>
          <apply><lt/><ci> x </ci> <cn> 0 </cn></apply>
      </piece>
      <piece>
          <cn> 0 </cn>
          <apply><eq/><ci> x </ci> <cn> 0 </cn></apply>
      </piece>
      <piece>
          <ci> x </ci>
          <apply><gt/><ci> x </ci> <cn> 0 </cn></apply>
      </piece>
    </piecewise>
    </apply>
    </math>]]>
    </pre>
    <math xmlns="http://www.w3.org/1998/Math/MathML">
    <apply>
    <eq/>
    <apply>
      <abs/>
      <ci> x </ci>
    </apply>
    <piecewise>
      <piece>
          <apply><minus/><ci> x </ci></apply>
          <apply><lt/><ci> x </ci> <cn> 0 </cn></apply>
      </piece>
      <piece>
          <cn> 0 </cn>
          <apply><eq/><ci> x </ci> <cn> 0 </cn></apply>
      </piece>
      <piece>
          <ci> x </ci>
          <apply><gt/><ci> x </ci> <cn> 0 </cn></apply>
      </piece>
    </piecewise>
    </apply>
    </math>
    </div>
    </body>
    </html>But the same thing is not working when put in jspx page..
    And I tried to use JSTL as you have suggested :
    But the content is not getting transformed.
    Here is the jspx page :
    <?xml version='1.0' encoding='UTF-8'?>
    <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.0"
              xmlns:h="http://java.sun.com/jsf/html"
              xmlns:f="http://java.sun.com/jsf/core"
              xmlns:af="http://xmlns.oracle.com/adf/faces/rich"
              xmlns:c="http://java.sun.com/jsp/jstl/core"
              xmlns:x="http://java.sun.com/jsp/jstl/xml"
              xmlns:m="http://www.w3.org/1998/Math/MathML"
              xmlns:xh="http://www.w3.org/1999/xhtml">
      <jsp:directive.page contentType="text/html;charset=UTF-8"/>
      <f:view>
        <af:document binding="#{backing_xsltTest.document1}" id="document1">
    <div style="border-style:solid; border-width:1px; margin: 1em 1em 1em 1em; padding: 1em 1em 1em 1em;color:gold;background:grey;">
    <f:verbatim>
    <pre><![CDATA[<math xmlns="http://www.w3.org/1998/Math/MathML">
    <apply>
    <eq/>
    <apply>
      <abs/>
      <ci> x </ci>
    </apply>
    <piecewise>
      <piece>
          <apply><minus/><ci> x </ci></apply>
          <apply><lt/><ci> x </ci> <cn> 0 </cn></apply>
      </piece>
      <piece>
          <cn> 0 </cn>
          <apply><eq/><ci> x </ci> <cn> 0 </cn></apply>
      </piece>
      <piece>
          <ci> x </ci>
          <apply><gt/><ci> x </ci> <cn> 0 </cn></apply>
      </piece>
    </piecewise>
    </apply>
    </math>]]>
    </pre>
    </f:verbatim>
    <c:import var ="mathml" url="/mathml.xsl"/>
    <x:transform  xslt="${mathml}">
    <math xmlns="http://www.w3.org/1998/Math/MathML">
    <apply>
    <eq/>
    <apply>
      <abs/>
      <ci> x </ci>
    </apply>
    <piecewise>
      <piece>
          <apply><minus/><ci> x </ci></apply>
          <apply><lt/><ci> x </ci> <cn> 0 </cn></apply>
      </piece>
      <piece>
          <cn> 0 </cn>
          <apply><eq/><ci> x </ci> <cn> 0 </cn></apply>
      </piece>
      <piece>
          <ci> x </ci>
          <apply><gt/><ci> x </ci> <cn> 0 </cn></apply>
      </piece>
    </piecewise>
    </apply>
    </math>
    </x:transform>
    </div>
          <af:form binding="#{backing_xsltTest.form1}" id="form1">
          </af:form>
        </af:document>
      </f:view>
      <!--oracle-jdev-comment:auto-binding-backing-bean-name:backing_xsltTest-->
    </jsp:root>Can you please suggest where I'm doing wrong?
    Thanking you in advance,
    Samba

Maybe you are looking for

  • Error Msg During PO creation

    Hi, How to bring the error msg if  the purchase order value exceed than the valuation price of Purchase requistion Thanks in Advance Regards, Renuga.A

  • Is there any wa to automatically cancel stopped scripts? will the "Don't ask check box do this?"

    Firefox continually hangs when scripts stop and the stop script or Cancel ( I think) option comes up. Is there any way to automagically cancel the script so Firefox can continue. This junk is usually ads or some long wait to report to some snooper.

  • Windows 7 64-bit Download

    I bought Premiere Elements 10 from a reputable online vendor, whose description said that 64-bit support was available.  The download was successful, but the installation failed because my 64-bit Windows 7 system requires different installation softw

  • Upgrading to FCP 6.0.2

    Hi, I'm in the middle of a number of different projects on Final Cut Pro 6.0.1 (I have Final Cut Studio 2) and have been given the option to upgrade to the .0.2 versions of all the relevant Final Cut Studio 2 programs. I was just wondering if this ma

  • Re: Recompiling JSP after Weblogic restart

    I tried to overcome this problem by specifying the workingDir param in           web.xml but WL6.1 keeps defaulting to the .wlnotdelete directory thus           causing a necessary recompile. Must be a bug.           Kenny           "Brian" <[email p