Confused need a query (Merged) [message #390297] |
Thu, 05 March 2009 15:28  |
boris37
Messages: 1 Registered: March 2009 Location: Canada
|
Junior Member |
|
|
So i have to write a query for my work and i'm totally lost using sql server.
Here is what the query is supposed to do:
1) Remove a set bunch of chars from a string(two different rows, same string...)
2) Keep the original string while taking out these original chars.
3) I need an Array and a loop to be able to do it
I am trying write a block but every time i do anything sql server gives me problems saying "didn't expect this here" or something.
Is this even doable in sql server?
I kinda had something like :
DECLARE
CURSOR c1 is ('-','/');
BEGIN
loop
END
in my mind but sql server even gives me issues with the cursor... any tips would be nice but i just need an array i can manually populate. I can run the following query but i have to do it 10-15 times to remove the chars and i want something cleaner(even if it takes me much longer)
UPDATE coalarm set almsentence=replace(almsentence, '-', ' of '),
normsentence=replace(normsentence, '-', ' of ') where almstorenid=23127
**Note** this is only one row hence the "where" clause.
THanks!
Lastly this is my first time using sql server and it's a little different from sqlplus... at least the cryptic errors and fact i can't do anything i could in sqlplus but maybe it's just me.
|
|
|
|