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
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Need help in built a simple app

Author  Topic 

mahender
Starting Member

12 Posts

Posted - 2010-07-02 : 03:32:28
need help in build a simple game known as FLAMES..
each letter has a meaning og its own. like F- Friend.
When passing a INT .game logic is to cancel the letter depening on the INT
For Eg: IF INT is 4 .... in FLAMES ... 'M' gets canceled remaining is FLAES
now again INT is passed this makes FLAES to FAES .. (Count starts from the previous occures in this case Count starts from 'E')
Finally one char must be left to leave a meaning.
THks in advance

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2010-07-02 : 03:47:09
I don't see a reason to do that using T-SQL.


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

mahender
Starting Member

12 Posts

Posted - 2010-07-02 : 05:06:11
Am trying to make this app with t sql. Not like this thing is not possible.
Go to Top of Page

vaibhavktiwari83
Aged Yak Warrior

843 Posts

Posted - 2010-07-02 : 06:14:03
There is not any sense without UI.
But you can use the function to get the result by passing appropriate parameters

CREATE FUNCTION Fun_Remove( @String VARCHAR(100), @Pos INT )
RETURNS VARCHAR(100)
AS
BEGIN
DECLARE @OutResult AS VARCHAR(100)
SELECT @OutResult = REPLACE( @String, RIGHT(LEFT( @String , @Pos),1),'')
RETURN @OutResult
END



I am assuming your requirement as its not that much clear.

Please explain more like what if string has only 4 character and int is passed more than 4 ?

and you can call another function or procedure to get the last character from table where meaning of each character is stored.

Vaibhav T

To walk FAST walk ALONE
To walk FAR walk TOGETHER
Go to Top of Page

mahender
Starting Member

12 Posts

Posted - 2010-07-02 : 07:02:24
Ok .... I wil try to be more clear .... the STRING(FLAMES) doesnt change ... the number (INT (say 2-15)) will vary.... according to the string the String altered in count.
Like for eg:
INT: 3
The string is maupulated like this:
Step1: FLAMES ---- Orginal
Step2 : FLMES --- A is taken out
Step3: FLME ---- start position is frm M(from M 3 positions) , 'S' is taken out
Step4: FLE --- M is takn out
Step5: FE --- L is out
Step 6: F --- E is taken out .
Only one Char from the String is displayed
Hope u get it .. thks
Go to Top of Page

Lamprey
Master Smack Fu Yak Hacker

4614 Posts

Posted - 2010-07-02 : 11:07:37
What have you tried so far?
Go to Top of Page
   

- Advertisement -