|
Posted by tatata9999 on 10/12/07 23:32
On Oct 12, 4:16 pm, Erland Sommarskog <esq...@sommarskog.se> wrote:
> (tatata9...@gmail.com) writes:
> > Very simple sql dml code (all the columns are of varchar of various
> > length):
> > insert into myTBL (col1,col2,col3)
> > values ('#ranVar#','#FORM.element1#','#FORM.element2#')
>
> > The err msg is:
> > Violation of PRIMARY KEY constraint 'PK__myTBL__772828B3EFCA'. Cannot
> > insert duplicate key in object 'myUsers'.<P><P> SQL = "insert into
> > myTBL (col1,col2,col3) values
> > ('342*783','signmeeup728...@student.org','s')" "
>
> > Actually sql server has successfully captured one record. Don't know
> > why it tries to capture it again. It would be nice to have many
> > simultanous users to use/test it... If you don't mind,
> >http://www.mytata.net/,
>
> If I understood your initial post correctly, you generated the value
> by some random process. Isn't it as simple that you are generating the
> same value twice?
>
> --
> Erland Sommarskog, SQL Server MVP, esq...@sommarskog.se
>
> Books Online for SQL Server 2005 athttp://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books...
> Books Online for SQL Server 2000 athttp://www.microsoft.com/sql/prodinfo/previousversions/books.mspx- Hide quoted text -
>
> - Show quoted text -
Erland,
I'm not sure I follow you this time. Here's some additional info.
the 'sudo' code is (why not spelt like this? :)
set alphp = "A,B,C,D,E,$,!,
%,^,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,&,*,(,)"
set ran1 = Right(Rand(),3)
set ran2 = Right(Rand(),3)
set ran3 = ListGetAt(alphp,Right(Rand(),1))
-- and initially the following line read
set ran = #ran1#&#ran3#&#ran2#
-- now the following line reads
set ran = "#ran1#&#ran3#&#ran2#"
I suspected that I forgot to "close"/quote the string var of ran. And
that caused the intermittant error.
And I always appreciate your help.
Don
[Back to original message]
|