Aşağıdaki gibi bir SQL buldum ama update satırını nereye sıkıştırcaz ?
[code]declare @pLoopCounter as integer
declare @pMyInt as integer
declare @pMyNewInt as integer
declare @pMyString as varchar(8)
select @pLoopCounter = 1
select @pMyString = ''
while @pLoopCounter < 9
begin
select @pMyInt = cast( rand () * 62 as integer)
select @pMyNewInt = case
when @pMyInt between 0 and 9 Then @pMyInt + 48
when @pMyInt between 10 and 35 then @pMyInt + 55
when @pMyInt >= 36 then @pMyInt + 61
Create view vw_GetRandomNumber
AS
SELECT rand() as Num
The view is necessary because normally in a UDF we cannot use the rand() function, because that would make the function non-determistic. We can trick the UDF to accepting a random number by using a View.
CREATE FUNCTION fn_GetRandNumber(@Min int, @Max int)
RETURNS int
AS
BEGIN
DECLARE @Return int
Set @Max = @Max+1
set @Return = (@Min) + (select Num from vw_GetRandomNumber) * (@Max-@Min)
return @Return
END