Need Random/unique &&"ID's&&" For Key Verification

Aug 6, 2007

I need to be able to create completely random and unique keys for a key verification system, which would require a user to enter a pre-defined key in order to activate their account, but I need to be able to create those keys on the fly.

This is going to be a key that will be mailed to them on paper, and unfortunately means it needs to be relatively short in order to prevent too much confusion while they are typing it in.

I like the newID() function in SQL, but the ID that it creates is a bit excessive to say the least for someone to have to type when registerring.

I use C#, so I wouldn't have much of a problem creating a small app to create x number of keys, which will sit in the DB until I need them, but I would rather not have to fill the DB with a million or so ID's which might never be used, and don't want to create too little that I have to track when I might need to add more, in case I start to run low on ID's.

Re-using ID's may be an option, but I would prefer to keep them intact for the life of the accounts.

If there is something that I can do to simulate the newID() function, but generate unique/random ID's which look more like this: A97-2C5-77D than this: A972C577-DFB0-064E-1189-0154C99310DAAC12 I would be very grateful to know about it.

Thanks!

View 1 Replies


ADVERTISEMENT

Unique Random Row Id

May 4, 2006

I once came across a database in which when ever a row was inserted, a unique random code was also inserted in a column. This code generated was similar to format like {8A5FE5F1-6BDA-476C-A4DB584A7710FBF91121054625}. I was told that SQL2000 has some inbuilt functionality for this.

Any idea on how to do this using SQL2000 or coding.
I feel this is much better than Identity Column as using autonumbers in quesrystring is too much risky as they easily readable.

Please help.
Thanks

View 1 Replies View Related

Create A Unique Random Integer

Oct 22, 2004

Hi there,I am trying to create a UID that is unique within my SQL Server. There are many users accessing the Server in seperate databases, but then I want to combine all the data from these tables, keeping the ID from each one as a primary key. I have written the following function, but when i call it as a default value for a field, it does not produce a unique number. CREATE FUNCTION GETNEXTID(@CURDATE DATETIME)RETURNS BIGINTASBEGINRETURN (SELECT CAST(CAST(DATEPART(YY,@CURDATE) AS VARCHAR) +RIGHT('0' + CAST(DATEPART(M,@CURDATE) AS VARCHAR),2) +RIGHT('0' + CAST(DATEPART(D,@CURDATE) AS VARCHAR),2) +RIGHT('0' + CAST(DATEPART(HH,@CURDATE) AS VARCHAR),2) +RIGHT('0' + CAST(DATEPART(SS,@CURDATE) AS VARCHAR),2) +RIGHT('00' + CAST(DATEPART(MS,@CURDATE) AS VARCHAR),3) AS BIGINT))END Can anyone help?

View 2 Replies View Related

How To Random Increment Unique Identity

Aug 28, 2007

