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 2000 Forums
 Transact-SQL (2000)
 Is it possible?

Author  Topic 

Eagle_f90
Constraint Violating Yak Guru

424 Posts

Posted - 2002-05-14 : 21:18:21
I was wondering what I would need to do to acomplish the following.
I have a table (privetinfo) wich has two coulmns(Known Moves and CurentMove) is it possible to write a T-SQL script that takes what is listed in the curentMove coulmn and adds it to the knownmoves coulm. And then also looks to see if, this is an example, Ki Blast level 1 is in knownmoves and if Ki Blast level 2 is in currentmove then it replaces Ki Blast level 1, this would happen for almost every single one of the 50 some odd moves there are and each move has 6 levels.
Guys have any ideas? Thanks for the help.

Always remember, it is all or nothing there is no in-between.

Merkin
Funky Drop Bear Fearing SQL Dude!

4970 Posts

Posted - 2002-05-14 : 21:23:31
quote:


it possible to write a T-SQL script




yes

Damian
Go to Top of Page

robvolk
Most Valuable Yak

15732 Posts

Posted - 2002-05-14 : 21:31:59
To elaborate on Merkin's reply, it IS possible if:

-we know what the complete structure of your table(s) are
-we have some idea exactly what these tables are storing
-we have some idea what the hell you're actually trying to do

I'm only saying this because of the 10 or so questions you've posted on these tables, nothing has elucidated their function. I imagine it is some kind of game that you're working on, but it's EXTREMELY HARD for us to help without any kind of background into what exactly you want or need to do. Because, quite frankly:
quote:
And then also looks to see if, this is an example, Ki Blast level 1 is in knownmoves and if Ki Blast level 2 is in currentmove then it replaces Ki Blast level 1, this would happen for almost every single one of the 50 some odd moves there are and each move has 6 levels. Guys have any ideas?

...based on that sentence (did James Joyce write that?) I haven't got a f---ing clue what you're talking about.

Go to Top of Page

rrb
SQLTeam Poet Laureate

1479 Posts

Posted - 2002-05-14 : 22:08:02
Talking about great literary uses if the "f" word - which I know you weren't - I believe that an Aussie takes the cake...
"How the f--- is it that you don't know how to make an omelette?" - (Peter Carey).

--
I hope that when I die someone will say of me "That guy sure owed me a lot of money"
Go to Top of Page

robvolk
Most Valuable Yak

15732 Posts

Posted - 2002-05-14 : 22:12:10
That is indeed a great usage!

I'm thinking that James Joyce was appropriate because he also like to use f--- as a means of expression, and I couldn't figure out what he was talking about either! He also liked to write run-on sentences!

Go to Top of Page

rrb
SQLTeam Poet Laureate

1479 Posts

Posted - 2002-05-14 : 22:33:38
Ever read Ulysses?

--
I hope that when I die someone will say of me "That guy sure owed me a lot of money"
Go to Top of Page

Eagle_f90
Constraint Violating Yak Guru

424 Posts

Posted - 2002-05-15 : 00:03:29
I am sorry, I am not very good a converting ideas to text I try my best but apparently it is not good enough so I will try again. You are correct I am trying to automate an on-line RPG I run. In this RPG there are special attacks you can learn to use in battles and each special attack has different levels to them, with each level causing more damage. Each player has his/her own row in each table. There are 3 tables in total. Stats, PlayerINFO, PublicINFO, PrivetINFO. In the Table PrivetINFO all that player's special attacks are contained in a column named KnownMoves. Also in that table is a column name CurentMove, this column contains the Name of the current move the player is learning at that time. I have written a T-SQL script to take CurnetMove's information and add it to the KnownMoves information. Now that would normal be fine for me but I run into the case of someone wanting to increase the level of an attack from say level 1 to level 2. Now if I say with this attack and someone has increased the level of say there Ki Blast to level 5 there would be a huge list of moves. What I want the script to do is see if Ki Blast level 1 is already a know move and if it is then change it to Ki blast level 2 once the person finishes leveling up that attack, but still keep the rest of the knownmoves list. I do hope this helps, and I do really appreciate your guys help on this matter, I am giving props and a link to this site for helping.

Always remember, it is all or nothing there is no in-between.
Go to Top of Page

rrb
SQLTeam Poet Laureate

1479 Posts

Posted - 2002-05-15 : 00:16:57
quote:
Ulysses

Don't worry - neither have I...

Just to clarify -

1. so when they learn a level2 version of Ki Blast - can they chose whether to use Level1 or Level2 or must they always use the highest level?

2. Sounds like you're storing Known Moves as CSV in a column? Bad idea. Separate these into a new table:

KNOWN_MOVES
--------------
ID (PK), PLAYER (FK), MOVE, LEVEL


Then, when they learn level 2 Ki Blast, you can just do:
UPDATE KNOWN_MOVES
set LEVEL = 2
where MOVE = 'Ki Blast' and PLAYER = XXX


or even
...
set LEVEL = LEVEL + 1
...


HTH - PS - where can I play?

--
I hope that when I die someone will say of me "That guy sure owed me a lot of money"

Edited by - rrb on 05/15/2002 00:19:32
Go to Top of Page

Eagle_f90
Constraint Violating Yak Guru

424 Posts

Posted - 2002-05-15 : 00:37:32
They always have to use the higher level. I was thinking of making a seprate table but would that not make it so I would need to have a coulmn for each move? That is going to be a long time making, there are over 50 moves, could you kinda clerify on how to make that table? Or are you talking about making the table with 6 coulms? 1 coulmn for each level and then the playerID coulmn?

And to play goto http://dbzrpg.eagleinternetdesign.com/
I welcome all people who wish to play.

Always remember, it is all or nothing there is no in-between.
Go to Top of Page

rrb
SQLTeam Poet Laureate

1479 Posts

Posted - 2002-05-15 : 00:42:12
No, all you need is four columns

KNOWN_MOVES
--------------
ID (PK), PLAYER (FK), MOVE, LEVEL


When you want to know all the moves a player can do - you join back to your players table
select p.playername, km.Move, km.Level
From players p left join known_moves km
on p.player = km.player
where p.playername = 'freddy mercury'
- or whatever

Keep asking if you're not sure what I mean....

--
I hope that when I die someone will say of me "That guy sure owed me a lot of money"

Edited by - rrb on 05/15/2002 00:55:07
Go to Top of Page

Eagle_f90
Constraint Violating Yak Guru

424 Posts

Posted - 2002-05-15 : 01:14:15
I see what your saying now, each move would have it's own record. Thanks for the help, well I have to go to work now so youy all have a good night.

Always remember, it is all or nothing there is no in-between.
Go to Top of Page

Eagle_f90
Constraint Violating Yak Guru

424 Posts

Posted - 2002-05-15 : 01:14:17
I see what your saying now, each move would have it's own record. Thanks for the help, well I have to go to work now so youy all have a good night.

Always remember, it is all or nothing there is no in-between.
Go to Top of Page

rrb
SQLTeam Poet Laureate

1479 Posts

Posted - 2002-05-15 : 01:17:19
Good night? It's only 2:47pm here in adelaide...

--
I hope that when I die someone will say of me "That guy sure owed me a lot of money"
Go to Top of Page
   

- Advertisement -