Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 How it is working

Author  Topic 

sunsanvin
Master Smack Fu Yak Hacker

1274 Posts

Posted - 2007-11-20 : 01:33:04
Dear All,
please explain me what is going inside with this query....

select char(94 * RAND() + 33)

i saw this in FAQ, combining several same queries to generate random passwords.


i didn't get what is char(94* rand()+33)


thank you very much for your valuble time

Vinod
Even you learn 1%, Learn it with 100% confidence.

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2007-11-20 : 01:58:12
quote:
RAND
Returns a random float value from 0 through 1.


quote:
CHAR
A string function that converts an int ASCII code to a character.


32 is the ASCII code for space. Not sure what why multiply by 94 ? probably want to constraint the value between 1 and 9


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

sunsanvin
Master Smack Fu Yak Hacker

1274 Posts

Posted - 2007-11-20 : 02:06:09
please see the link KH.......

http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=59194

Vinod
Even you learn 1%, Learn it with 100% confidence.
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2007-11-20 : 02:09:43
What is your question actually ? why 94 * rand() + 33 ?


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-11-20 : 02:33:18
quote:
Originally posted by sunsanvin

Dear All,
please explain me what is going inside with this query....

select char(94 * RAND() + 33)

i saw this in FAQ, combining several same queries to generate random passwords.


i didn't get what is char(94* rand()+33)


thank you very much for your valuble time

Vinod
Even you learn 1%, Learn it with 100% confidence.


select RAND(),RAND(),RAND(),RAND(),RAND()
select char(16)


Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

sunsanvin
Master Smack Fu Yak Hacker

1274 Posts

Posted - 2007-11-20 : 02:45:38
yes KH....
why here using like that?

Vinod
Even you learn 1%, Learn it with 100% confidence.
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2007-11-20 : 02:53:46
quote:
Originally posted by sunsanvin

yes KH....
why here using like that?

Vinod
Even you learn 1%, Learn it with 100% confidence.


No idea.


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-11-20 : 03:05:55
quote:
Originally posted by sunsanvin

yes KH....
why here using like that?

Vinod
Even you learn 1%, Learn it with 100% confidence.


It randomly generates a character

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

sunsanvin
Master Smack Fu Yak Hacker

1274 Posts

Posted - 2007-11-20 : 04:21:38
This is a great day as i first time heard the word from an expert...
saying......No Idea

Vinod
Even you learn 1%, Learn it with 100% confidence.
Go to Top of Page

DonAtWork
Master Smack Fu Yak Hacker

2167 Posts

Posted - 2007-11-20 : 07:31:50
You could have asked Stephen Hawking and he would have said "I have no idea". You have given NO CONTEXT whatsoever.

[Signature]For fast help, follow this link:
http://weblogs.sqlteam.com/brettk/archive/2005/05/25.aspx
Learn SQL
http://www.sql-tutorial.net/
http://www.firstsql.com/tutor.htm
http://www.w3schools.com/sql/default.asp
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2007-11-20 : 07:39:42
quote:
Originally posted by sunsanvin

This is a great day as i first time heard the word from an expert...
saying......No Idea

Vinod
Even you learn 1%, Learn it with 100% confidence.


Really who ?


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page
   

- Advertisement -