August 19, 2009 at 8:16 am
create table Test
(
INST_NO binary(3),
PROS_YYYYMMDD binary(8),
REC_YYYYMMDD binary(8),
REC_HHMMSSHS binary(8),
FROM_INST_NO binary(3),
FROM_ACCT_NO binary(16)
)
INST_NO ,PROS_YYYYMMDD,REC_YYYYMMDD,REC_HHMMSSHS are primary keys
I want to make the data in REC_HHMMSSHS random and not be repeated
How can I do that
August 19, 2009 at 8:18 am
Are you just talking about generating test data, or do you mean you want it random and unique in the production database?
- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread
"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
August 19, 2009 at 8:32 am
I'm sure you have your reasons, but it seems strange to me that everything is binary, even though column names indicate other data types.
to answer your question:
SELECT cast (newid() as binary(8))
would give you a unique binary value each time
~BOT
Craig Outcalt
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply