Showing posts with label everybody. Show all posts
Showing posts with label everybody. Show all posts

Thursday, March 22, 2012

duplicate entry in a primary key field

Hi everybody couldn't get through with saving my data on the table with two primary keys...

my table structure is this

pubid int Unchecked (primary key)
pub char(1) Unchecked
publ char(1) Unchecked
pubcode char(2) Unchecked (primary key)

a sample data is here

pubid pub publ pubcode

1 a b ab
1 b b bb
2 a b ab
2 b b bb

when i save this table modifying the pubid and pubcode as primary keys the following error displays...

Unable to create index 'PK_PUBS3'.
CREATE UNIQUE INDEX terminated because a duplicate key was found for index ID 1. Most significant primary key is '51'.
Could not create constraint. See previous errors.
The statement has been terminated.

what i understand is that on the primary key duplicates are not allowed how could i allow it?

thanksAlex - you could probably do with a brush up on relational database design & theory.
http://r937.com/relational.html

1) You can't have two primary keys - there can only be one. Most likely you have a composite primary key.
2) The whole point of a primary key is that it is unique - this is pretty well the central tenet of a primary key.

What columns in your table uniquely identify a row? It looks like it could be a combination of pubid and pubcode but please let us know.|||You can have exactly 1 primary key. If I understand correctly, the PK is now a composite key on 2 columns, pubid and pubcode. There are no duplicate combinations of values in that combination of columns, even though both columns individually do contain duplicate values.|||there is no column that uniquely identify a row actually the table is a junction table for many to many relationship pubid is the foreign key for table1 and pubcode for table3 I'm normalizing the database so i created this juction table for tables1 & 3 so with it is it okey if i will not make both a primary key?|||so with it is it okey if i will not make both a primary key?is it okay? well, yes, provided that you really do wish to allow the possibility of the same pubid being related to the same pubcode more than once

in most many-to-many relationships, this would be an error|||so what's the best way i could do it?

thanks|||create a composite primary key on both columns|||You have a composite primary key - this is one primary key comproised of 2+ columns.

i.e.
CREATE TABLE MyTable
(
pubid int
, pub char(1)
, publ char(1)
, pubcode char(2)
, CONSTRAINT pk_MyTable PRIMARY KEY CLUSTERED (pubid, pubcode)
)Again I recommend you read the link. It is only an article not a whole book but it will help you get some of the basics figured out.

Friday, March 9, 2012

Dual installation SQL 2005 Std. and Express

