sqlhelp Posted February 10, 2015 Report Posted February 10, 2015 sql server help oka table lo there is a column with codes like example ID Name Code 1 news TYUW 2 paper ABCD aithe naku ah code lo unna values ni inko table lo ki insert cheyali by reordering the code value in 4 different ways ID Name Code 1 news1 YUTW 2 news2 UYWT 3 news3 TUWY 4 news4 WTUY How can i reorder the values and insert them ? I tried something like below kani values repeat avthunayi.. Declare @Alphanum Varchar(4) = 'TYUW' Select SubString(@Alphanum, 1 + ( Cast( 4 * Rand( cast(newid() as varbinary) ) as Int)), 1) + SubString(@Alphanum, 1 + ( Cast( 4 * Rand( cast(newid() as varbinary) ) as Int)), 1) + SubString(@Alphanum, 1 + ( Cast( 4 * Rand( cast(newid() as varbinary) ) as Int)), 1) + SubString(@Alphanum, 1 + ( Cast( 4 * Rand( cast(newid() as varbinary) ) as Int)), 1) basically ivii oka question ki multiple choice answers , so random ga code values ni dfferent options laga chupiyali where user will choose order of the code value.
Usktapa Posted February 10, 2015 Report Posted February 10, 2015 values repeat aithe distinct petkovach kada..
sqlhelp Posted February 10, 2015 Author Report Posted February 10, 2015 em order la cheyale.?? distinct chesina alage unayi edaina order doesn't matter.
4Vikram Posted February 10, 2015 Report Posted February 10, 2015 sql server help oka table lo there is a column with codes like example ID Name Code 1 news TYUW 2 paper ABCD aithe naku ah code lo unna values ni inko table lo ki insert cheyali by reordering the code value in 4 different ways ID Name Code 1 news1 YUTW 2 news2 UYWT 3 news3 TUWY 4 news4 WTUY How can i reorder the values and insert them ? I tried something like below kani values repeat avthunayi.. Declare @Alphanum Varchar(4) = 'TYUW' Select SubString(@Alphanum, 1 + ( Cast( 4 * Rand( cast(newid() as varbinary) ) as Int)), 1) + SubString(@Alphanum, 1 + ( Cast( 4 * Rand( cast(newid() as varbinary) ) as Int)), 1) + SubString(@Alphanum, 1 + ( Cast( 4 * Rand( cast(newid() as varbinary) ) as Int)), 1) + SubString(@Alphanum, 1 + ( Cast( 4 * Rand( cast(newid() as varbinary) ) as Int)), 1) basically ivii oka question ki multiple choice answers , so random ga code values ni dfferent options laga chupiyali where user will choose order of the code value. PM Loveindia or Gymbalu bhaiyya, they might help.... LTT for experts
mtkr Posted February 10, 2015 Report Posted February 10, 2015 neeku aa word lo oche anni combinations kaaval? or any specific 4 values a? or any other spl condition?
Usktapa Posted February 10, 2015 Report Posted February 10, 2015 neeku aa word lo oche anni combinations kaaval? or any specific 4 values a? or any other spl condition? specific 4 kadh..any unique 4.
mtkr Posted February 10, 2015 Report Posted February 10, 2015 specific 4 kadh..any unique 4. akkada YTUW kuda oka possible value... so adi enduku expoect cheyyatledhu??? ade asking only any specific 4 values kaavala r thana requirement enti ani? ante 5 letter word unte any 5 values return cheyyala or all possible combinations aa?
sqlhelp Posted February 10, 2015 Author Report Posted February 10, 2015 akkada YTUW kuda oka possible value... so adi enduku expoect cheyyatledhu??? ade asking only any specific 4 values kaavala r thana requirement enti ani? ante 5 letter word unte any 5 values return cheyyala or all possible combinations aa? nenu just example ala rasanu any random order with these 4 values TYUW TYUW is right order so user ni 4 seprate questions lo 1st code ? 2nd code ila multiple choices tho adgutham so however the order is like 1st question ki T avthundi answer
Usktapa Posted February 10, 2015 Report Posted February 10, 2015 md5? ante nek values osthunai anav kada..so aa values ki md5 hash values assign cheshi..4 values select chesko.. fox ex itla untai hash values.. YUTW- 70227b9573dffe3a5d363a8c126144cf UYWT-05fcd35711b0d3ab554db8766eac6a59 TUWY-efaf2210b3621a6f1af61cd8f00c16ea WTUY-9243a5d3bbbd5698507f0fdb91f3d7a1
mtkr Posted February 10, 2015 Report Posted February 10, 2015 nenu just example ala rasanu any random order with these 4 values TYUW TYUW is right order so user ni 4 seprate questions lo 1st code ? 2nd code ila multiple choices tho adgutham so however the order is like 1st question ki T avthundi answer ee multiple choice ento ardam kaaled.. but oka way is... (assuming colum value is fixed.. like here 4) split the word into multiple columns like TYUW ni T Y U W then apply cross join with one whr condition applying any one of col is not equal to thr
sqlhelp Posted February 10, 2015 Author Report Posted February 10, 2015 ee multiple choice ento ardam kaaled.. but oka way is... (assuming colum value is fixed.. like here 4) split the word into multiple columns like TYUW ni T Y U W then apply cross join with one whr condition applying any one of col is not equal to thr sorry ardam avaledhu how would that generate a code of 4 letters ?
Recommended Posts