Click here to Skip to main content
15,919,245 members
Home / Discussions / Database
   

Database

 
Questioncan any one give following vb code conversion in C# with correct syntaxes Pin
URSrafI14-Aug-06 4:40
URSrafI14-Aug-06 4:40 
AnswerRe: can any one give following vb code conversion in C# with correct syntaxes Pin
Colin Angus Mackay14-Aug-06 4:48
Colin Angus Mackay14-Aug-06 4:48 
AnswerRe: can any one give following vb code conversion in C# with correct syntaxes Pin
Ennis Ray Lynch, Jr.14-Aug-06 4:53
Ennis Ray Lynch, Jr.14-Aug-06 4:53 
QuestionXML document definition question Pin
Super Lloyd14-Aug-06 4:23
Super Lloyd14-Aug-06 4:23 
AnswerRe: XML document definition question Pin
Ennis Ray Lynch, Jr.14-Aug-06 6:10
Ennis Ray Lynch, Jr.14-Aug-06 6:10 
GeneralRe: XML document definition question Pin
Super Lloyd14-Aug-06 13:00
Super Lloyd14-Aug-06 13:00 
QuestionRandom alphanumeric generator Pin
totig14-Aug-06 0:41
totig14-Aug-06 0:41 
AnswerRe: Random alphanumeric generator Pin
totig14-Aug-06 2:19
totig14-Aug-06 2:19 
Ok, I found a way of doing this, may not be the best, but it what I thought of:

DECLARE @Length INT, @Count INT, @RandNum INT, @RandomString VARCHAR(6), @IsValid BIT

SELECT @RandomString = '', @Count = 0, @IsValid = 0, @Length = 6

WHILE (@IsValid = 0)
BEGIN
WHILE @Count < @Length
BEGIN
SET @RandNum = SUBSTRING(CAST(Rand() AS VARCHAR(20)), 3, 2)
IF (((@RandNum > = ASCII('0')) And (@RandNum <= ASCII('9')) Or (@RandNum > = ASCII('A')) And (@RandNum < = ASCII('Z'))))
BEGIN
SET @RandomString = @RandomString + CHAR(@RandNum)
SET @Count = @Count + 1
END
END
--Check here that the number is unique
IF (SELECT certificateSerialNumber FROM Certificate WHERE certificateSerialNumber = @RandomString) IS Null
BEGIN
SET @IsValid = 1
END
END

SELECT @RandomString

This cannot be used as a function though, due to the RandNumber generator. You can also emit the last part that checks if the value is unique. Change the @Length and @RandomString size to suit the size of the field that you need.
QuestionRegarding Usage of datatype 'text' Pin
H he el el oooo13-Aug-06 23:01
H he el el oooo13-Aug-06 23:01 
AnswerRe: Regarding Usage of datatype 'text' Pin
Mike Dimmick14-Aug-06 0:01
Mike Dimmick14-Aug-06 0:01 
GeneralRe: Regarding Usage of datatype 'text' Pin
H he el el oooo14-Aug-06 3:01
H he el el oooo14-Aug-06 3:01 
AnswerRe: Regarding Usage of datatype 'text' Pin
Mike Dimmick14-Aug-06 12:59
Mike Dimmick14-Aug-06 12:59 
QuestionHow to set array parameter in Sybase ASE stored procedure? Pin
Best Kiluyar13-Aug-06 20:57
Best Kiluyar13-Aug-06 20:57 
Questiongetting data from a parent table Pin
Glen Harvy13-Aug-06 18:46
Glen Harvy13-Aug-06 18:46 
AnswerRe: getting data from a parent table Pin
Eric Dahlvang14-Aug-06 10:32
Eric Dahlvang14-Aug-06 10:32 
GeneralRe: getting data from a parent table [modified] Pin
Glen Harvy14-Aug-06 13:00
Glen Harvy14-Aug-06 13:00 
QuestionReduce multiple SQL statements [modified] Pin
myNameIsRon13-Aug-06 12:34
myNameIsRon13-Aug-06 12:34 
AnswerRe: Reduce multiple SQL statements Pin
Colin Angus Mackay13-Aug-06 13:00
Colin Angus Mackay13-Aug-06 13:00 
GeneralRe: Reduce multiple SQL statements Pin
myNameIsRon13-Aug-06 15:26
myNameIsRon13-Aug-06 15:26 
Questionhandling closed page Pin
abonasser13-Aug-06 3:20
abonasser13-Aug-06 3:20 
AnswerRe: handling closed page Pin
Colin Angus Mackay13-Aug-06 3:46
Colin Angus Mackay13-Aug-06 3:46 
QuestionMySQL SQL Dictionary. Pin
NaNg1524113-Aug-06 1:38
NaNg1524113-Aug-06 1:38 
AnswerRe: MySQL SQL Dictionary. Pin
Colin Angus Mackay13-Aug-06 3:19
Colin Angus Mackay13-Aug-06 3:19 
QuestionError in select statement Pin
very_short_life12-Aug-06 4:00
very_short_life12-Aug-06 4:00 
AnswerRe: Error in select statement Pin
Rob Graham12-Aug-06 4:09
Rob Graham12-Aug-06 4:09 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.