|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Hello guys
, I am new here,Well, I am moving my greetings script from MS Access to MS SQL, here is what I was using in MS Access. See this screenshot: Click Here Well, I've imported the data from access database, but I don't know how to do the AutoNumber in MS SQL, Also I don't know how can I add that Random thing *See the arrow in the screenshot* Thanks in advance |
|
#3
|
|||
|
|||
|
To get a random number, use the RAND() function.
You cannot specify it in the table definition as it is used in a statement like as follows; INSERT INTO Table (RandomNumber) SELECT RAND() RAND() will return a random number between 0 and 1 so you may have to add more logic to get a number between a specific range you want. Another thing to remember is that RAND() will return the same value if it is specified multiple times in a statement. e.g. SELECT RAND(),RAND() Hope this helps |
![]() |
| Viewing: Dev Shed Forums > Databases > MS SQL Development > Random Values in MS SQL, |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|