Hi everybody,
I had SQL 2005 std. edition installed and I install SQL 2005 express
after that. I have no trace of the express installation. Neither in the
add/remove program nor under \Program files directory!
Is dual installation possible?
Are files copied to the same directories?
thank you very much
sergeHi,
I found that I had to install SQL Server Management Studio Express (SSMSE)
but it cannot be installed when SQL Server Management Studio standard
edition is already installed. How can'I remove SSMS? It does not appear in
the add/remove program. And the Microsoft warning messsage shown during the
installation of SSMSE is truncated!
thank you for your time
serge
Serge Myrand wrote:
> Hi everybody,
> I had SQL 2005 std. edition installed and I install SQL 2005 express
> after that. I have no trace of the express installation. Neither in the
> add/remove program nor under \Program files directory!
> Is dual installation possible?
> Are files copied to the same directories?
> thank you very much
> serge|||> Is dual installation possible?
>
Yes, you can install both. The add/remove programs entry is shared. You
can selectively change/remove instances using the single entry.
> Are files copied to the same directories?
The default location is "C:\Program Files\Microsoft SQL Server". You will
have numbered subfolders(e.g. MSSQL.4) for instance-specific items.
Hope this helps.
Dan Guzman
SQL Server MVP
"Serge Myrand" <info@.softdelirium.qc.ca> wrote in message
news:44142941.EA94C30F@.softdelirium.qc.ca...
> Hi everybody,
> I had SQL 2005 std. edition installed and I install SQL 2005 express
> after that. I have no trace of the express installation. Neither in the
> add/remove program nor under \Program files directory!
> Is dual installation possible?
> Are files copied to the same directories?
>
> thank you very much
> serge
>Neither in the
> add/remove program nor under \Program files directory!Neither in the
> add/remove program nor under \Program files directory!Neither in the
> add/remove program nor under \Program files directory!Neither in the
> add/remove program nor under \Program files directory!|||No need for SSMSE in this case since you can use SSMS for the SQL Express
instance. For example, connect to instance 'MyServer\SQLExpress'.
--
Hope this helps.
Dan Guzman
SQL Server MVP
"Serge Myrand" <info@.softdelirium.qc.ca> wrote in message
news:44143B91.DA5D61B0@.softdelirium.qc.ca...
> Hi,
> I found that I had to install SQL Server Management Studio Express (SSMSE)
> but it cannot be installed when SQL Server Management Studio standard
> edition is already installed. How can'I remove SSMS? It does not appear in
> the add/remove program. And the Microsoft warning messsage shown during
> the
> installation of SSMSE is truncated!
> thank you for your time
> serge
>
> Serge Myrand wrote:
>> Hi everybody,
>> I had SQL 2005 std. edition installed and I install SQL 2005 express
>> after that. I have no trace of the express installation. Neither in the
>> add/remove program nor under \Program files directory!
>> Is dual installation possible?
>> Are files copied to the same directories?
>> thank you very much
>> serge
>|||Thank you very much.
Dan Guzman wrote:
> > Is dual installation possible?
> >
> Yes, you can install both. The add/remove programs entry is shared. You
> can selectively change/remove instances using the single entry.
> > Are files copied to the same directories?
> The default location is "C:\Program Files\Microsoft SQL Server". You will
> have numbered subfolders(e.g. MSSQL.4) for instance-specific items.
> --
> Hope this helps.
> Dan Guzman
> SQL Server MVP
> "Serge Myrand" <info@.softdelirium.qc.ca> wrote in message
> news:44142941.EA94C30F@.softdelirium.qc.ca...
> > Hi everybody,
> >
> > I had SQL 2005 std. edition installed and I install SQL 2005 express
> > after that. I have no trace of the express installation. Neither in the
> > add/remove program nor under \Program files directory!
> >
> > Is dual installation possible?
> >
> > Are files copied to the same directories?
> >
> >
> > thank you very much
> > serge
> >Neither in the
> > add/remove program nor under \Program files directory!Neither in the
> > add/remove program nor under \Program files directory!Neither in the
> > add/remove program nor under \Program files directory!Neither in the
> > add/remove program nor under \Program files directory!

Dual installation SQL 2005 Std. and Express

Hi everybody,
I had SQL 2005 std. edition installed and I install SQL 2005 express
after that. I have no trace of the express installation. Neither in the
add/remove program nor under \Program files directory!
Is dual installation possible?
Are files copied to the same directories?
thank you very much
serge
Hi,
I found that I had to install SQL Server Management Studio Express (SSMSE)
but it cannot be installed when SQL Server Management Studio standard
edition is already installed. How can'I remove SSMS? It does not appear in
the add/remove program. And the Microsoft warning messsage shown during the
installation of SSMSE is truncated!
thank you for your time
serge
Serge Myrand wrote:

> Hi everybody,
> I had SQL 2005 std. edition installed and I install SQL 2005 express
> after that. I have no trace of the express installation. Neither in the
> add/remove program nor under \Program files directory!
> Is dual installation possible?
> Are files copied to the same directories?
> thank you very much
> serge
|||> Is dual installation possible?
>
Yes, you can install both. The add/remove programs entry is shared. You
can selectively change/remove instances using the single entry.

