Primary Key for DSO (2LIS_11_VAKON)

Dear all:
I have to create a Standard DSO out of 2LIS_11_VAKON Datasource. My question is how do I define the Primary Key for this DSO...
I mean: (Doc.Number + Pos.Number) is enough?. or do I need some extra(s) field(s) in the Primary Key?
Regards.

Hi
I have to create a Standard DSO out of 2LIS_11_VAKON Datasource. My question is how do I define the Primary Key for this DSO...
I mean: (Doc.Number + Pos.Number) is enough?. or do I need some extra(s) field(s) in the Primary Key?
You can Install the Standard content You cannot Create any Standard DSO.
You can Create a customized DSO . Though the DSO is a Table There is no need of Primery Key Function here. Hope You are Talking about Data Fields and Key Fields.
But there is a Standard DSO FOR  0SD_O05 Order: Condition Data.. you can install the same.
Both fields are needed to report analytical data  based on your criteria.
http://help.sap.com/saphelp_nw70/helpdata/EN/3c/7b88408bc0bb4de10000000a1550b0/frameset.htm

Similar Messages

  • How to find the right primary key for DSO from Business Content

    According to best practice design, it is reccomended to make a  DSO where all fields from Business COntent Datasources are transferred.
    But, how to find the right primary indeks ?
    Any good suggestions ?
    For many of the Business Content dataflows there are not DSOs present, so ther e is no tip to get from the dokumentations as gfar as I have found.
    best Regards
    Ingrid

    Hi Ingrid,
    Your question will be perfect in case if you are going for a Custom cube.
    You will not have any problem when you create a Datasource in R/3 level even if it is been built on a single table or on view.
    Only point that you want to know how to design my Key fields in ODS.
    This will be purely depends at what level that you want to bring the data.
    Egg:-
    If you run the data source in RSA3 and check for Each GL if you have 10 liine items and you want all the 10 line items to be transfered to BW.
    In this case you need to check what is the unique combination of fields that is making this lineitems to exists as 10.then include all those fields into Your ODS Key Fields.
    This way you can have 10 records for that perticular GL in both sides, by which u will make sure that the data is been completely transfered.
    If in case if you clude your own Key fields then you will get the correct Total in report for each GL but you can't see all those 10 line items.
    For any case you need to figureout how many records that you want to take into BW based on that check the fields that makes it unique and then add them to ODS Keyfields that will solve your requirement.
    I think this will clear your doubt.
    Best Regards,
    VNK.

  • How to genarate Primary Key for each record in XI  Mapping

    Hi,
    I need to genarate primary key for each record in the paylod in mapping..
    Eg: if i have a 10 reacords i need to have a primary key for each record..starting with the
    Record      Primary key
    First            001
    Secound      002
    Tenth         010
    If i need to write any user defined funtion... can any one provide the code for it.
    Thanks
    Amaresh

    Hi Bavesh,
    I will explain with the example:
    XML:
    <Record 1>
    <Primary key>
    <value1>
    <value2>
    </Record 1>
    <Record 2>
    <Primary Key>
    </Record 2>
    like above i will be getting n number of recored and in each record i need  to genarate primary key in XI.and the key sould be in sequence...
    like for the first record 1 secound 2 like that primary key should add to the privous Primary key.
    and this is for each payload.
    Thanks
    Amaresh

  • Is it possible to create many primary key for a table?

    hello sir/mam.
    i am selva, i am new to abap,
    is it possible to create many primary key for a table?
    please guide me.

    Hi Selva,
    Many Primary Keys = Composite Key.
    i.e some set of columns will enable you to identify a unique row from a set of rows in the table.
    This can be achieved by checking the primary key check box in se11.
    Hope it helps.
    Regards,
    Maheswaran.B
    Message was edited by: Maheswaran B

  • How to set primary key for a date column

    hello experts .,
    i need to set primary key for a column consists of the datatype date. how to solve this..?

    1008318 wrote:
    its my personal need..then it is a very bad personal need. DATE is not an appropriate type to be using for a primary key, as it cannot be guaranteed to be unique, especially when inserting multiple rows at once.
    You would be better working to business needs and implementing correct technical solutions to those needs, than to just do things based on your personal needs.

  • No matching unique or primary key for this column-list --error

    CREATE TABLE CUSTOMER(CUS_NUM NUMBER(10) PRIMARY KEY,CUS_NAME VARCHAR2(50),ADDRESS VARCHAR2(50));
    CREATE TABLE ITEM(ITEM_NUM NUMBER(10),ITEM_DESC VARCHAR2(50),TYPE VARCHAR2(50),ITEM_STATUS VARCHAR2(50),
    CONSTRAINT PK_ITEM PRIMARY KEY(ITEM_NUM,TYPE));
    CREATE TABLE ITEM_TYPE(TYPE VARCHAR2(50) PRIMARY KEY,TYPE_NAME VARCHAR2(50),SKU VARCHAR2(50),RATING VARCHAR2(50));
    CREATE TABLE ORDERS(ORDER_NUMBER NUMBER(10),CUS_NUM NUMBER(10),ITEM_NUM NUMBER(10),ORDER_POINT VARCHAR2(50),DISPATCH_POINT VARCHAR2(50),
    PRIORITY VARCHAR2(50),ORDER_STATUS VARCHAR2(50),
    CONSTRAINT PK_ORDERS PRIMARY KEY(ORDER_NUMBER,ITEM_NUM),
    CONSTRAINT FK1_ORDERS FOREIGN KEY (CUS_NUM) REFERENCES CUSTOMER(CUS_NUM),
    CONSTRAINT FK2_ORDERS FOREIGN KEY (ITEM_NUM) REFERENCES ITEM(ITEM_NUM));
    Hi,friends i created tables as above when i creating 'ORDERS' table the error will fir as "ORA-02270: no matching unique or primary key for this column-list".
    can any body solve this issue.
    Cheers,
    Sudhir reddy.

    For your own sanity, you should learn to format your code, or use a tool to do it for you. For the sanity of the forum members, you should preserve that code using the \ tagsCREATE TABLE CUSTOMER
    CUS_NUM NUMBER(10) PRIMARY KEY,
    CUS_NAME VARCHAR2(50),
    ADDRESS VARCHAR2(50)
    CREATE TABLE ITEM
    ITEM_NUM NUMBER(10),
    ITEM_DESC VARCHAR2(50),
    TYPE VARCHAR2(50),
    TYPE is a reserved word.  Call it ITEM_TYPEITEM_STATUS VARCHAR2(50),
    CONSTRAINT PK_ITEM PRIMARY KEY(ITEM_NUM,TYPE)
    CREATE TABLE ITEM_TYPE
    TYPE VARCHAR2(50) PRIMARY KEY,
    again, with the reserved word.TYPE_NAME VARCHAR2(50),
    SKU VARCHAR2(50),
    RATING VARCHAR2(50)
    CREATE TABLE ORDERS
    ORDER_NUMBER NUMBER(10),
    be consistent.  NUM or NUMBER.  Pick one and stick with it.CUS_NUM NUMBER(10),
    ITEM_NUM NUMBER(10),
    ORDER_POINT VARCHAR2(50),
    DISPATCH_POINT VARCHAR2(50),
    PRIORITY VARCHAR2(50),
    ORDER_STATUS VARCHAR2(50),
    CONSTRAINT PK_ORDERS PRIMARY KEY(ORDER_NUMBER,ITEM_NUM),
    CONSTRAINT FK1_ORDERS FOREIGN KEY (CUS_NUM) REFERENCES CUSTOMER(CUS_NUM),
    CONSTRAINT FK2_ORDERS FOREIGN KEY (ITEM_NUM) REFERENCES ITEM(ITEM_NUM)

  • Database Copy can't copy primary key for tables

    When I use Tools->Database Copy Wizard to copy my existing schema (for example: azteca_KSMMS) to a brand new schema (azteca), I find the primary key for some of the tables can't be copied, also the views seem not valid under the new schema (azteca). Please give me your comments about that. Thanks for your help.
    Kevin

    For example I have a table called workorder, it has a primary key with name (CW_PKEY_519, on WORKORDERID column) from the source schema (azteca_KSMMS). After I database copy to new schema azteca, the primary key lost. The data of workorder and other indexes have been copied to azteca schema.
    Kevin

  • Primary key for an column consisting duplicates

    hi,
    ------->i have created a table and
    -------> i have a column consisting of 1000 records (but where i have duplicates)
    and now i want to create a primary key for the column
    how can i do it....

    Hi,
    You can find records which contains duplicate values for the table column using Oracle exceptions table. Please see a small demonstration:-
    SQL> create table test1(id number);
    Table created.
    SQL> insert into test1 values(&id);
    Enter value for id: 1
    old 1: insert into test1 values(&id)
    new 1: insert into test1 values(1)
    1 row created.
    SQL> /
    Enter value for id: 2
    old 1: insert into test1 values(&id)
    new 1: insert into test1 values(2)
    1 row created.
    SQL> /
    Enter value for id: 3
    old 1: insert into test1 values(&id)
    new 1: insert into test1 values(3)
    1 row created.
    SQL> /
    Enter value for id: 1
    old 1: insert into test1 values(&id)
    new 1: insert into test1 values(1)
    1 row created.
    SQL> /
    Enter value for id: 3
    old 1: insert into test1 values(&id)
    new 1: insert into test1 values(3)
    1 row created.
    SQL> /
    Enter value for id: 4
    old 1: insert into test1 values(&id)
    new 1: insert into test1 values(4)
    1 row created.
    SQL> /
    Enter value for id: 5
    old 1: insert into test1 values(&id)
    new 1: insert into test1 values(5)
    1 row created.
    SQL> commit;
    Commit complete.
    SQL> alter table test1 add constraint id_pk primary key(id);
    alter table test1 add constraint id_pk primary key(id)
    ERROR at line 1:
    ORA-02437: cannot validate (SYS.ID_PK) - primary key violated
    SQL> alter table test1 add constraint id_pk primary key(id) exceptions into exceptions;
    alter table test1 add constraint id_pk primary key(id) exceptions into exceptions
    ERROR at line 1:
    ORA-02445: Exceptions table not found
    SQL> @?/rdbms/admin/utlexcpt
    Table created.
    SQL> alter table test1 add constraint id_pk primary key(id) exceptions into exceptions;
    alter table test1 add constraint id_pk primary key(id) exceptions into exceptions
    ERROR at line 1:
    ORA-02437: cannot validate (SYS.ID_PK) - primary key violated
    SQL> desc exceptions
    Name Null? Type
    ROW_ID ROWID
    OWNER VARCHAR2(30)
    TABLE_NAME VARCHAR2(30)
    CONSTRAINT VARCHAR2(30)
    SQL> select * from exceptions;
    ROW_ID OWNER TABLE_NAME CONSTRAINT
    AAAc95AABAAA9EpAAD SYS TEST1 ID_PK
    AAAc95AABAAA9EpAAA SYS TEST1 ID_PK
    AAAc95AABAAA9EpAAE SYS TEST1 ID_PK
    AAAc95AABAAA9EpAAC SYS TEST1 ID_PK
    SQL> select * from test1 where rowid in(select row_id from exceptions);
    ID
    3
    1
    1
    3
    Thanks
    Edited by: rarain on May 28, 2013 12:10 PM

  • Setting a Primary Key for a newly added Column

    Is it possible for setting a primary key for a newly added column in a table having records?

    Hi,
    km**** wrote:
    oh if the table has records then it is not possible ah...No, the table can have rows at the time you add the Primary Key constraint. Solomon was just saying that the column(s) that you are making into the Primary Key must already have unique values. A Primary Key can not be NULL, so you must do the steps in this order:
    (1) ALTER TABLE to add the column(s) (if this hasn't been done already)
    (2) UPDATE the table, to put unique values in all rows for the Primary Key column(s)
    (3) Add the PRIMARY KEY constraint
    You need to do step (2) before you do step (3)

  • Primary Key for Programmatic View

    Hi,
    I am using Jdev R2 for ADF. When I create a programmatic VO, Is it necessary to have a primary key for Programmatic VO, if yes, what can be the effective primary key?
    - Vinoth

    Hi Vino,
    Primary keys are used to loop through the collection on tables, list of values and to access rows on a view object.
    Juan Camilo

  • Primary Key for a view?

    Hi everybody,
    I am wondering if there is such thing as primary key for a view? Assuming, that my view is based on a single table and it's just a subset of columns (some of them renamed) including PK of the table it's based on.
    The reason for my question is this - we're using Reverse POCO generator which automatically generates C# Model class and Configuration file for our tables and views. For the view is lists all the columns as a key and therefore I obviously can not use normal
    way of updating that view. I posted that as an issue here https://efreversepoco.codeplex.com/workitem/115 but I am thinking there is no such thing as the "primary key" for a view.
    The query used to generate the classes is extremely complex already but may be it can be modified to get the PK ?
    SELECT [Extent1].[SchemaName],
    [Extent1].[Name] AS TableName,
    [Extent1].[TABLE_TYPE] AS TableType,
    [UnionAll1].[Ordinal],
    [UnionAll1].[Name] AS ColumnName,
    [UnionAll1].[IsNullable],
    [UnionAll1].[TypeName],
    ISNULL([UnionAll1].[MaxLength],0) AS MaxLength,
    ISNULL([UnionAll1].[Precision], 0) AS Precision,
    ISNULL([UnionAll1].[Default], '') AS [Default],
    ISNULL([UnionAll1].[DateTimePrecision], '') AS [DateTimePrecision],
    ISNULL([UnionAll1].[Scale], 0) AS Scale,
    [UnionAll1].[IsIdentity],
    [UnionAll1].[IsStoreGenerated],
    CASE WHEN ([Project5].[C2] IS NULL) THEN CAST(0 AS BIT)
    ELSE [Project5].[C2]
    END AS PrimaryKey
    FROM (
    SELECT QUOTENAME(TABLE_SCHEMA) + QUOTENAME(TABLE_NAME) [Id],
    TABLE_SCHEMA [SchemaName],
    TABLE_NAME [Name],
    TABLE_TYPE
    FROM INFORMATION_SCHEMA.TABLES
    WHERE TABLE_TYPE IN ('BASE TABLE', 'VIEW')
    ) AS [Extent1]
    INNER JOIN (
    SELECT [Extent2].[Id] AS [Id],
    [Extent2].[Name] AS [Name],
    [Extent2].[Ordinal] AS [Ordinal],
    [Extent2].[IsNullable] AS [IsNullable],
    [Extent2].[TypeName] AS [TypeName],
    [Extent2].[MaxLength] AS [MaxLength],
    [Extent2].[Precision] AS [Precision],
    [Extent2].[Default],
    [Extent2].[DateTimePrecision] AS [DateTimePrecision],
    [Extent2].[Scale] AS [Scale],
    [Extent2].[IsIdentity] AS [IsIdentity],
    [Extent2].[IsStoreGenerated] AS [IsStoreGenerated],
    0 AS [C1],
    [Extent2].[ParentId] AS [ParentId]
    FROM (
    SELECT QUOTENAME(c.TABLE_SCHEMA) + QUOTENAME(c.TABLE_NAME) + QUOTENAME(c.COLUMN_NAME) [Id],
    QUOTENAME(c.TABLE_SCHEMA) + QUOTENAME(c.TABLE_NAME) [ParentId],
    c.COLUMN_NAME [Name],
    c.ORDINAL_POSITION [Ordinal],
    CAST(CASE c.IS_NULLABLE
    WHEN 'YES' THEN 1
    WHEN 'NO' THEN 0
    ELSE 0
    END AS BIT) [IsNullable],
    CASE WHEN c.DATA_TYPE IN ('varchar', 'nvarchar', 'varbinary')
    AND c.CHARACTER_MAXIMUM_LENGTH = -1 THEN c.DATA_TYPE + '(max)'
    ELSE c.DATA_TYPE
    END AS [TypeName],
    c.CHARACTER_MAXIMUM_LENGTH [MaxLength],
    CAST(c.NUMERIC_PRECISION AS INTEGER) [Precision],
    CAST(c.DATETIME_PRECISION AS INTEGER) [DateTimePrecision],
    CAST(c.NUMERIC_SCALE AS INTEGER) [Scale],
    c.COLLATION_CATALOG [CollationCatalog],
    c.COLLATION_SCHEMA [CollationSchema],
    c.COLLATION_NAME [CollationName],
    c.CHARACTER_SET_CATALOG [CharacterSetCatalog],
    c.CHARACTER_SET_SCHEMA [CharacterSetSchema],
    c.CHARACTER_SET_NAME [CharacterSetName],
    CAST(0 AS BIT) AS [IsMultiSet],
    CAST(COLUMNPROPERTY(OBJECT_ID(QUOTENAME(c.TABLE_SCHEMA) + '.' + QUOTENAME(c.TABLE_NAME)), c.COLUMN_NAME, 'IsIdentity') AS BIT) AS [IsIdentity],
    CAST(COLUMNPROPERTY(OBJECT_ID(QUOTENAME(c.TABLE_SCHEMA) + '.' + QUOTENAME(c.TABLE_NAME)), c.COLUMN_NAME, 'IsComputed')
    | CASE WHEN c.DATA_TYPE = 'timestamp' THEN 1
    ELSE 0
    END AS BIT) AS [IsStoreGenerated],
    c.COLUMN_DEFAULT AS [Default]
    FROM INFORMATION_SCHEMA.COLUMNS c
    INNER JOIN INFORMATION_SCHEMA.TABLES t
    ON c.TABLE_CATALOG = t.TABLE_CATALOG
    AND c.TABLE_SCHEMA = t.TABLE_SCHEMA
    AND c.TABLE_NAME = t.TABLE_NAME
    AND t.TABLE_TYPE IN ('BASE TABLE', 'VIEW')
    ) AS [Extent2]
    UNION ALL
    SELECT [Extent3].[Id] AS [Id],
    [Extent3].[Name] AS [Name],
    [Extent3].[Ordinal] AS [Ordinal],
    [Extent3].[IsNullable] AS [IsNullable],
    [Extent3].[TypeName] AS [TypeName],
    [Extent3].[MaxLength] AS [MaxLength],
    [Extent3].[Precision] AS [Precision],
    [Extent3].[Default],
    [Extent3].[DateTimePrecision] AS [DateTimePrecision],
    [Extent3].[Scale] AS [Scale],
    [Extent3].[IsIdentity] AS [IsIdentity],
    [Extent3].[IsStoreGenerated] AS [IsStoreGenerated],
    6 AS [C1],
    [Extent3].[ParentId] AS [ParentId]
    FROM (
    SELECT QUOTENAME(c.TABLE_SCHEMA) + QUOTENAME(c.TABLE_NAME) + QUOTENAME(c.COLUMN_NAME) [Id],
    QUOTENAME(c.TABLE_SCHEMA) + QUOTENAME(c.TABLE_NAME) [ParentId],
    c.COLUMN_NAME [Name],
    c.ORDINAL_POSITION [Ordinal],
    CAST(CASE c.IS_NULLABLE
    WHEN 'YES' THEN 1
    WHEN 'NO' THEN 0
    ELSE 0
    END AS BIT) [IsNullable],
    CASE WHEN c.DATA_TYPE IN ('varchar', 'nvarchar', 'varbinary')
    AND c.CHARACTER_MAXIMUM_LENGTH = -1 THEN c.DATA_TYPE + '(max)'
    ELSE c.DATA_TYPE
    END AS [TypeName],
    c.CHARACTER_MAXIMUM_LENGTH [MaxLength],
    CAST(c.NUMERIC_PRECISION AS INTEGER) [Precision],
    CAST(c.DATETIME_PRECISION AS INTEGER) AS [DateTimePrecision],
    CAST(c.NUMERIC_SCALE AS INTEGER) [Scale],
    c.COLLATION_CATALOG [CollationCatalog],
    c.COLLATION_SCHEMA [CollationSchema],
    c.COLLATION_NAME [CollationName],
    c.CHARACTER_SET_CATALOG [CharacterSetCatalog],
    c.CHARACTER_SET_SCHEMA [CharacterSetSchema],
    c.CHARACTER_SET_NAME [CharacterSetName],
    CAST(0 AS BIT) AS [IsMultiSet],
    CAST(COLUMNPROPERTY(OBJECT_ID(QUOTENAME(c.TABLE_SCHEMA) + '.' + QUOTENAME(c.TABLE_NAME)), c.COLUMN_NAME, 'IsIdentity') AS BIT) AS [IsIdentity],
    CAST(COLUMNPROPERTY(OBJECT_ID(QUOTENAME(c.TABLE_SCHEMA) + '.' + QUOTENAME(c.TABLE_NAME)), c.COLUMN_NAME, 'IsComputed')
    | CASE WHEN c.DATA_TYPE = 'timestamp' THEN 1
    ELSE 0
    END AS BIT) AS [IsStoreGenerated],
    c.COLUMN_DEFAULT [Default]
    FROM INFORMATION_SCHEMA.COLUMNS c
    INNER JOIN INFORMATION_SCHEMA.VIEWS v
    ON c.TABLE_CATALOG = v.TABLE_CATALOG
    AND c.TABLE_SCHEMA = v.TABLE_SCHEMA
    AND c.TABLE_NAME = v.TABLE_NAME
    WHERE NOT (
    v.TABLE_SCHEMA = 'dbo'
    AND v.TABLE_NAME IN ('syssegments', 'sysconstraints')
    AND SUBSTRING(CAST(SERVERPROPERTY('productversion') AS VARCHAR(20)), 1, 1) = 8
    ) AS [Extent3]
    ) AS [UnionAll1]
    ON (0 = [UnionAll1].[C1])
    AND ([Extent1].[Id] = [UnionAll1].[ParentId])
    LEFT OUTER JOIN (
    SELECT [UnionAll2].[Id] AS [C1],
    CAST(1 AS BIT) AS [C2]
    FROM (
    SELECT QUOTENAME(tc.CONSTRAINT_SCHEMA) + QUOTENAME(tc.CONSTRAINT_NAME) [Id],
    QUOTENAME(tc.TABLE_SCHEMA) + QUOTENAME(tc.TABLE_NAME) [ParentId],
    tc.CONSTRAINT_NAME [Name],
    tc.CONSTRAINT_TYPE [ConstraintType],
    CAST(CASE tc.IS_DEFERRABLE
    WHEN 'NO' THEN 0
    ELSE 1
    END AS BIT) [IsDeferrable],
    CAST(CASE tc.INITIALLY_DEFERRED
    WHEN 'NO' THEN 0
    ELSE 1
    END AS BIT) [IsInitiallyDeferred]
    FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS tc
    WHERE tc.TABLE_NAME IS NOT NULL
    ) AS [Extent4]
    INNER JOIN (
    SELECT 7 AS [C1],
    [Extent5].[ConstraintId] AS [ConstraintId],
    [Extent6].[Id] AS [Id]
    FROM (
    SELECT QUOTENAME(CONSTRAINT_SCHEMA) + QUOTENAME(CONSTRAINT_NAME) [ConstraintId],
    QUOTENAME(TABLE_SCHEMA) + QUOTENAME(TABLE_NAME) + QUOTENAME(COLUMN_NAME) [ColumnId]
    FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE
    ) AS [Extent5]
    INNER JOIN (
    SELECT QUOTENAME(c.TABLE_SCHEMA) + QUOTENAME(c.TABLE_NAME) + QUOTENAME(c.COLUMN_NAME) [Id],
    QUOTENAME(c.TABLE_SCHEMA) + QUOTENAME(c.TABLE_NAME) [ParentId],
    c.COLUMN_NAME [Name],
    c.ORDINAL_POSITION [Ordinal],
    CAST(CASE c.IS_NULLABLE
    WHEN 'YES' THEN 1
    WHEN 'NO' THEN 0
    ELSE 0
    END AS BIT) [IsNullable],
    CASE WHEN c.DATA_TYPE IN ('varchar', 'nvarchar', 'varbinary')
    AND c.CHARACTER_MAXIMUM_LENGTH = -1 THEN c.DATA_TYPE + '(max)'
    ELSE c.DATA_TYPE
    END AS [TypeName],
    c.CHARACTER_MAXIMUM_LENGTH [MaxLength],
    CAST(c.NUMERIC_PRECISION AS INTEGER) [Precision],
    CAST(c.DATETIME_PRECISION AS INTEGER) [DateTimePrecision],
    CAST(c.NUMERIC_SCALE AS INTEGER) [Scale],
    c.COLLATION_CATALOG [CollationCatalog],
    c.COLLATION_SCHEMA [CollationSchema],
    c.COLLATION_NAME [CollationName],
    c.CHARACTER_SET_CATALOG [CharacterSetCatalog],
    c.CHARACTER_SET_SCHEMA [CharacterSetSchema],
    c.CHARACTER_SET_NAME [CharacterSetName],
    CAST(0 AS BIT) AS [IsMultiSet],
    CAST(COLUMNPROPERTY(OBJECT_ID(QUOTENAME(c.TABLE_SCHEMA) + '.' + QUOTENAME(c.TABLE_NAME)),
    c.COLUMN_NAME, 'IsIdentity') AS BIT) AS [IsIdentity],
    CAST(COLUMNPROPERTY(OBJECT_ID(QUOTENAME(c.TABLE_SCHEMA) + '.' + QUOTENAME(c.TABLE_NAME)),
    c.COLUMN_NAME, 'IsComputed')
    | CASE WHEN c.DATA_TYPE = 'timestamp' THEN 1
    ELSE 0
    END AS BIT) AS [IsStoreGenerated],
    c.COLUMN_DEFAULT AS [Default]
    FROM INFORMATION_SCHEMA.COLUMNS c
    INNER JOIN INFORMATION_SCHEMA.TABLES t
    ON c.TABLE_CATALOG = t.TABLE_CATALOG
    AND c.TABLE_SCHEMA = t.TABLE_SCHEMA
    AND c.TABLE_NAME = t.TABLE_NAME
    AND t.TABLE_TYPE IN ('BASE TABLE', 'VIEW')
    ) AS [Extent6]
    ON [Extent6].[Id] = [Extent5].[ColumnId]
    UNION ALL
    SELECT 11 AS [C1],
    [Extent7].[ConstraintId] AS [ConstraintId],
    [Extent8].[Id] AS [Id]
    FROM (
    SELECT CAST( NULL AS NVARCHAR (1)) [ConstraintId], CAST( NULL AS NVARCHAR (MAX)) [ColumnId] WHERE 1= 2
    ) AS [Extent7]
    INNER JOIN (
    SELECT QUOTENAME(c.TABLE_SCHEMA) + QUOTENAME(c.TABLE_NAME) + QUOTENAME(c.COLUMN_NAME) [Id],
    QUOTENAME(c.TABLE_SCHEMA) + QUOTENAME(c.TABLE_NAME) [ParentId],
    c.COLUMN_NAME [Name],
    c.ORDINAL_POSITION [Ordinal],
    CAST(CASE c.IS_NULLABLE
    WHEN 'YES' THEN 1
    WHEN 'NO' THEN 0
    ELSE 0
    END AS BIT) [IsNullable],
    CASE WHEN c.DATA_TYPE IN ('varchar', 'nvarchar', 'varbinary')
    AND c.CHARACTER_MAXIMUM_LENGTH = -1 THEN c.DATA_TYPE + '(max)'
    ELSE c.DATA_TYPE
    END AS [TypeName],
    c.CHARACTER_MAXIMUM_LENGTH [MaxLength],
    CAST(c.NUMERIC_PRECISION AS INTEGER) [Precision],
    CAST(c.DATETIME_PRECISION AS INTEGER) AS [DateTimePrecision],
    CAST(c.NUMERIC_SCALE AS INTEGER) [Scale],
    c.COLLATION_CATALOG [CollationCatalog],
    c.COLLATION_SCHEMA [CollationSchema],
    c.COLLATION_NAME [CollationName],
    c.CHARACTER_SET_CATALOG [CharacterSetCatalog],
    c.CHARACTER_SET_SCHEMA [CharacterSetSchema],
    c.CHARACTER_SET_NAME [CharacterSetName],
    CAST(0 AS BIT) AS [IsMultiSet],
    CAST(COLUMNPROPERTY(OBJECT_ID(QUOTENAME(c.TABLE_SCHEMA) + '.' + QUOTENAME(c.TABLE_NAME)),
    c.COLUMN_NAME, 'IsIdentity') AS BIT) AS [IsIdentity],
    CAST(COLUMNPROPERTY(OBJECT_ID(QUOTENAME(c.TABLE_SCHEMA) + '.' + QUOTENAME(c.TABLE_NAME)),
    c.COLUMN_NAME, 'IsComputed')
    | CASE WHEN c.DATA_TYPE = 'timestamp' THEN 1
    ELSE 0
    END AS BIT) AS [IsStoreGenerated],
    c.COLUMN_DEFAULT [Default]
    FROM INFORMATION_SCHEMA.COLUMNS c
    INNER JOIN INFORMATION_SCHEMA.VIEWS v
    ON c.TABLE_CATALOG = v.TABLE_CATALOG
    AND c.TABLE_SCHEMA = v.TABLE_SCHEMA
    AND c.TABLE_NAME = v.TABLE_NAME
    WHERE NOT (
    v.TABLE_SCHEMA = 'dbo'
    AND v.TABLE_NAME IN ('syssegments', 'sysconstraints')
    AND SUBSTRING(CAST(SERVERPROPERTY('productversion') AS VARCHAR(20)), 1, 1) = 8
    ) AS [Extent8]
    ON [Extent8].[Id] = [Extent7].[ColumnId]
    ) AS [UnionAll2]
    ON (7 = [UnionAll2].[C1])
    AND ([Extent4].[Id] = [UnionAll2].[ConstraintId])
    WHERE [Extent4].[ConstraintType] = N'PRIMARY KEY'
    ) AS [Project5]
    ON [UnionAll1].[Id] = [Project5].[C1]
    WHERE NOT ([Extent1].[Name] IN ('EdmMetadata', '__MigrationHistory'));
    Thanks in advance.
    UPDATE. I made a quick Google search and found this
    http://stackoverflow.com/questions/1013333/entity-framework-and-sql-server-view/2715299#2715299
    It sounds as an interesting idea to try although I am not sure it will work with POCO Generator. But I'm going to try it now anyway.
    For every expert, there is an equal and opposite expert. - Becker's Law
    My blog
    My TechNet articles

    UPDATE. Changing my view to be
    USE [SiriusSQL_SysManager]
    GO
    /****** Object: View [dbo].[SiriusV_SalesPointsLicensesList] Script Date: 4/30/2015 1:28:54 PM ******/
    DROP VIEW [dbo].[SiriusV_SalesPointsLicensesList]
    GO
    /****** Object: View [dbo].[SiriusV_SalesPointsLicensesList] Script Date: 4/30/2015 1:28:54 PM ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    create view [dbo].[SiriusV_SalesPointsLicensesList]
    as
    select ISNULL(salespoint,'') as Salespoint
    , CAST(loc_suffix as smallint) as Id
    , CAST(descrip as varchar(25)) as [Description]
    , cast(mode as tinyint) as Mode
    , cast(is_access as bit) as AccessWare
    , cast(is_adv_inv as bit) as AdvInventory
    , cast(is_cw_crdt as bit) as CardwareCredit
    , cast(is_debit as bit) as DebitWare
    , cast(is_dir_net as bit) as DirectNet
    , cast(is_fbquick as bit) as FBQuickService
    , cast(is_fbtable as bit) as FBTableService
    , cast(is_grpschd as bit) as ResourceScheduling
    , cast(is_guests as bit) as Guests
    , cast(is_pass as bit) as PassWare
    , cast(is_pms as bit) as PMSInterface
    , cast(is_rental as bit) as RentWare
    , cast(is_dual as bit) as DualBook
    , cast(is_pod as bit) as PodBook
    , cast(is_private as bit) as PrivateBook
    , cast(is_resrv as bit) as Reservations
    , cast(is_teesht as bit) as TeeSheet
    , cast(is_rungk as bit) as RunGKInSales
    , cast(is_resseat as bit) as ReservedSeating
    , cast(is_kcashls as bit) as KioskCashless
    , cast(is_ksales as bit) as KioskSales
    , cast(is_kwilcal as bit) as KioskWillCall
    , cast(is_payplan as bit) as PaymentPlan
    , cast(is_test as bit) as Test
    from dbo.sales_pt
    where hidden = 0 ;
    GO
    worked!!! I now have just salespoint as the Key.
    For every expert, there is an equal and opposite expert. - Becker's Law
    My blog
    My TechNet articles

  • Primary key for table

    I have a table Gr_order which was populated ages ago and now it need to be populated
    with some more look up data.
    "Orderid" is primary key for the table but question is how do I insert "orderid" in insert statement in procedure. I could not find any sequence name. There are 1230
    records which need to be inserted.
    Desc Gr_order
    Orderid  Number Primary key
    Desc     Varchar2
    INSERT INTO gr_order (orderid,desc) 
    VALUES (???, upper(each_pom.desc);Thanks
    sandy

    You find the code that inserts into the table and see if it uses the sequence ;-) . A sequence is not "attached" to a particular table - it is up to the inserting statement to decide if a sequence is to be used.
    You might want to check if the table has a trigger - some developers like to emulate MS-sql server behaviour by having a trigger on the table that selects from a sequence. If it has such a trigger, then you just do your inserts without specifying order_id. But if the table does not have such a trigger, then you cannot know if the table was originally populated using a sequence or not (unless you can find the insert statements somewhere.)

  • How to create one primary key for each vendor

    Hi all
    i am doing IDOC to jdbc scenario
    i am triggering idoc from R/3 and the data is going into DB table vendor through XI.
    structures are as follows:
    sender side: ZVendorIdoc (this is a customized IDOC , if i triger IDOC for multiple vendors then it triggers only 1 idoc with multiple segment )
    Receiver side:
    DT_testVendor
        Table
            tblVendor
                action UPDATE_INSERT
                access                     1:unbounded
                    cVendorName         1
                    cVendorCode        1
                    fromdate                1
                    todate                    1
                 Key1
                    cVendorName         1
    if i trigger idoc for multiple vendors ,for example vendor 2005,2006 and 2010 . then i can see that the only key comes from the very first field (2005) and the whole record for vendor 2005,2006 and 2010  goes into the table with this(2005) as a primary key
    now again if i send data for these three vendor 2005, 2006 , 2010, in which record for the vendor 2005 is same and for 2006 and 2010 are different than it takes 2005 as a primary key and it does not update the data in the table.
    my requirement is like this:   for each vendor there should be one unique key assigned.
                                              for above said example there should come three keys one for each vendor .
    could you please help me how to do this???????????

    Hi,
      In Mapping Make the statement is 0-unbounded.For each vendor create a statement.This will solve your problem.
    Regards,
    Prakasu.M

  • How to define Composite primary key for a Table

    Hi ,
    I am basically more into Java Programming , with little bit knowledge on Oracle as DataBase .so please excuse for my silly doubts .
    Can anybody please tell me how to define a Composite Primary Key on a Table .
    Thanks in advance .
    Edited by: user672373773 on Sep 25, 2009 8:54 AM

    Here is an example right out of the Oracle documentation and the syntax for adding PK since you mention adding a composite PK.
    Example creating composite index
    http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14251/adfns_indexing.htm#sthref594
    Syntax for adding a PK (composite or not)
    alter table oooooooo.tttttttt
    add constraint tttttttt_PK
    primary key (sample_column2,
    sample_column1)
    using index
    tablespace IDXSPC
    pctfree 05
    initrans 04
    maxtrans 08
    storage (initial 16k
    next 16k
    maxextents 32
    pctincrease 0);
    -- dictionary management with restricted storage, change as desired.
    HTH -- Mark D Powell --

  • Primary Key for Read Only Entity Beans In EJB 3.0

    Hi,
    I have checked the spec for ejb 3.0 which mentions that, there is no common standard for the vendor to implement the Read only Entity Beans.
    My question over here is how it is implemented in OC4J??
    Do we need to specify a primary key attribute in the read-only entity bean?
    w.r.t BC4J(ADF) i remember, we used to create a read-only View Object with out specifying a primary key.
    Just want to check is that the way it works in EJB 3.0 (Implemented by OC4J).
    Thanks for your help in advance.
    Shiva

    Hi,
    Try using the JBoss embedded container:
    http://docs.codehaus.org/display/MAVENUSER/How+to+use+the+JBoss+Embedded+EJB3+Container+for+Unit+testing
    /klejs

Maybe you are looking for