Primary key for certificates in a database
To authenticate an incoming mail, I need to fetch the certificate from a table in my database.
In that table the certificate is a BLOB column, but how should I lookup if a certificate from an incoming is in the database?
On DN alone? => what when they renew their certificate?
On serial? => is this unique acrros issuers?
It's S/MIME but there is no sender.You are stuffed!
There has to be something in the email to identifiy the sender or you have nothing to use to lookup the certificate!
Similar Messages
-
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.
KevinFor 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 -
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
AmareshHi 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) -
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 -
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?
- VinothHi 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 -
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 articlesUPDATE. 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 -
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
sandyYou 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.) -
Any easy way to generate unique primary key for database table?
I'm currently playing with the J2EE reference implementation from Sun which comes with the IBM Cloudscape database. This Cloudscape database supports the use of an AutoIncrement field.
First question: Can I use CMP and assume that the database will generate a proper key for me? Anyone tried it out successfully before?
Also, based on what I've heard so far, it seems that generating database primary key is not really well-supported by J2EE using CMP in that a lot of J2EE developers have to resort to workarounds like using a session bean, JDBC and (1) some seed numbers for ID implanted in the database itself (as in the J2EE tutorial DukesBankApp example) or (2) using the SQL MAX aggregation command + 1. Usign seed number is contradictory to good database design and using MAX is dangerous for heavy traffic application if 2 beans try to insert themselves into the database at the same time (synchronizarion problem).
Anyway I find it dumb that we still have to go back to JDBC and SQL which was the reason why the concept Entity Bean was introduced; to make database persistence transparent! Now it seems that J2EE makes it worse and more troublesome than before.
Second Question: Is there any easy (hopefully transparent/automatic) way of generating primary key ID?if you want to rely on your container or database then go hard, will probably be faster.
to make a cross container/db soln I used a CMP Entity bean called Sequence with one field for uid
I use one instance and increment the field each time.
To do the logic, I have a utils class with static method, no need for session bean overhead
I reckon this approach is OK considering all things -
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 AMHere 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 -- -
Delete old value of primary key for an UPDATE LCR
Hi,
I have a transformation attached to a add_global_propagation_rules, this transformation modify the command_type of every LCR to be an INSERT instead of their original command.
The old values are switched to new values array for the DELETE LCR. For the UPDATE, the old values are also removed, but when I try to remove the old value of the primary key column....the new values is also deleted!
Is it normal ? I searched in the doc to see special behavior of the delete_column for the primary key, but I saw nothing.
When the new value is delete, this line is executed :
lv_lcr.delete_column(lv_col.column_name, 'old');
Thanks.Hi Sean
Thanks for you answer.
Yes, I track the DML activities, but due to hardware restriction, we have to keep the load as possible on the server source.
Here is the source of the transform function. In this version, for the UPDATE LCR, the PK are recreated.
Thanks
FUNCTION transform(lcr IN anydata)
RETURN anydata
IS
lv_isProp NUMBER(1);
lv_lcr SYS.Lcr$_Row_Record;
lv_rc PLS_INTEGER;
lv_cols SYS.LCR$_ROW_LIST;
lv_cols_new SYS.LCR$_ROW_LIST;
lv_cols_old SYS.LCR$_ROW_LIST;
lv_col SYS.LCR$_ROW_UNIT;
lv_dest gtr_destination_typ;
lv_source gtr_sourceInfo_typ;
lv_addCols gt_colInfList_typ;
i NUMBER;
r PLS_INTEGER;
lv_isUPDATE BOOLEAN;
lv_pkValues gt_value_by_colName;
lv_next VARCHAR2(30);
BEGIN
-- Access the LCR
lv_rc := lcr.GETOBJECT(lv_lcr);
--get source
lv_source := gv_sourceInfo(lv_lcr.get_object_owner||gv_connector||lv_lcr.get_source_database_name);
--get destination
lv_dest := lv_source.destination;
--Loop through column to remove columns not propagated
--when the action is a DELETE, use the array of OLD values
IF lv_lcr.get_command_type = 'DELETE' THEN
lv_cols := lv_lcr.get_values('old');
--when the action is an INSERT or an UPDATE, use the array of NEW values
ELSE
lv_cols := lv_lcr.get_values('new', 'Y');
END IF;
FOR i IN lv_cols.FIRST..lv_cols.LAST LOOP
lv_col := lv_cols(i);
--get flag indicating the propagation type
lv_isProp := isColumnIsPropagated_fnc(lv_dest.destSchema,
lv_dest.destDatabase,
lv_lcr.get_object_name,
lv_col.column_name);
IF lv_isProp = gv_column_NOT_propagated THEN
lv_lcr.delete_column(lv_col.column_name, '*');
--if the command type is an UPDATE and the column is a PK, keep the value
ELSIF lv_lcr.get_command_type = 'UPDATE' AND
lv_isProp = gv_columnPK_propagated
THEN
lv_pkValues(lv_col.column_name) := lv_col.data;
END IF;
END LOOP;
--swith the old_values array to the new_values array when it is a DELETE
IF lv_lcr.get_command_type = 'DELETE' THEN
lv_cols_old := lv_lcr.get_values('old');
lv_lcr.set_values('new',lv_cols_old);
END IF;
-- remove the old values array
lv_lcr.set_values('old', NULL);
--when it's an UDPATE, the primary key column(s) needs to be recreated
IF lv_lcr.get_command_type IN ('UPDATE') THEN
lv_isUPDATE := TRUE;
END IF;
--convert the command_type to an INSERT
IF lv_verbose = 1 THEN
lv_msg := lv_msg||'Set command_type to INSERT; '||CHR(10);
END IF;
lv_lcr.set_command_type('INSERT');
--when it's an UDPATE, the primary key column(s) needs to be recreated
IF lv_isUPDATE = TRUE THEN
lv_next := lv_pkValues.FIRST;
WHILE lv_next IS NOT NULL LOOP
lv_lcr.add_column('new', lv_next, lv_pkValues(lv_next));
lv_next := lv_pkValues.NEXT(lv_next);
END LOOP;
END IF;
--rename source database and object owner for the destination
lv_lcr.set_source_database_name(lv_dest.destDatabase);
lv_lcr.set_object_owner(lv_dest.destSchema);
RETURN ANYDATA.ConvertObject(lv_lcr);
END transform;
Maybe you are looking for
-
Hi! I want to create blogs and wikis in spanish. I have created a "es.lproj" folder in "/Library/Application Support/Apple/WikiServer" folder with the translation of the files default.strings and js.strings, but it seems that it is not enough. Thanks
-
frends, can you please tell me is there anz diffrance or steps which we have to consider while writting normal routine (tranfer rule & update rule ) or start routine. please tell me diffrance between normal routine and start routine. in which senario
-
Apple devices not receiving IP address
Hello everyone, I searched for a resolution to my problem but couldn't find one so hopefully I can get some help here. We have a 2504 controller (Code 7.0.220.0) deployed with 7 LAPs. We have a few SSIDs, both with WPA/WPA2 configured. There is an
-
I have Adobe Acrobat Pro XI And its up to date. When I go to a web page Power point presentation saved as Adobe the first page loads then I keep getting error message: There was a problem reading this document (14) I've tried refreshing the download.
-
Keeping changes when saving to jpeg.
Working in raw, I have made changes to exposurre etc. when I save to jpeg they go lighter. I have looked in the colour settings which are set the same as the camera at sRGB but not sure if I a missing something. I have recently upgraded from CS4 t