> Are files copied to the same directories?
The default location is "C:\Program Files\Microsoft SQL Server". You will
have numbered subfolders(e.g. MSSQL.4) for instance-specific items.
Hope this helps.
Dan Guzman
SQL Server MVP
"Serge Myrand" <info@.softdelirium.qc.ca> wrote in message
news:44142941.EA94C30F@.softdelirium.qc.ca...
> Hi everybody,
> I had SQL 2005 std. edition installed and I install SQL 2005 express
> after that. I have no trace of the express installation. Neither in the
> add/remove program nor under \Program files directory!
> Is dual installation possible?
> Are files copied to the same directories?
>
> thank you very much
> serge
>Neither in the
> add/remove program nor under \Program files directory!Neither in the
> add/remove program nor under \Program files directory!Neither in the
> add/remove program nor under \Program files directory!Neither in the
> add/remove program nor under \Program files directory!
|||No need for SSMSE in this case since you can use SSMS for the SQL Express
instance. For example, connect to instance 'MyServer\SQLExpress'.
Hope this helps.
Dan Guzman
SQL Server MVP
"Serge Myrand" <info@.softdelirium.qc.ca> wrote in message
news:44143B91.DA5D61B0@.softdelirium.qc.ca...
> Hi,
> I found that I had to install SQL Server Management Studio Express (SSMSE)
> but it cannot be installed when SQL Server Management Studio standard
> edition is already installed. How can'I remove SSMS? It does not appear in
> the add/remove program. And the Microsoft warning messsage shown during
> the
> installation of SSMSE is truncated!
> thank you for your time
> serge
>
> Serge Myrand wrote:
>
|||Thank you very much.
Dan Guzman wrote:
[vbcol=seagreen]
> Yes, you can install both. The add/remove programs entry is shared. You
> can selectively change/remove instances using the single entry.
>
> The default location is "C:\Program Files\Microsoft SQL Server". You will
> have numbered subfolders(e.g. MSSQL.4) for instance-specific items.
> --
> Hope this helps.
> Dan Guzman
> SQL Server MVP
> "Serge Myrand" <info@.softdelirium.qc.ca> wrote in message
> news:44142941.EA94C30F@.softdelirium.qc.ca...

Dual installation SQL 2005 Std. and Express

Hi everybody,
I had SQL 2005 std. edition installed and I install SQL 2005 express
after that. I have no trace of the express installation. Neither in the
add/remove program nor under \Program files directory!
Is dual installation possible?
Are files copied to the same directories?
thank you very much
sergeHi,
I found that I had to install SQL Server Management Studio Express (SSMSE)
but it cannot be installed when SQL Server Management Studio standard
edition is already installed. How can'I remove SSMS? It does not appear in
the add/remove program. And the Microsoft warning messsage shown during the
installation of SSMSE is truncated!
thank you for your time
serge
Serge Myrand wrote:

> Hi everybody,
> I had SQL 2005 std. edition installed and I install SQL 2005 express
> after that. I have no trace of the express installation. Neither in the
> add/remove program nor under \Program files directory!
> Is dual installation possible?
> Are files copied to the same directories?
> thank you very much
> serge|||> Is dual installation possible?
>
Yes, you can install both. The add/remove programs entry is shared. You
can selectively change/remove instances using the single entry.

> Are files copied to the same directories?
The default location is "C:\Program Files\Microsoft SQL Server". You will
have numbered subfolders(e.g. MSSQL.4) for instance-specific items.
Hope this helps.
Dan Guzman
SQL Server MVP
"Serge Myrand" <info@.softdelirium.qc.ca> wrote in message
news:44142941.EA94C30F@.softdelirium.qc.ca...
> Hi everybody,
> I had SQL 2005 std. edition installed and I install SQL 2005 express
> after that. I have no trace of the express installation. Neither in the
> add/remove program nor under \Program files directory!
> Is dual installation possible?
> Are files copied to the same directories?
>
> thank you very much
> serge
>Neither in the
> add/remove program nor under \Program files directory!Neither in the
> add/remove program nor under \Program files directory!Neither in the
> add/remove program nor under \Program files directory!Neither in the
> add/remove program nor under \Program files directory!|||No need for SSMSE in this case since you can use SSMS for the SQL Express
instance. For example, connect to instance 'MyServer\SQLExpress'.
Hope this helps.
Dan Guzman
SQL Server MVP
"Serge Myrand" <info@.softdelirium.qc.ca> wrote in message
news:44143B91.DA5D61B0@.softdelirium.qc.ca...
> Hi,
> I found that I had to install SQL Server Management Studio Express (SSMSE)
> but it cannot be installed when SQL Server Management Studio standard
> edition is already installed. How can'I remove SSMS? It does not appear in
> the add/remove program. And the Microsoft warning messsage shown during
> the
> installation of SSMSE is truncated!
> thank you for your time
> serge
>
> Serge Myrand wrote:
>
>|||Thank you very much.
Dan Guzman wrote:
[vbcol=seagreen]
> Yes, you can install both. The add/remove programs entry is shared. You
> can selectively change/remove instances using the single entry.
>
> The default location is "C:\Program Files\Microsoft SQL Server". You will
> have numbered subfolders(e.g. MSSQL.4) for instance-specific items.
> --
> Hope this helps.
> Dan Guzman
> SQL Server MVP
> "Serge Myrand" <info@.softdelirium.qc.ca> wrote in message
> news:44142941.EA94C30F@.softdelirium.qc.ca...