Hi, for some reason I want to have a unique ID with a seed and random Identity increment (I want an ascending ID's but without able to know how many objects there are).

any ideas?
thanks in advance

View 12 Replies View Related

Generate Random And Unique Number Within Sql ?

Dec 11, 2007

I need to generate a random 10 digit alphanumeric string that is also unique within a table. My application will be calling a stored procedure to insert this number into the table. This number will be associated with a id from another table. Is it better to generate the random number within sql (and perform the lookup at the same time), then just pass the number back to the calling application ?

If the calling application generates the number, it will also need to make a call to check if its unique. So im thinking it would be best to simply have sql generate this random number, check the number against the table and then insert the new record.

thoughts ?

View 5 Replies View Related

Transact SQL :: Set Unique Random Number

Dec 1, 2015

Lets say we have a table (tblProducts)

ID   Item             RandomNumber
-------------------------------------------
1    JEANS                      1234567
2    SHIRT                    72813550
3    HOOD                             Null
4    TROUSER               72191839
5    BLAZER                              0

I want to perform a query so that SQL should look for RandomNumber Values and set a Unique Random Number Where RandomNumber Value is Null or 0.So I have got a solution as one of the MSDN Member shared the below query

select id,item,RandomNumber=Case when RandomNumber=0 then (select floor(rand()*100000000-1))
when RandomNumber is null then (select floor(rand()*100000000-1))
else RandomNumber end from tblProducts

So, can you all confirm me, that performing this query ensures that if a Value is assigned to one of the Item in RandomNumber Column, that value will not be assignend to any other Item in RandoNumberColumn.

View 15 Replies View Related

Random Unique Values In SQL Server 2005

Jan 14, 2008

 
Hi I am using VS 2005 with SQL 2005.
I had a Datagrid and i Need to bind data into it.
I need to show Random Unique ID's based on the Parameter i pass.
I wrote select top 5 * from Employee order by NEWID()
for this i had created a Stored Procedure as
create Proc Demo(@N int)as beginselect top @N * from Employee order by NEWID()end
Its showing a syntax error near @N. How can i pass the parameter for Select Top @N * from .......

View 6 Replies View Related

How To Generate Random UNIQUE 13 Digit Number?

Aug 22, 2007

Hi

I have a sql procedure. I need to create UNIQUE random 13 digit number to use for barcode.

How do I generate 13 digit UNIQUE random in sql procedure?

Advance thanks

View 20 Replies View Related

Returning Random Records And NOT Similar (random Questions)

Jul 20, 2005

Hi,I need to extract randomly 5 records from the table "Questions". Now I useSELECT TOP 5 FROM Questions ORDERBY NEWID()And it works. The problem is that I need an additional thing: if SQLextracts record with ID=4, then it should not extract record with ID=9,because they are similar. I mean, I'd like something to tell SQL that if itextracts some questions, then it SHOULD NOT extract other ones.How can I do it?Thanks!Luke

View 1 Replies View Related

Verification?

Jun 9, 2008

I have a report with 5 tables. After I've generated the report using sql how do I verify if it is right or not?

Thanks.

View 1 Replies View Related

Drive Verification

Jun 19, 2008

How is it possible to use sql to verify F: drive is on disk 0 ?
Thanks

View 3 Replies View Related

Email ID Verification

Jan 25, 2006

Hi

I already have some junk data in my tables , need to check if the email id entered makes sense or not

Want to check whther there is only 1 @ character or more...etc

Thanks
Kid

View 1 Replies View Related

Verification Origin

Jul 7, 2006

Hello, it wanted to know since I can do so that enla ejecucuion of the package is verified if the archives of origins of excel exist, in the case that do not exist not to execute their flow thanks

View 2 Replies View Related

Mirroring Verification

Jan 17, 2007

I connected to the mirror server and the database is in restoring mode, which I believe means I can't query it. I found the Database Mirroring Monitor but it shows the same thing that Management Studio shows, which is Synchronized.

Do I just have to trust that Synchronized means everything is working?

I was hoping there was a way to look at the tables and verify that changes were taking place without performing a manual failover

Thanks in Advance for your help

Casey Smith
caseys@nhcolorado.com

View 1 Replies View Related

URGENT - Random 10 From Random 20 (2 Tbls)

Oct 14, 2004

I'm using ASP and SQL Serv 2000. What I need to get from 2 tables (company & customers) is random 10 customers from random 20 comp.
Anyone got an idea how to do this??? I've spent 2 days trying to get stored proc. or T-SQL to work, but nothing good came out of it. I can get 1 comp and 10 cust, but not a grouped list of 20 comp. w/ 10 cust. each.

Help is greatly appreciated.

View 1 Replies View Related

Data Verification Problem

Jan 7, 2008

hi
there is a problem when i insert data into tables in data base from textbox, spaces are added to the string so when i write the same data again in another textbox to retrive the data from the table there is a conflict happened
any one can help me to solve this problem
more explaination:
i use 2 textboxes to register a user as member in web site one is user name and the other is password and save the inserted data in my database
but when i make login in the same registerd username and password a conflict happened because the both user name and password in data base stored with spaces after there's string in database.

View 2 Replies View Related

Data Verification Errors

Aug 30, 2002

I get the following error when I run a job created by a maintenance plan that
runs a database backup.

[2] Database OurData: Database Backup...

The backup was not performed since data verification errors were found.

Any input on how to correct this is appreciated.
Thanks

View 1 Replies View Related

Data Verification And Matching

Apr 17, 2008

i have one task in which i have to match some attributes(required for creating a new databse) with the exiting database, are these attributes present in exisisting database, if yes how many , and how many are not,pls do reply

View 3 Replies View Related

Installation Verification Issue

Jun 19, 2007

Hello

I Just installed Reporting Services 2005 and I have a problem to make work

After installing it and setting different properties in the Reporting Services Configuration Manager, When it comes to verifying the installation, http://localhost/ReportServer or http://localhost/Reports pops up a Login Window, Where I enter Windows Account Username/Password, but this windows pops up again 3 times then I get Error page with the message:
HTTP 401.1 - Unauthorized: Logon Failed
Internet Information Services
SQL Server 2005 with SP2 is installed on WinXP SP2

What could be the reason?

View 3 Replies View Related

DBCC CHECKDB And Page Verification

Aug 27, 2015

differences betwee DBCC CHECKDB and page verifacation. The best practices indicate you should run DBCC CHECKDB regularly and set page verifacation to CHECKSUM. Both seem to be linked to identifying database corruption? Are they checking for the same thing? Or are they serving different purposes?

View 3 Replies View Related

SQL Server 2005 SP1 Installation Hangs At Authentication Verification

May 9, 2006

After the installer has asked for authentication mode and has started verifying the authentication it simply hangs. I've let it sit there for an hour before taking the installer forcibly down but nothing seems to be happening except for two osql.exe processes showing up in the task manager.

I've tried both windows authentication and SQL server authentication but the outcome is always the same. At the same time I'm, however, able to login to the database engine and all services with management studio using both authentication modes.

The last few lines in HotFix.log are as follows:

05/09/2006 09:49:09.999 Authenticating user using Windows Authentication
05/09/2006 09:49:10.015 SQL Service MSSQLServer was previously running, ready for authentication
05/09/2006 09:49:10.218 SQL Agent Service SQLSERVERAGENT was previously running
05/09/2006 09:49:12.093 User authentication was successful

This would indicate that there's nothing wrong with the authentication but with whatever is supposed to take place after that.

There are quite a few lines in the log similar to the one below:

05/09/2006 09:47:08.438 Failed to read associated hotfix build information for the following file: C:Program FilesMicrosoft SQL ServerMSSQL.2MSSQLBinnSQLServr.exe

Redist9_Hotfix_KB913090.log seems to be the only individual log file that ends with line saying "Hotfix package launched" whereas all other logs have several lines of checks being completed successfully.

Any ideas what might be causing the installer to hang and how to fix it?

View 4 Replies View Related

Data Integrity Verification Once Backups Transferred To Remote Server?

Feb 18, 2015

I am thinking about moving some backups from the local machine to a remote server. Right now, I am using Ola Hallengren script for backups. The script performs checksum on the backup while it's being written on the disk. I am going to move the files using Robocopy utility. How do I check the data integrity once the backups are transferred to the remote server?

View 5 Replies View Related

SQL Server 2012 :: Failing On Update With Unique Index Error (Not Unique)

Jul 5, 2015

This index is not unique

ix_report_history_creative_id

Msg 2601, Level 14, State 1, Procedure DFP_report_load, Line 161
Cannot insert duplicate key row in object 'dbo.DFP_Reports_History' with unique index 'ix_report_history_creative_id'.

The duplicate key value is (40736326382, 1, 2015-07-03, 67618862, 355324).
Msg 3621, Level 0, State 0, Procedure DFP_report_load, Line 161

The statement has been terminated.

Exception in Task: Cannot insert duplicate key row in object 'dbo.DFP_Reports_History' with unique index 'ix_report_history_creative_id'. The duplicate key value is (40736326382, 1, 2015-07-03, 67618862, 355324).

The statement has been terminated.

View 6 Replies View Related

What Is The Difference Between A UNIQUE INDEX And A UNIQUE CONSTRAINT?

Sep 22, 2004

A UNIQUE INDEX must inherently impose a unique constraint and a UNIQUE CONSTRAINT is most likely implemented via a UNIQUE INDEX. So what is the difference? When you create in Enterprise Manager you must select one or the other.

View 8 Replies View Related

Unique Constraint Vs Unique Index In MS SQL 2000

Jul 20, 2005

HelloWhat should I use for better perfomance sinceunique constraint always use index ?ThanksKamil

View 5 Replies View Related

Unique Constraint And Unique Index, What's The Difference?

Jun 24, 2006

What's the difference in the effect of the followings:
CREATE UNIQUE NONCLUSTERED INDEX
and
ALTER TABLE dbo.titles ADD CONSTRAINT
titleind UNIQUE NONCLUSTERED

I found there're two settings in Indexs/Keys dialog box of the management studio, Is Unique, and Type. The DDL statements above are generated by setting Is Unique to yes plus Type to Index, and just Type to Unique Key, respectively. What's the difference between them?

View 1 Replies View Related

Unique Index Vs Unique Constraint

Mar 7, 2001

Hi everyone,
I need urgent help to resolve this issue...
As far as the performance goes which one is better..
Unique Index(col1, col2) OR Unique constraint(col1, col2) ?
Unique constraint automatically adds a unique index
and unique index takes care of uniqueness then whats the use of unique constraint ?

Which one do one use ?

thanks
sonali

View 4 Replies View Related

Unique Constraint Vs Unique Index

Jan 20, 2006

BOL says a unique constraint is preferred over a unique index. It also states that a unique constraint creates a unique index. What then is the difference between the two, and why is a constraint preferred over the index?

View 2 Replies View Related

Unique Index Vs Unique Constraints

Mar 26, 2008



hi team,
.Can i create umique constraint with out unique index.when i am creating a unique constraint sql creates a unique index (default) can i have only unique constraint ?

View 12 Replies View Related

How To Select Unique Row When Entire Row Not Unique?

Mar 12, 2008

I am having a problem trying to figure out the best way to get the results I need. I have a table of part numbers that is joined with a table of notes. The table of notes is specific to the part number and user. A row in the notes table is only created if the user has entered notes on that part number. I need to create a search that grabs all matches on a keyword and returns the records. The problem is that it currently returns a row from the parts table with no notes and a separate row with the notes included if they had created an entry. It seems like this should be easy but it eludes me today.
Here is the code



Code Snippet
create procedure SearchPartKeyword
(
@Keyword varchar(250) = null,
@Universal_Id varchar(10) = null
)
as
select p.PartNumber, p.Description, p.ServiceOrderable, n.MyNotes, p.LargestAssembly, p.DMM,
p.Legacy, p.Folder, p.Printer
from Parts p inner join notes n on p.PartNumber = n.Identifier
where n.Universal_ID = @Universal_ID and p.Description like @Keyword
union
select p.PartNumber, p.Description, p.ServiceOrderable, '' as MyNotes, p.LargestAssembly,
p.DMM, p.Legacy, p.Folder, p.Printer
from Parts p
where p.Description like @Keyword





and the results:
PartNo Description SO Notes LA DMM Legacy Folder Printer
de90008 MAIN BOARD 1 DGF1 114688 0 0 0
de90008 MAIN BOARD 1 I love this part Really I do DGF1 114688 0 0 0

This could return multiple part numbers and If they have entered notes I want the row with the notes

Thank You
Dominic Mancl

View 1 Replies View Related

What 's Difference Between Unique Key And Unique Index

Nov 13, 2007

What 's difference between Unique key and unique index in SQL server 2005?

View 9 Replies View Related

A Unique Unique Constraint

May 1, 2008

Here is the table I created:

create table Test (
[recId] [int] identity(1, 1) not null,
[code] [varchar](50) not null,
[prime] [bit] not null constraint [DF_Test_prime] default (cast(0 as bit)),
constraint [PK_Test] primary key clustered
(
[recId]
) with fillfactor = 90 on [primary]
) on [primary]
go

insert into Test (code, prime) values ('AVA', cast(1 as bit))
insert into Test (code, prime) values ('BUS', cast(1 as bit))
insert into Test (code, prime) values ('BUS', cast(0 as bit))
insert into Test (code, prime) values ('BUS', cast(0 as bit))
insert into Test (code, prime) values ('CAR', cast(1 as bit))
insert into Test (code, prime) values ('CAR', cast(0 as bit))
insert into Test (code, prime) values ('RLW', cast(1 as bit))
insert into Test (code, prime) values ('RLW', cast(0 as bit))
insert into Test (code, prime) values ('RLW', cast(0 as bit))

select *
from Test

I need to create a constraint on this table that will not allow me to have two rows that are prime for the same code. So the following insert statement should fail:

-- This should fail
insert into Test (code, prime) values ('RLW', cast(1 as bit))


Thanks for you help!

Regards,
Anand

View 11 Replies View Related

Random Row

Jul 20, 2005

Hi there.I need to fetch ONE random row from many. How can i get it? I try toexecute "SELECT field.table FROM table ORDER by RAND()" no effect.Thank you.

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved