Jump to content
  • 0

sql command


Anime s2

Question


  • Group:  Members
  • Topic Count:  25
  • Topics Per Day:  0.01
  • Content Count:  68
  • Reputation:   6
  • Joined:  11/29/13
  • Last Seen:  

can  someone create sql command to set #SECURITYCODE variable for all inactive accounts on the server that has not yet have this variable?.


The value has to be a random number of 4 characters (between 1000 and 9999), must be stored in global_reg_value table

http://postimg.org/image/4i032qzf3/

sorry for my bad english.

Edited by Anime s2
Link to comment
Share on other sites

3 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  25
  • Topics Per Day:  0.01
  • Content Count:  68
  • Reputation:   6
  • Joined:  11/29/13
  • Last Seen:  

up

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  29
  • Reputation:   1
  • Joined:  03/27/14
  • Last Seen:  

i can help you but i don't really understand what you really want :D

Link to comment
Share on other sites


  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10013
  • Reputation:   2346
  • Joined:  10/28/11
  • Last Seen:  

INSERT INTO `global_reg_value` (`char_id`,`str`,`account_id`,`value`,`type`)
	SELECT '0','#SECURITYCODE', `account_id`,CEILING( RAND() * 10000 ),'2'
	FROM `login`;
	WHERE `account_id` 
		NOT IN ( SELECT `account_id` FROM `global_reg_value` ) 

or

-	script	Sample#main	-1,{
	
	OnInit:
		query_sql( "SELECT `login`.`account_id` FROM `login` WHERE `account_id` > 1 AND `account_id` NOT IN ( SELECT `global_reg_value`.`account_id` FROM `global_reg_value` WHERE `global_reg_value`.`str` = '#SECURITYCODE' AND `value` > 0 )",.@aid );
		.@aid_size = getarraysize( .@aid );
		while ( .@aid_size >= 1 ) {
			.@aid_size--;
			query_sql( "INSERT INTO `global_reg_value` (`str`,`account_id`,`value`,`type`) VALUES ( "+rand( 1000,9999 )+","+.@aid[.@aid_size]+",2 )" );
			if ( .@aid_size && .@aid_size % 100 == 0 ) sleep 1;
		}
		end;

}
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...